Skip to content

Commit 42ce869

Browse files
committed
build(project): add sub-targets for tool dependencies
1 parent d49587d commit 42ce869

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ endif
118118
.PHONY: all
119119
all: help
120120

121-
## Lint:
122121
.PHONY: lint
123122
lint: lint-go lint-proto ## Lint all available linters
124123

@@ -418,7 +417,10 @@ ensure-buildx-builder:
418417

419418
## Dependencies:
420419
.PHONY: deps
421-
deps: $(TOOL_TPARSE_BIN) ## Install all the dependencies (tools, etc.)
420+
deps: deps-$(TOOL_TPARSE_NAME) ## Install all the dependencies (tools, etc.)
421+
422+
.PHONY: deps-$(TOOL_TPARSE_NAME)
423+
deps-tparse: $(TOOL_TPARSE_BIN) ## Install $TOOL_TPARSE_NAME $TOOL_TPARSE_VERSION ($TOOL_TPARSE_PKG)
422424

423425
$(TOOL_TPARSE_BIN):
424426
@echo "${COLOR_CYAN} 📦 Installing ${COLOR_GREEN}$(TOOL_TPARSE_NAME)@$(TOOL_TPARSE_VERSION)${COLOR_CYAN}...${COLOR_RESET}"
@@ -433,10 +435,14 @@ help: ## Show this help.
433435
@echo ' ${COLOR_YELLOW}make${COLOR_RESET} ${COLOR_GREEN}<target>${COLOR_RESET}'
434436
@echo ''
435437
@echo 'Targets:'
436-
@awk 'BEGIN {FS = ":.*?## "} { \
438+
@$(foreach V,$(sort $(.VARIABLES)), \
439+
$(if $(filter-out environment% default automatic,$(origin $V)), \
440+
$(if $(filter TOOL_%,$V), \
441+
export $V="$($V)";))) \
442+
awk 'BEGIN {FS = ":.*?## "} { \
437443
if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${COLOR_YELLOW}%-20s${COLOR_GREEN}%s${COLOR_RESET}\n", $$1, $$2} \
438444
else if (/^## .*$$/) {printf " ${COLOR_CYAN}%s${COLOR_RESET}\n", substr($$1,4)} \
439-
}' $(MAKEFILE_LIST)
445+
}' $(MAKEFILE_LIST) | envsubst
440446
@echo ''
441447
@echo 'This Makefile depends on ${COLOR_CYAN}docker${COLOR_RESET}. To install it, please follow the instructions:'
442448
@echo '- for ${COLOR_YELLOW}macOS${COLOR_RESET}: https://docs.docker.com/docker-for-mac/install/'

0 commit comments

Comments
 (0)