@@ -33,11 +33,11 @@ export GO111MODULE=on
3333# Directories.
3434ROOT_DIR: =$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST ) ) ) )
3535TOOLS_DIR := hack/tools
36- TOOLS_BIN_DIR := $(TOOLS_DIR ) /bin
36+ TOOLS_BIN_DIR := $(abspath $( TOOLS_DIR ) /bin)
3737TEMPLATES_DIR := $(ROOT_DIR ) /templates
38- BIN_DIR := bin
39- RELEASE_NOTES_BIN := bin/release-notes
38+ BIN_DIR := $(abspath $(ROOT_DIR ) /bin)
4039EXP_DIR := exp
40+ GO_INSTALL = ./scripts/go_install.sh
4141
4242# Binaries.
4343CLUSTERCTL := $(BIN_DIR ) /clusterctl
@@ -48,9 +48,9 @@ ETCD=$(TOOLS_BIN_DIR)/etcd
4848GOLANGCI_LINT := $(TOOLS_BIN_DIR ) /golangci-lint
4949KUBE_APISERVER =$(TOOLS_BIN_DIR ) /kube-apiserver
5050KUBECTL =$(TOOLS_BIN_DIR ) /kubectl
51- KUSTOMIZE := $(abspath $( TOOLS_BIN_DIR ) /kustomize)
51+ KUSTOMIZE := $(TOOLS_BIN_DIR ) /kustomize
5252MOCKGEN := $(TOOLS_BIN_DIR ) /mockgen
53- RELEASE_NOTES := $(TOOLS_DIR ) / $( RELEASE_NOTES_BIN )
53+ RELEASE_NOTES := $(TOOLS_BIN_DIR ) /release-notes
5454EXP_DIR := exp
5555
5656# Define Docker related variables. Releases should modify and double check these vars.
@@ -86,9 +86,9 @@ help: ## Display this help
8686# # Testing
8787# # --------------------------------------
8888
89- test : export TEST_ASSET_KUBECTL = $(ROOT_DIR ) / $( KUBECTL )
90- test : export TEST_ASSET_KUBE_APISERVER = $(ROOT_DIR ) / $( KUBE_APISERVER )
91- test : export TEST_ASSET_ETCD = $(ROOT_DIR ) / $( ETCD )
89+ test : export TEST_ASSET_KUBECTL = $(KUBECTL )
90+ test : export TEST_ASSET_KUBE_APISERVER = $(KUBE_APISERVER )
91+ test : export TEST_ASSET_ETCD = $(ETCD )
9292
9393.PHONY : test
9494test : $(KUBECTL ) $(KUBE_APISERVER ) $(ETCD ) generate lint # # Run tests
@@ -123,29 +123,30 @@ manager: ## Build manager binary.
123123# # Tooling Binaries
124124# # --------------------------------------
125125
126- $(CLUSTERCTL ) : go.mod # # Build clusterctl binary.
127- go build -o $(BIN_DIR ) /clusterctl sigs.k8s.io/cluster-api/cmd/clusterctl
126+ $(CLUSTERCTL ) : # # Build clusterctl binary.
127+ GOBIN= $(BIN_DIR ) $( GO_INSTALL ) sigs.k8s.io/cluster-api/cmd/clusterctl@v0.3.5
128128
129- $(CONTROLLER_GEN ) : $( TOOLS_DIR ) /go.mod # Build controller-gen from tools folder.
130- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen
129+ $(CONTROLLER_GEN ) : # # Build controller-gen from tools folder.
130+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.9
131131
132- $(CONVERSION_GEN ) : $( TOOLS_DIR ) /go.mod
133- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /conversion-gen k8s.io/code-generator/cmd/conversion-gen
132+ $(CONVERSION_GEN ) : # # Build conversion-gen
133+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) k8s.io/code-generator/cmd/conversion-gen@v0.18.2
134134
135- $(ENVSUBST ) : $( TOOLS_DIR ) /go.mod # Build envsubst from tools folder.
136- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /envsubst github.com/a8m/envsubst/cmd/envsubst
135+ $(ENVSUBST ) : # # Build envsubst from tools folder.
136+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) github.com/a8m/envsubst/cmd/envsubst@v1.1.0
137137
138- $(GOLANGCI_LINT ) : $( TOOLS_DIR ) /go.mod # Build golangci-lint from tools folder.
139- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
138+ $(GOLANGCI_LINT ) : # # Build golangci-lint from tools folder.
139+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) github.com/golangci/golangci-lint/cmd/golangci-lint@v1.27.0
140140
141- $(KUSTOMIZE ) : $( TOOLS_DIR ) /go.mod # Build kustomize from tools folder.
142- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /kustomize sigs.k8s.io/kustomize/kustomize/v3
141+ $(KUSTOMIZE ) : # # Build kustomize from tools folder.
142+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) sigs.k8s.io/kustomize/kustomize/v3@v3.5.4
143143
144- $(MOCKGEN ) : $( TOOLS_DIR ) /go.mod # Build mockgen from tools folder.
145- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /mockgen github.com/golang/mock/mockgen
144+ $(MOCKGEN ) : # # Build mockgen from tools folder.
145+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) github.com/golang/mock/mockgen@v1.4.3
146146
147- $(RELEASE_NOTES ) : $(TOOLS_DIR ) /go.mod
148- cd $(TOOLS_DIR ) && go build -tags tools -o $(BIN_DIR ) /release-notes sigs.k8s.io/cluster-api/hack/tools/release
147+ $(RELEASE_NOTES ) : # # Build release notes
148+ GOBIN=$(TOOLS_BIN_DIR ) $(GO_INSTALL ) sigs.k8s.io/cluster-api/hack/tools/release
149+ mv $(TOOLS_BIN_DIR ) /release $(RELEASE_NOTES )
149150
150151# # --------------------------------------
151152# # Linting
0 commit comments