blob: 591f6bb5c8790d0ca080553d19701804eeb302e6 [file] [log] [blame]
Author Namea594e632018-08-10 11:33:58 -04001#
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
17SERVER_OUT := "bin/AbstractOLT"
18CLIENT_OUT := "bin/client"
19API_OUT := "api/abstract_olt_api.pb.go"
20API_REST_OUT := "api/abstract_olt_api.pb.gw.go"
21SWAGGER_OUT := "api/abstract_olt_api.swagger.json"
22PKG := "gerrit.opencord.org/abstract-olt"
23SERVER_PKG_BUILD := "${PKG}/cmd/AbstractOLT"
24CLIENT_PKG_BUILD := "${PKG}/client"
25PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
26
27
28.PHONY: all api server client
29
30all: server client
31
32api/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
39api/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
donNewtonAlphab9b85eb2018-08-14 14:28:22 -040046api/xos.go:
47
Author Namea594e632018-08-10 11:33:58 -040048swagger:
donNewtonAlphab9b85eb2018-08-14 14:28:22 -040049 @protoc -I api/ \
Author Namea594e632018-08-10 11:33:58 -040050 -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
55api: api/abstract_olt_api.pb.go api/abstract_olt_api.pb.gw.go swagger
56
57dep: ## Get the dependencies
58 @go get -v -d ./...
59
60server: dep api ## Build the binary file for server
61 @go build -i -v -o $(SERVER_OUT) $(SERVER_PKG_BUILD)
62
63client: dep api ## Build the binary file for client
64 @go build -i -v -o $(CLIENT_OUT) $(CLIENT_PKG_BUILD)
65
66clean: ## Remove previous builds
67 @rm $(SERVER_OUT) $(CLIENT_OUT) $(API_OUT) $(API_REST_OUT) $(SWAGGER_OUT)
donNewtonAlphab9b85eb2018-08-14 14:28:22 -040068 @rm -rf seba-api
69
70test: all
71 @go test ./...
72 @go test ./... -cover
Author Namea594e632018-08-10 11:33:58 -040073
74help: ## 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}'