@@ -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.
@@ -85,9 +85,9 @@ help: ## Display this help
8585# # Testing
8686# # --------------------------------------
8787
88- test : export TEST_ASSET_KUBECTL = $(ROOT_DIR ) / $( KUBECTL )
89- test : export TEST_ASSET_KUBE_APISERVER = $(ROOT_DIR ) / $( KUBE_APISERVER )
90- test : export TEST_ASSET_ETCD = $(ROOT_DIR ) / $( ETCD )
88+ test : export TEST_ASSET_KUBECTL = $(KUBECTL )
89+ test : export TEST_ASSET_KUBE_APISERVER = $(KUBE_APISERVER )
90+ test : export TEST_ASSET_ETCD = $(ETCD )
9191
9292.PHONY : test
9393test : $(KUBECTL ) $(KUBE_APISERVER ) $(ETCD ) generate lint # # Run tests
@@ -122,29 +122,30 @@ manager: ## Build manager binary.
122122# # Tooling Binaries
123123# # --------------------------------------
124124
125- $(CLUSTERCTL ) : go.mod # # Build clusterctl binary.
126- go build -o $(BIN_DIR ) /clusterctl sigs.k8s.io/cluster-api/cmd/clusterctl
125+ $(CLUSTERCTL ) : # # Build clusterctl binary.
126+ GOBIN= $(BIN_DIR ) $( GO_INSTALL ) sigs.k8s.io/cluster-api/cmd/clusterctl@v0.3.5
127127
128- $(CONTROLLER_GEN ) : $( TOOLS_DIR ) /go.mod # Build controller-gen from tools folder.
129- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen
128+ $(CONTROLLER_GEN ) : # # Build controller-gen from tools folder.
129+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.9
130130
131- $(CONVERSION_GEN ) : $( TOOLS_DIR ) /go.mod
132- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /conversion-gen k8s.io/code-generator/cmd/conversion-gen
131+ $(CONVERSION_GEN ) : # # Build conversion-gen
132+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) k8s.io/code-generator/cmd/conversion-gen@v0.18.2
133133
134- $(ENVSUBST ) : $( TOOLS_DIR ) /go.mod # Build envsubst from tools folder.
135- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /envsubst github.com/a8m/envsubst/cmd/envsubst
134+ $(ENVSUBST ) : # # Build envsubst from tools folder.
135+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) github.com/a8m/envsubst/cmd/envsubst@v1.1.0
136136
137- $(GOLANGCI_LINT ) : $( TOOLS_DIR ) /go.mod # Build golangci-lint from tools folder.
138- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
137+ $(GOLANGCI_LINT ) : # # Build golangci-lint from tools folder.
138+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) github.com/golangci/golangci-lint/cmd/golangci-lint@v1.27.0
139139
140- $(KUSTOMIZE ) : $( TOOLS_DIR ) /go.mod # Build kustomize from tools folder.
141- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /kustomize sigs.k8s.io/kustomize/kustomize/v3
140+ $(KUSTOMIZE ) : # # Build kustomize from tools folder.
141+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) sigs.k8s.io/kustomize/kustomize/v3@v3.5.4
142142
143- $(MOCKGEN ) : $( TOOLS_DIR ) /go.mod # Build mockgen from tools folder.
144- cd $( TOOLS_DIR ) ; go build -tags=tools -o $( BIN_DIR ) /mockgen github.com/golang/mock/mockgen
143+ $(MOCKGEN ) : # # Build mockgen from tools folder.
144+ GOBIN= $( TOOLS_BIN_DIR ) $( GO_INSTALL ) github.com/golang/mock/mockgen@v1.4.3
145145
146- $(RELEASE_NOTES ) : $(TOOLS_DIR ) /go.mod
147- cd $(TOOLS_DIR ) && go build -tags tools -o $(BIN_DIR ) /release-notes sigs.k8s.io/cluster-api/hack/tools/release
146+ $(RELEASE_NOTES ) : # # Build release notes
147+ GOBIN=$(TOOLS_BIN_DIR ) $(GO_INSTALL ) sigs.k8s.io/cluster-api/hack/tools/release
148+ mv $(TOOLS_BIN_DIR ) /release $(RELEASE_NOTES )
148149
149150# # --------------------------------------
150151# # Linting
0 commit comments