blob: d73ab70ac73af1eba8e0e060f849b243f9cfd656 [file] [log] [blame]
Zack Williams86f87202018-10-05 10:36:32 -07001# Copyright 2018-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15BBSIM_DEPS = $(wildcard ./*.go)
16DOCKERTAG ?= "latest"
Matteo Scandolo88e91892018-11-06 16:29:19 -080017REGISTRY ?= ""
Zack Williams86f87202018-10-05 10:36:32 -070018
19.PHONY: dep test clean docker
20
Shad Ansari573dfb82018-11-12 21:51:00 -080021prereq:
22 go get -u google.golang.org/grpc
23 go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
24 go get -v github.com/golang/protobuf/protoc-gen-go
25 go get -v github.com/google/gopacket
Shad Ansarib744bf22019-01-17 11:36:46 -080026 go get -v github.com/opencord/omci-sim
Shad Ansari573dfb82018-11-12 21:51:00 -080027
28bbsim: prereq protos/openolt.pb.go dep
Zack Williams86f87202018-10-05 10:36:32 -070029 go build -i -v -o $@
30
Keita NISHIMOTO3b8b9c02018-10-09 09:40:01 +090031dep: protos/openolt.pb.go
Keita NISHIMOTOca4da5f2018-10-15 22:48:52 +090032 go get -v -d ./...
Zack Williams86f87202018-10-05 10:36:32 -070033
Keita NISHIMOTO3b8b9c02018-10-09 09:40:01 +090034protos/openolt.pb.go: openolt.proto
Zack Williams86f87202018-10-05 10:36:32 -070035 @protoc -I . \
36 -I${GOPATH}/src \
37 -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
Keita NISHIMOTO3b8b9c02018-10-09 09:40:01 +090038 --go_out=plugins=grpc:protos/ \
Keita NISHIMOTOca4da5f2018-10-15 22:48:52 +090039 $<
Zack Williams86f87202018-10-05 10:36:32 -070040
41test:
Keita NISHIMOTOca4da5f2018-10-15 22:48:52 +090042 go test -v ./...
43 go test -v ./... -cover
44
45fmt:
46 go fmt ./...
47
48vet:
49 go vet ./...
50
51lint:
52 gometalinter --vendor --exclude ../../golang.org --skip protos --sort path --sort line ./...
Zack Williams86f87202018-10-05 10:36:32 -070053
54clean:
Keita NISHIMOTOca4da5f2018-10-15 22:48:52 +090055 rm -f bbsim openolt/openolt.pb.go
Zack Williams86f87202018-10-05 10:36:32 -070056
57docker:
Matteo Scandolo88e91892018-11-06 16:29:19 -080058 docker build -t ${REGISTRY}voltha/voltha-bbsim:${DOCKERTAG} .