@@ -75,6 +75,7 @@ GOARCH ?= amd64
75
75
76
76
# Build directories.
77
77
ROOT_DIR = $(shell pwd)
78
+ REPO_ROOT = $(shell git rev-parse --show-toplevel)
78
79
CNM_DIR = cnm/plugin
79
80
CNI_NET_DIR = cni/network/plugin
80
81
CNI_IPAM_DIR = cni/ipam/plugin
@@ -98,6 +99,8 @@ CNS_BUILD_DIR = $(BUILD_DIR)/cns
98
99
CNMS_BUILD_DIR = $(BUILD_DIR ) /cnms
99
100
NPM_BUILD_DIR = $(BUILD_DIR ) /npm
100
101
NPM_TELEMETRY_DIR = $(NPM_BUILD_DIR ) /telemetry
102
+ TOOLS_DIR = $(REPO_ROOT ) /build/tools
103
+ TOOLS_BIN_DIR = $(TOOLS_DIR ) /bin
101
104
CNI_AI_ID = 5515a1eb-b2bc-406a-98eb-ba462e6f0411
102
105
NPM_AI_ID = 014c22bd-4107-459e-8475-67909e96edcb
103
106
ACN_PACKAGE_PATH = github.com/Azure/azure-container-networking
@@ -195,6 +198,7 @@ endif
195
198
.PHONY : clean
196
199
clean :
197
200
rm -rf $(OUTPUT_DIR )
201
+ rm -rf $(TOOLS_BIN_DIR )
198
202
199
203
# Build the Azure CNM plugin.
200
204
$(CNM_BUILD_DIR ) /azure-vnet-plugin$(EXE_EXT ) : $(CNMFILES )
@@ -471,4 +475,12 @@ test-cyclonus:
471
475
.PHONY : kind
472
476
kind :
473
477
kind create cluster --config ./test/kind/kind.yaml
474
-
478
+
479
+ $(TOOLS_DIR ) /go.mod :
480
+ cd $(TOOLS_DIR ) ; go mod init && go mod tidy
481
+
482
+ CONTROLLER_GEN := $(TOOLS_BIN_DIR ) /controller-gen
483
+ $(CONTROLLER_GEN ) : $(TOOLS_DIR ) /go.mod # Build controller-gen
484
+ cd $(TOOLS_DIR ) ; go mod download; go build -tags=tools -o bin/controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen
485
+
486
+ controller-gen : $(CONTROLLER_GEN )
0 commit comments