blob: 2c3bf1eaed4ad2eaf1ea701d173fef14e1a451a5 [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"
17
18.PHONY: dep test clean docker
19
Keita NISHIMOTO3b8b9c02018-10-09 09:40:01 +090020bbsim: protos/openolt.pb.go dep
Zack Williams86f87202018-10-05 10:36:32 -070021 go build -i -v -o $@
22
Keita NISHIMOTO3b8b9c02018-10-09 09:40:01 +090023dep: protos/openolt.pb.go
Keita NISHIMOTOca4da5f2018-10-15 22:48:52 +090024 go get -v -d ./...
Zack Williams86f87202018-10-05 10:36:32 -070025
Keita NISHIMOTO3b8b9c02018-10-09 09:40:01 +090026protos/openolt.pb.go: openolt.proto
Zack Williams86f87202018-10-05 10:36:32 -070027 @protoc -I . \
28 -I${GOPATH}/src \
29 -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
Keita NISHIMOTO3b8b9c02018-10-09 09:40:01 +090030 --go_out=plugins=grpc:protos/ \
Keita NISHIMOTOca4da5f2018-10-15 22:48:52 +090031 $<
Zack Williams86f87202018-10-05 10:36:32 -070032
33test:
Keita NISHIMOTOca4da5f2018-10-15 22:48:52 +090034 go test -v ./...
35 go test -v ./... -cover
36
37fmt:
38 go fmt ./...
39
40vet:
41 go vet ./...
42
43lint:
44 gometalinter --vendor --exclude ../../golang.org --skip protos --sort path --sort line ./...
Zack Williams86f87202018-10-05 10:36:32 -070045
46clean:
Keita NISHIMOTOca4da5f2018-10-15 22:48:52 +090047 rm -f bbsim openolt/openolt.pb.go
Zack Williams86f87202018-10-05 10:36:32 -070048
49docker:
Keita NISHIMOTOca4da5f2018-10-15 22:48:52 +090050 docker build -t voltha/voltha-bbsim:${DOCKERTAG} .