1
1
all : build
2
2
3
- # #######################################################################
4
- # # GOLANG ##
5
- # #######################################################################
6
-
7
- # If GOPATH isn't defined then set its default location.
8
- ifeq (,$(strip $(GOPATH ) ) )
9
- GOPATH := $(HOME ) /go
10
- else
11
- # If GOPATH is already set then update GOPATH to be its own
12
- # first element.
13
- GOPATH := $(word 1,$(subst :, ,$(GOPATH ) ) )
14
- endif
15
- export GOPATH
16
-
17
- GOBIN := $(shell go env GOBIN)
18
- ifeq (,$(strip $(GOBIN ) ) )
19
- GOBIN := $(GOPATH ) /bin
20
- endif
21
-
22
-
23
3
# #######################################################################
24
4
# # PROTOC ##
25
5
# #######################################################################
@@ -46,28 +26,14 @@ PROTOC_URL := https://github.com/protocolbuffers/protobuf/releases/download/v$(P
46
26
PROTOC_TMP_DIR := .protoc
47
27
PROTOC := $(PROTOC_TMP_DIR ) /bin/protoc
48
28
49
- $(GOBIN ) /protoc-gen-go : ../../go.mod
50
- go install google.golang.org/protobuf/cmd/protoc-gen-go
51
- $(GOBIN ) /protoc-gen-go-grpc :
52
- go install google.golang.org/grpc/cmd/
[email protected]
53
-
54
29
$(PROTOC ) :
55
30
-mkdir -p " $( PROTOC_TMP_DIR) " && \
56
31
curl -L $(PROTOC_URL ) -o " $( PROTOC_TMP_DIR) /$( PROTOC_ZIP) " && \
57
32
unzip " $( PROTOC_TMP_DIR) /$( PROTOC_ZIP) " -d " $( PROTOC_TMP_DIR) " && \
58
33
chmod 0755 " $@ "
59
34
stat " $@ " > /dev/null 2>&1
60
35
61
- PROTOC_ALL := $(GOBIN ) /protoc-gen-go $(GOBIN ) /protoc-gen-go-grpc $(PROTOC )
62
-
63
- # #######################################################################
64
- # # PATH ##
65
- # #######################################################################
66
-
67
- # Update PATH with GOBIN. This enables the protoc binary to discover
68
- # the protoc-gen-go binary
69
- export PATH := $(GOBIN ) :$(PATH )
70
-
36
+ PROTOC_ALL := protoc-gen-go protoc-gen-go-grpc $(PROTOC )
71
37
72
38
# #######################################################################
73
39
# # BUILD ##
@@ -78,9 +44,10 @@ CSI_GO := $(CSI_PKG_SUB)/csi.pb.go
78
44
CSI_GRPC := $(CSI_PKG_SUB ) /csi_grpc.pb.go
79
45
80
46
# This recipe generates the go language bindings
81
- $(CSI_GO ) $(CSI_GRPC ) : $(CSI_PROTO ) $(PROTOC_ALL )
47
+ $(CSI_GO ) $(CSI_GRPC ) : $(CSI_PROTO ) $(PROTOC_ALL ) ../../go.mod
82
48
@mkdir -p " $( @D) "
83
- $(PROTOC ) -I../.. --go-grpc_out=$(CSI_PKG_SUB ) --go_out=$(CSI_PKG_SUB ) \
49
+ $(PROTOC ) --plugin=./protoc-gen-go --plugin=./protoc-gen-go-grpc \
50
+ -I../.. --go-grpc_out=$(CSI_PKG_SUB ) --go_out=$(CSI_PKG_SUB ) \
84
51
--go_opt=paths=source_relative --go-grpc_opt=paths=source_relative \
85
52
" $( < F) "
86
53
0 commit comments