Skip to content

Commit 806005e

Browse files
authored
Makefile cleanups (#6745)
* Makefile: help: use single shell I noticed that "make help" output takes some perceptible amount of time to appear. Improve its performance by running all the "echo" commands as part of the same shell instance, rather than forking a new shell for each line. Signed-off-by: Carlo Teubner <cteubner1@bloomberg.net> * Makefile: remove some unused helpers Signed-off-by: Carlo Teubner <cteubner1@bloomberg.net> * Makefile: declare targets .PHONY where needed Signed-off-by: Carlo Teubner <cteubner1@bloomberg.net> --------- Signed-off-by: Carlo Teubner <cteubner1@bloomberg.net>
1 parent ec6d24c commit 806005e

File tree

1 file changed

+53
-56
lines changed

1 file changed

+53
-56
lines changed

Makefile

Lines changed: 53 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -22,54 +22,54 @@ default: build
2222
all: build lint test
2323

2424
help:
25-
@echo "$(bold)Usage:$(reset) make $(cyan)<target>$(reset)"
26-
@echo
27-
@echo "$(bold)Build:$(reset)"
28-
@echo " $(cyan)build$(reset) - build all SPIRE binaries (default)"
29-
@echo
30-
@echo "$(bold)Test:$(reset)"
31-
@echo " $(cyan)test$(reset) - run unit tests"
32-
@echo " $(cyan)race-test$(reset) - run unit tests with race detection"
33-
@echo " $(cyan)integration$(reset) - run integration tests (requires Docker images)"
34-
@echo " support 'SUITES' variable for executing specific tests"
35-
@echo " and 'IGNORE_SUITES' variable for ignoring tests"
36-
@echo " e.g. SUITES='suites/join-token suites/k8s' make integration"
37-
@echo " $(cyan)integration-windows$(reset) - run integration tests for windows (requires Docker images)"
38-
@echo " support 'SUITES' variable for executing specific tests"
39-
@echo " e.g. SUITES='windows-suites/windows-workload-attestor' make integration-windows"
40-
@echo
41-
@echo "$(bold)Lint:$(reset)"
42-
@echo " $(cyan)lint$(reset) - lint the code and markdown files"
43-
@echo " $(cyan)lint-code$(reset) - lint the code"
44-
@echo " $(cyan)lint-md$(reset) - lint markdown files"
45-
@echo
46-
@echo "$(bold)Build, lint and test:$(reset)"
47-
@echo " $(cyan)all$(reset) - build all SPIRE binaries, run linters and unit tests"
48-
@echo
49-
@echo "$(bold)Docker image:$(reset)"
50-
@echo " $(cyan)images$(reset) - build all SPIRE Docker images"
51-
@echo " $(cyan)images-no-load$(reset) - build all SPIRE Docker images but don't load them into the local docker registry"
52-
@echo " $(cyan)spire-server-image$(reset) - build SPIRE server Docker image"
53-
@echo " $(cyan)spire-agent-image$(reset) - build SPIRE agent Docker image"
54-
@echo " $(cyan)oidc-discovery-provider-image$(reset) - build OIDC Discovery Provider Docker image"
55-
@echo "$(bold)Windows docker image:$(reset)"
56-
@echo " $(cyan)images-windows$(reset) - build all SPIRE Docker images for windows"
57-
@echo " $(cyan)spire-server-image-windows$(reset) - build SPIRE server Docker image for windows"
58-
@echo " $(cyan)spire-agent-image-windows$(reset) - build SPIRE agent Docker image for windows"
59-
@echo " $(cyan)oidc-discovery-provider-image-windows$(reset) - build OIDC Discovery Provider Docker image for windows"
60-
@echo "$(bold)Developer support:$(reset)"
61-
@echo " $(cyan)dev-image$(reset) - build the development Docker image"
62-
@echo " $(cyan)dev-shell$(reset) - run a shell in a development Docker container"
63-
@echo
64-
@echo "$(bold)Code generation:$(reset)"
65-
@echo " $(cyan)generate$(reset) - generate protocol buffers and plugin interface code"
66-
@echo " $(cyan)generate-check$(reset) - ensure generated code is up to date"
67-
@echo
68-
@echo "$(bold)Vulnerabilty checking:$(reset)"
69-
@echo " $(cyan)govulncheck$(reset) - run govulncheck over the whole project"
70-
@echo
71-
@echo "For verbose output set V=1"
72-
@echo " for example: $(cyan)make V=1 build$(reset)"
25+
@echo "$(bold)Usage:$(reset) make $(cyan)<target>$(reset)"; \
26+
echo; \
27+
echo "$(bold)Build:$(reset)"; \
28+
echo " $(cyan)build$(reset) - build all SPIRE binaries (default)"; \
29+
echo; \
30+
echo "$(bold)Test:$(reset)"; \
31+
echo " $(cyan)test$(reset) - run unit tests"; \
32+
echo " $(cyan)race-test$(reset) - run unit tests with race detection"; \
33+
echo " $(cyan)integration$(reset) - run integration tests (requires Docker images)"; \
34+
echo " support 'SUITES' variable for executing specific tests"; \
35+
echo " and 'IGNORE_SUITES' variable for ignoring tests"; \
36+
echo " e.g. SUITES='suites/join-token suites/k8s' make integration"; \
37+
echo " $(cyan)integration-windows$(reset) - run integration tests for windows (requires Docker images)"; \
38+
echo " support 'SUITES' variable for executing specific tests"; \
39+
echo " e.g. SUITES='windows-suites/windows-workload-attestor' make integration-windows"; \
40+
echo; \
41+
echo "$(bold)Lint:$(reset)"; \
42+
echo " $(cyan)lint$(reset) - lint the code and markdown files"; \
43+
echo " $(cyan)lint-code$(reset) - lint the code"; \
44+
echo " $(cyan)lint-md$(reset) - lint markdown files"; \
45+
echo; \
46+
echo "$(bold)Build, lint and test:$(reset)"; \
47+
echo " $(cyan)all$(reset) - build all SPIRE binaries, run linters and unit tests"; \
48+
echo; \
49+
echo "$(bold)Docker image:$(reset)"; \
50+
echo " $(cyan)images$(reset) - build all SPIRE Docker images"; \
51+
echo " $(cyan)images-no-load$(reset) - build all SPIRE Docker images but don't load them into the local docker registry"; \
52+
echo " $(cyan)spire-server-image$(reset) - build SPIRE server Docker image"; \
53+
echo " $(cyan)spire-agent-image$(reset) - build SPIRE agent Docker image"; \
54+
echo " $(cyan)oidc-discovery-provider-image$(reset) - build OIDC Discovery Provider Docker image"; \
55+
echo "$(bold)Windows docker image:$(reset)"; \
56+
echo " $(cyan)images-windows$(reset) - build all SPIRE Docker images for windows"; \
57+
echo " $(cyan)spire-server-image-windows$(reset) - build SPIRE server Docker image for windows"; \
58+
echo " $(cyan)spire-agent-image-windows$(reset) - build SPIRE agent Docker image for windows"; \
59+
echo " $(cyan)oidc-discovery-provider-image-windows$(reset) - build OIDC Discovery Provider Docker image for windows"; \
60+
echo "$(bold)Developer support:$(reset)"; \
61+
echo " $(cyan)dev-image$(reset) - build the development Docker image"; \
62+
echo " $(cyan)dev-shell$(reset) - run a shell in a development Docker container"; \
63+
echo; \
64+
echo "$(bold)Code generation:$(reset)"; \
65+
echo " $(cyan)generate$(reset) - generate protocol buffers and plugin interface code"; \
66+
echo " $(cyan)generate-check$(reset) - ensure generated code is up to date"; \
67+
echo; \
68+
echo "$(bold)Vulnerabilty checking:$(reset)"; \
69+
echo " $(cyan)govulncheck$(reset) - run govulncheck over the whole project"; \
70+
echo; \
71+
echo "For verbose output set V=1"; \
72+
echo " for example: $(cyan)make V=1 build$(reset)"
7373

7474
# Used to force some rules to run every time
7575
FORCE: ;
@@ -196,19 +196,12 @@ plugin-protos := \
196196

197197
service-protos := \
198198

199-
# The following vars are used in rule construction
200-
comma := ,
201-
null :=
202-
space := $(null) #
203-
204199
#############################################################################
205200
# Utility functions and targets
206201
#############################################################################
207202

208203
.PHONY: git-clean-check
209204

210-
tolower = $(shell echo $1 | tr '[:upper:]' '[:lower:]')
211-
212205
goenv = $(shell PATH="$(go_bin_dir):$(PATH)" go env $1)
213206

214207
git-clean-check:
@@ -391,7 +384,7 @@ $(eval $(call windows_image_rule,oidc-discovery-provider-windows-image,oidc-disc
391384
# Code cleanliness
392385
#############################################################################
393386

394-
.PHONY: tidy tidy-check lint lint-code
387+
.PHONY: tidy tidy-check lint lint-code lint-md
395388
tidy: | go-check
396389
$(E)$(go_path) go mod tidy
397390
$(E)cd proto/spire; $(go_path) go mod tidy
@@ -420,6 +413,8 @@ lint-md:
420413
# Vulnerabilty checking
421414
#############################################################################
422415

416+
.PHONY: govulncheck
417+
423418
govulncheck:
424419
$(E)$(go_path) go run golang.org/x/vuln/cmd/govulncheck@latest ./...
425420

@@ -496,6 +491,8 @@ dev-shell: | go-check
496491
# Toolchain
497492
#############################################################################
498493

494+
.PHONY: go-check go-bin-path install-toolchain install-protoc install-protoc-gen-go install-protoc-gen-go-grpc install-protoc-gen-go-spire
495+
499496
# go-check checks to see if there is a version of Go available matching the
500497
# required version. The build cache is preferred. If not available, it is
501498
# downloaded into the build cache. Any rule needing to invoke tools in the go

0 commit comments

Comments
 (0)