-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (35 loc) · 1.2 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
# Allow user to have custom version of go.
GOBINARY ?= go
GOOS ?= linux
LDFLAGS += -w -s
# Install build dependencies.
tools-update:
$(GOBINARY) get -u github.com/golang/dep/cmd/dep/...
$(GOBINARY) get -u google.golang.org/grpc
$(GOBINARY) get -u github.com/golang/protobuf/proto
$(GOBINARY) get -u github.com/golang/protobuf/protoc-gen-go
$(GOBINARY) get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
$(GOBINARY) get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
.PHONY: tools-update
deps-update:
$(ENVVAR) GOOS=$(GOOS) dep ensure
.PHONY: deps-update
gen:
# Generate Go code for gRPC server and client
protoc \
-Iapi/protobuf-spec \
--go_out=plugins=grpc:pkg/colorer \
api/protobuf-spec/colorer.proto
# Add the following options to generate
# - Go code for JSON gRPC gateway
# - Generate Swagger spec
#-I$(GOPATH)/src
#-I$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
#--grpc-gateway_out=logtostderr=true:pkg
#--swagger_out=logtostderr=true:pkg
.PHONY: gen
build:
$(ENVVAR) GOOS=$(GOOS) $(GOBINARY) build -i -v -ldflags '$(LDFLAGS)' -o target/server cmd/server.go
.PHONY: build
all: tools-update deps-update gen build
.PHONY: all