Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2017 the original author or authors. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | SERVER_OUT := "bin/AbstractOLT" |
| 18 | CLIENT_OUT := "bin/client" |
| 19 | API_OUT := "api/abstract_olt_api.pb.go" |
| 20 | API_REST_OUT := "api/abstract_olt_api.pb.gw.go" |
| 21 | SWAGGER_OUT := "api/abstract_olt_api.swagger.json" |
| 22 | PKG := "gerrit.opencord.org/abstract-olt" |
| 23 | SERVER_PKG_BUILD := "${PKG}/cmd/AbstractOLT" |
| 24 | CLIENT_PKG_BUILD := "${PKG}/client" |
| 25 | PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/) |
Zack Williams | 34cd8f9 | 2018-09-14 16:04:19 -0700 | [diff] [blame] | 26 | DOCKERTAG ?= "latest" |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 27 | |
Zack Williams | 34cd8f9 | 2018-09-14 16:04:19 -0700 | [diff] [blame] | 28 | .PHONY: all api server client test docker |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 29 | |
| 30 | all: server client |
| 31 | |
| 32 | api/abstract_olt_api.pb.go: |
| 33 | @protoc -I api/ \ |
| 34 | -I${GOPATH}/src \ |
| 35 | -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ |
| 36 | --go_out=plugins=grpc:api \ |
| 37 | api/abstract_olt_api.proto |
| 38 | |
| 39 | api/abstract_olt_api.pb.gw.go : |
| 40 | @protoc -I api/ \ |
| 41 | -I${GOPATH}/src \ |
| 42 | -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ |
| 43 | --grpc-gateway_out=logtostderr=true:api \ |
| 44 | api/abstract_olt_api.proto |
| 45 | |
donNewtonAlpha | 5234b13 | 2018-08-16 14:12:28 -0400 | [diff] [blame] | 46 | api/xos.pb.go: |
| 47 | @protoc -I seba-api/ \ |
| 48 | -I${GOPATH}/src \ |
| 49 | -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ |
| 50 | -I${GOPATH}/src/github.com/googleapis/google/api \ |
| 51 | -I${GOPATH}/src/github.com/googleapis/ \ |
| 52 | --go_out=plugins=grpc:seba-api \ |
| 53 | seba-api/xos.proto |
| 54 | |
donNewtonAlpha | b9b85eb | 2018-08-14 14:28:22 -0400 | [diff] [blame] | 55 | |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 56 | swagger: |
donNewtonAlpha | b9b85eb | 2018-08-14 14:28:22 -0400 | [diff] [blame] | 57 | @protoc -I api/ \ |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 58 | -I${GOPATH}/src \ |
| 59 | -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ |
| 60 | --swagger_out=logtostderr=true:api \ |
| 61 | api/abstract_olt_api.proto |
| 62 | |
| 63 | api: api/abstract_olt_api.pb.go api/abstract_olt_api.pb.gw.go swagger |
| 64 | |
| 65 | dep: ## Get the dependencies |
| 66 | @go get -v -d ./... |
| 67 | |
| 68 | server: dep api ## Build the binary file for server |
| 69 | @go build -i -v -o $(SERVER_OUT) $(SERVER_PKG_BUILD) |
| 70 | |
| 71 | client: dep api ## Build the binary file for client |
| 72 | @go build -i -v -o $(CLIENT_OUT) $(CLIENT_PKG_BUILD) |
| 73 | |
| 74 | clean: ## Remove previous builds |
| 75 | @rm $(SERVER_OUT) $(CLIENT_OUT) $(API_OUT) $(API_REST_OUT) $(SWAGGER_OUT) |
donNewtonAlpha | b9b85eb | 2018-08-14 14:28:22 -0400 | [diff] [blame] | 76 | @rm -rf seba-api |
| 77 | |
| 78 | test: all |
| 79 | @go test ./... |
| 80 | @go test ./... -cover |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 81 | |
Zack Williams | 34cd8f9 | 2018-09-14 16:04:19 -0700 | [diff] [blame] | 82 | docker: ## build docker image |
| 83 | @docker build -t opencord/abstract-olt:${DOCKERTAG} . |
| 84 | |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 85 | help: ## Display this help screen |
| 86 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |