Skip to content

Commit 7a3960e

Browse files
committed
Fix all BIN_DIR dependencies in hack/tools
plantuml was missing a $(BIN_DIR) dependency entirely, and most of the rest needed to be converted to order-only prerequisites.
1 parent a1be292 commit 7a3960e

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

hack/tools/Makefile

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ifeq ($(OS), linux)
3737
GTAR := tar
3838
endif
3939

40-
MDBOOK_EXTRACT_COMMAND := tar xfvz $(SHARE_DIR)/mdbook.tar.gz -C bin
40+
MDBOOK_EXTRACT_COMMAND := tar xfvz $(SHARE_DIR)/mdbook.tar.gz -C $(BIN_DIR)
4141
MDBOOK_ARCHIVE_EXT := .tar.gz
4242

4343
ifeq ($(OS), windows)
@@ -62,19 +62,19 @@ $(GTAR):
6262

6363

6464
CONTROLLER_GEN := $(BIN_DIR)/controller-gen
65-
$(CONTROLLER_GEN): $(BIN_DIR) go.mod go.sum # Build controller-gen from tools folder.
65+
$(CONTROLLER_GEN): go.mod go.sum | $(BIN_DIR) # Build controller-gen from tools folder.
6666
go build -tags=tools -o $@ sigs.k8s.io/controller-tools/cmd/controller-gen
6767

6868
CONVERSION_GEN := $(BIN_DIR)/conversion-gen
69-
$(CONVERSION_GEN): $(BIN_DIR) go.mod go.sum
69+
$(CONVERSION_GEN): go.mod go.sum | $(BIN_DIR)
7070
go build -tags=tools -o $@ k8s.io/code-generator/cmd/conversion-gen
7171

7272
DEFAULTER_GEN := $(BIN_DIR)/defaulter-gen
73-
$(DEFAULTER_GEN): $(BIN_DIR) go.mod go.sum
73+
$(DEFAULTER_GEN): go.mod go.sum | $(BIN_DIR)
7474
go build -tags=tools -o $@ k8s.io/code-generator/cmd/defaulter-gen
7575

7676
ENVSUBST := $(BIN_DIR)/envsubst
77-
$(ENVSUBST): $(BIN_DIR) go.mod go.sum # Build envsubst from tools folder.
77+
$(ENVSUBST): go.mod go.sum | $(BIN_DIR) # Build envsubst from tools folder.
7878
go build -tags=tools -o $@ github.com/a8m/envsubst/cmd/envsubst
7979

8080
GH_SHARE := $(SHARE_DIR)/gh
@@ -86,63 +86,63 @@ $(GH_SHARE)/gh.tar.gz: $(GH_SHARE)
8686
curl -L "https://github.com/cli/cli/releases/download/v$(GH_VERSION)/gh_$(GH_VERSION)_$(GH_ARCH_SUFFIX).tar.gz" -o $@
8787

8888
GH := $(BIN_DIR)/gh
89-
GH: $(GTAR) $(GH_SHARE)/gh.tar.gz
90-
$(GTAR) -xvf share/gh/gh.tar.gz gh_$(GH_VERSION)_$(GH_ARCH_SUFFIX)/bin/gh --strip-components 1 --directory $(BIN_DIR)
89+
$(GH): $(GTAR) $(GH_SHARE)/gh.tar.gz | $(BIN_DIR)
90+
$(GTAR) -xvf $(SHARE_DIR)/gh/gh.tar.gz gh_$(GH_VERSION)_$(GH_ARCH_SUFFIX)/bin/gh --strip-components 1 --directory $(BIN_DIR)
9191
chmod +x $@
9292
touch -m $@
9393

9494
GINKGO := $(BIN_DIR)/ginkgo
95-
$(GINKGO): $(BIN_DIR) go.mod go.sum
95+
$(GINKGO): go.mod go.sum | $(BIN_DIR)
9696
go build -tags=tools -o $@ github.com/onsi/ginkgo/v2/ginkgo
9797

9898
GOJQ := $(BIN_DIR)/gojq
99-
$(GOJQ): $(BIN_DIR) go.mod go.sum
99+
$(GOJQ): go.mod go.sum | $(BIN_DIR)
100100
go build -tags=tools -o $@ github.com/itchyny/gojq/cmd/gojq
101101

102102
GOLANGCI_LINT := $(BIN_DIR)/golangci-lint
103103
$(GOLANGCI_LINT): Makefile ensure-golangci-lint.sh | $(BIN_DIR)
104104
./ensure-golangci-lint.sh -b $(BIN_DIR) $(GOLANGCI_LINT_VERSION)
105105

106106
KUSTOMIZE := $(BIN_DIR)/kustomize
107-
$(KUSTOMIZE): $(BIN_DIR) go.mod go.sum # Build kustomize from tools folder.
107+
$(KUSTOMIZE): go.mod go.sum | $(BIN_DIR) # Build kustomize from tools folder.
108108
CGO_ENABLED=0 go build -tags=tools -o $@ sigs.k8s.io/kustomize/kustomize/v4
109109

110110
MDBOOK_SHARE := $(SHARE_DIR)/mdbook$(MDBOOK_ARCHIVE_EXT)
111111
$(MDBOOK_SHARE): ../../versions.mk $(SHARE_DIR)
112112
curl -sL -o $(MDBOOK_SHARE) "https://github.com/rust-lang/mdBook/releases/download/$(MDBOOK_VERSION)/mdBook-$(MDBOOK_VERSION)-x86_64-$(RUST_TARGET)$(MDBOOK_ARCHIVE_EXT)"
113113

114114
MDBOOK := $(BIN_DIR)/mdbook
115-
$(MDBOOK): $(BIN_DIR) $(MDBOOK_SHARE)
115+
$(MDBOOK): $(MDBOOK_SHARE) | $(BIN_DIR)
116116
$(MDBOOK_EXTRACT_COMMAND)
117117
chmod +x $@
118118
touch -m $@
119119

120120
MDBOOK_EMBED := $(BIN_DIR)/mdbook-embed
121-
$(MDBOOK_EMBED): $(BIN_DIR) go.mod go.sum
121+
$(MDBOOK_EMBED): go.mod go.sum | $(BIN_DIR)
122122
go build -tags=tools -o $(BIN_DIR)/mdbook-embed sigs.k8s.io/cluster-api/hack/tools/mdbook/embed
123123

124124
MDBOOK_RELEASELINK := $(BIN_DIR)/mdbook-releaselink
125-
$(MDBOOK_RELEASELINK): $(BIN_DIR) go.mod go.sum
125+
$(MDBOOK_RELEASELINK): go.mod go.sum | $(BIN_DIR)
126126
go build -tags=tools -o $(BIN_DIR)/mdbook-releaselink sigs.k8s.io/cluster-api/hack/tools/mdbook/releaselink
127127

128128
MDBOOK_TABULATE := $(BIN_DIR)/mdbook-tabulate
129-
$(MDBOOK_TABULATE): $(BIN_DIR) go.mod go.sum
129+
$(MDBOOK_TABULATE): go.mod go.sum | $(BIN_DIR)
130130
go build -tags=tools -o $(BIN_DIR)/mdbook-tabulate sigs.k8s.io/cluster-api/hack/tools/mdbook/tabulate
131131

132132
MOCKGEN := $(BIN_DIR)/mockgen
133-
$(MOCKGEN): $(BIN_DIR) go.mod go.sum # Build mockgen from tools folder.
133+
$(MOCKGEN): go.mod go.sum | $(BIN_DIR) # Build mockgen from tools folder.
134134
go build -tags=tools -o $@ github.com/golang/mock/mockgen
135135

136136
RELEASE_NOTES := $(BIN_DIR)/release-notes
137-
$(RELEASE_NOTES): $(BIN_DIR) go.mod go.sum
137+
$(RELEASE_NOTES): go.mod go.sum | $(BIN_DIR)
138138
go build -tags tools -o $@ sigs.k8s.io/cluster-api/hack/tools/release
139139

140140
PLANTUML := $(BIN_DIR)/plantuml-sentinal
141-
$(PLANTUML): plantuml.Dockerfile ../../versions.mk
141+
$(PLANTUML): plantuml.Dockerfile ../../versions.mk | $(BIN_DIR)
142142
docker build --build-arg PLANTUML_VERSION=$(PLANTUML_VERSION) . -f plantuml.Dockerfile -t "plantuml-builder"
143143
touch $@
144144

145145
.PHONY: clean
146146
clean: ## Remove all tools
147-
rm -rf bin
148-
rm -rf share
147+
rm -rf $(BIN_DIR)
148+
rm -rf $(SHARE_DIR)

0 commit comments

Comments
 (0)