blob: b41c5d9e64ae2cbe9c03b49336eb777361bfd2aa [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
46swagger:
47 protoc -I api/ \
48 -I${GOPATH}/src \
49 -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
50 --swagger_out=logtostderr=true:api \
51 api/abstract_olt_api.proto
52
53api: api/abstract_olt_api.pb.go api/abstract_olt_api.pb.gw.go swagger
54
55dep: ## Get the dependencies
56 @go get -v -d ./...
57
58server: dep api ## Build the binary file for server
59 @go build -i -v -o $(SERVER_OUT) $(SERVER_PKG_BUILD)
60
61client: dep api ## Build the binary file for client
62 @go build -i -v -o $(CLIENT_OUT) $(CLIENT_PKG_BUILD)
63
64clean: ## Remove previous builds
65 @rm $(SERVER_OUT) $(CLIENT_OUT) $(API_OUT) $(API_REST_OUT) $(SWAGGER_OUT)
66
67help: ## Display this help screen
68 @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'