blob: b470f165481eefafce6719fd938d9d2d1b4074d1 [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/)
Zack Williams34cd8f92018-09-14 16:04:19 -070026DOCKERTAG ?= "latest"
Author Namea594e632018-08-10 11:33:58 -040027
Zack Williams34cd8f92018-09-14 16:04:19 -070028.PHONY: all api server client test docker
Author Namea594e632018-08-10 11:33:58 -040029
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
donNewtonAlpha5234b132018-08-16 14:12:28 -040046api/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
donNewtonAlphab9b85eb2018-08-14 14:28:22 -040055
Author Namea594e632018-08-10 11:33:58 -040056swagger:
donNewtonAlphab9b85eb2018-08-14 14:28:22 -040057 @protoc -I api/ \
Author Namea594e632018-08-10 11:33:58 -040058 -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
63api: api/abstract_olt_api.pb.go api/abstract_olt_api.pb.gw.go swagger
64
65dep: ## Get the dependencies
66 @go get -v -d ./...
67
68server: dep api ## Build the binary file for server
69 @go build -i -v -o $(SERVER_OUT) $(SERVER_PKG_BUILD)
70
71client: dep api ## Build the binary file for client
72 @go build -i -v -o $(CLIENT_OUT) $(CLIENT_PKG_BUILD)
73
74clean: ## Remove previous builds
75 @rm $(SERVER_OUT) $(CLIENT_OUT) $(API_OUT) $(API_REST_OUT) $(SWAGGER_OUT)
donNewtonAlphab9b85eb2018-08-14 14:28:22 -040076 @rm -rf seba-api
77
78test: all
79 @go test ./...
80 @go test ./... -cover
Author Namea594e632018-08-10 11:33:58 -040081
Zack Williams34cd8f92018-09-14 16:04:19 -070082docker: ## build docker image
83 @docker build -t opencord/abstract-olt:${DOCKERTAG} .
84
Author Namea594e632018-08-10 11:33:58 -040085help: ## 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}'