11all : build
22
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-
233# #######################################################################
244# # PROTOC ##
255# #######################################################################
@@ -46,28 +26,14 @@ PROTOC_URL := https://github.com/protocolbuffers/protobuf/releases/download/v$(P
4626PROTOC_TMP_DIR := .protoc
4727PROTOC := $(PROTOC_TMP_DIR ) /bin/protoc
4828
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-
5429$(PROTOC ) :
5530 -mkdir -p " $( PROTOC_TMP_DIR) " && \
5631 curl -L $(PROTOC_URL ) -o " $( PROTOC_TMP_DIR) /$( PROTOC_ZIP) " && \
5732 unzip " $( PROTOC_TMP_DIR) /$( PROTOC_ZIP) " -d " $( PROTOC_TMP_DIR) " && \
5833 chmod 0755 " $@ "
5934 stat " $@ " > /dev/null 2>&1
6035
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 )
7137
7238# #######################################################################
7339# # BUILD ##
@@ -78,9 +44,10 @@ CSI_GO := $(CSI_PKG_SUB)/csi.pb.go
7844CSI_GRPC := $(CSI_PKG_SUB ) /csi_grpc.pb.go
7945
8046# 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
8248 @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 ) \
8451 --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative \
8552 " $( < F) "
8653
0 commit comments