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/) |
| 26 | |
| 27 | |
| 28 | .PHONY: all api server client |
| 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 | b9b85eb | 2018-08-14 14:28:22 -0400 | [diff] [blame] | 46 | api/xos.go: |
| 47 | |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 48 | swagger: |
donNewtonAlpha | b9b85eb | 2018-08-14 14:28:22 -0400 | [diff] [blame] | 49 | @protoc -I api/ \ |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 50 | -I${GOPATH}/src \ |
| 51 | -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ |
| 52 | --swagger_out=logtostderr=true:api \ |
| 53 | api/abstract_olt_api.proto |
| 54 | |
| 55 | api: api/abstract_olt_api.pb.go api/abstract_olt_api.pb.gw.go swagger |
| 56 | |
| 57 | dep: ## Get the dependencies |
| 58 | @go get -v -d ./... |
| 59 | |
| 60 | server: dep api ## Build the binary file for server |
| 61 | @go build -i -v -o $(SERVER_OUT) $(SERVER_PKG_BUILD) |
| 62 | |
| 63 | client: dep api ## Build the binary file for client |
| 64 | @go build -i -v -o $(CLIENT_OUT) $(CLIENT_PKG_BUILD) |
| 65 | |
| 66 | clean: ## Remove previous builds |
| 67 | @rm $(SERVER_OUT) $(CLIENT_OUT) $(API_OUT) $(API_REST_OUT) $(SWAGGER_OUT) |
donNewtonAlpha | b9b85eb | 2018-08-14 14:28:22 -0400 | [diff] [blame] | 68 | @rm -rf seba-api |
| 69 | |
| 70 | test: all |
| 71 | @go test ./... |
| 72 | @go test ./... -cover |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 73 | |
| 74 | help: ## Display this help screen |
| 75 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |