forked from istio/old_mixer_repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (53 loc) · 2.06 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## Copyright 2016 Google Inc.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
# Primary build targets
build: inst build_api build_server
clean: clean_api clean_server
test: test_server
## API Targets
PROTOC = build/protoc.$(shell uname)
PROTO_OUTDIR_GO = api/v1/go
PROTO_OUTDIR_CPP = api/v1/cpp
PROTO_SRC = api/v1/service.proto api/v1/check.proto api/v1/report.proto api/v1/quota.proto
$(PROTO_OUTDIR_GO)/%.pb.go $(PROTO_OUTDIR_CPP)/%.pb.cc: api/v1/%.proto
@echo "Building protos"
@mkdir -p $(PROTO_OUTDIR_GO) $(PROTO_OUTDIR_CPP)
@$(PROTOC) --proto_path=api/v1 --proto_path=vendor/github.com/googleapis/googleapis --proto_path=vendor/github.com/google/protobuf/src --cpp_out=$(PROTO_OUTDIR_CPP) --go_out=plugins=grpc:$(PROTO_OUTDIR_GO) $(PROTO_SRC)
build_api: $(PROTO_OUTDIR_GO)/service.pb.go
clean_api:
@rm -fr $(PROTO_OUTDIR_GO) $(PROTO_OUTDIR_CPP)
## Server targets
GO_SRC = server/*.go adapters/*.go adapters/*/*.go
mixer.bin: $(GO_SRC) $(PROTO_SRC)
@echo "Building server"
@go build -o mixer.bin server/*.go
build_server: mixer.bin
@go tool vet -shadowstrict server adapters
@golint -set_exit_status server/...
@golint -set_exit_status adapters/...
@gofmt -w -s $(GO_SRC)
clean_server:
@rm -f mixer.bin
test_server: build_server
@echo "Running tests"
@go test -race -cpu 1,4 ./server/... ./adapters/...
## Misc targets
GLIDE = build/glide.$(shell uname)
inst:
@echo "Prepping dependencies"
@$(GLIDE) -q install
@ if ! which protoc-gen-go > /dev/null; then \
echo "error: protoc-gen-go not installed" >&2;\
go get github.com/golang/protobuf/protoc-gen-go;\
fi