This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
111 lines (85 loc) · 2.68 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#------------------------------------------------
#
# setup environment
#
#------------------------------------------------
export GOPATH:=$(realpath $(shell pwd)/../../../..)
#------------------------------------------------
#
# standard rules
#
#------------------------------------------------
# The first target defined is the default if no target is
# specified on the command line. Make sure this doesn't
# take too long to run, so that people will run it on every
# build.
.PHONY: fast
fast: build coverage-short lint-fast
# Also define the "full fat" rule that does everything
.PHONY: all build
all: build coverage lint-full
#
# See https://gopkg.in/make.v4 for a list of
# versions and http://gopkg.in for more info.
#
GOMAKE:=gopkg.in/make.v4
-include $(GOPATH)/src/$(GOMAKE)/batteries.mk
-include $(GOPATH)/src/$(GOMAKE)/pkg/proto/protobuf-gogo.mk
-include $(GOPATH)/src/$(GOMAKE)/pkg/proto/protobuf-cs.mk
-include $(GOPATH)/src/$(GOMAKE)/pkg/proto/protobuf-py.mk
$(GOPATH)/src/$(GOMAKE)/%:
go get $(GOMAKE)/...
#------------------------------------------------
#
# now to actually build stuff...
#
#------------------------------------------------
# first some protobuf definitions
PROTO_FILES:=\
helloworld/helloworld.proto
GENERATED_GRPC_GO:=$(PROTO_FILES:.proto=.pb.go)
GENERATED_GRPC_CS:=$(PROTO_FILES:.proto=.pb.cs)
GENERATED_GRPC_PY:=$(PROTO_FILES:.proto=_pb2.py)
GENERATED_GRPC:=\
$(GENERATED_GRPC_GO) \
$(GENERATED_GRPC_CS) \
$(GENERATED_GRPC_PY)
# uncomment the following lines to use gogo-proto - see https://github.com/gogo/protobuf
#
# $(GENERATED_GRPC_GO): $(PROTOC_GEN_GOFAST)
# $(GENERATED_GRPC_GO): PROTOC_GO_OUT=--gofast_out=$(PROTOC_PARAMS):$(dir $@)
$(GENERATED_GRPC_PY): $(GRPC_PYTHON_TOOLS)
$(GENERATED_GRPC_CS): $(GRPC_CSHARP_PLUGIN)
clobber::
rm -f $(GENERATED_GRPC)
# then the binaries
BASENAME_BINARY:=\
example-multi
BUILD_BINARIES:=\
$(BASENAME_BINARY).exe \
$(BASENAME_BINARY).mac \
$(BASENAME_BINARY).linux
build: $(BUILD_BINARIES) docker-build
%.exe: GOOS=windows
%.mac: GOOS=darwin
%.linux: GOOS=linux
.PHONY: $(BUILD_BINARIES)
$(BUILD_BINARIES): vendor $(GENERATED_GRPC) $(CMD_LINKFLAGS)
$(call PROMPT,Building $@)
GOOS=$(GOOS) CGO_ENABLED=0 $(GO) build -o $@
clean::
rm -f $(BUILD_BINARIES)
#------------------------------------------------
#
# docker support
#
#------------------------------------------------
# the dockerfile needs some stuff build/downloaded before the image is built
docker-build: ca-bundle.crt $(BASENAME_BINARY).linux
clobber::
rm -f ca-bundle.crt
DOCKER_ORGANISATION:=go-make
GOMAKE_DOCKER:=gopkg.in/go-make/docker.v0
-include $(GOPATH)/src/$(GOMAKE_DOCKER)/Makefile
$(GOPATH)/src/$(GOMAKE_DOCKER)/%:
go get $(GOMAKE_DOCKER)/...