Something went wrong on our end
-
Volker Schukai authoredVolker Schukai authored
target-help.mk 1.61 KiB
#############################################################################################
#############################################################################################
##
## HELP-TARGETS
##
#############################################################################################
#############################################################################################
# @see .PHONY https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.DEFAULT_GOAL := help
.PHONY: print
print:
$(ECHO) "THIS_MAKEFILE: $(THIS_MAKEFILE)"
$(ECHO) "THIS_MAKEFILE_PATH: $(THIS_MAKEFILE_PATH)"
$(ECHO) "PROJECT_ROOT: $(PROJECT_ROOT)"
# Add a comment to the public targets so that it appears
# in this help Use two # characters for a help comment
.PHONY: help
help:
@printf "${COMMENT}Usage:${RESET}\n"
@printf " make [target] [arg=\"val\"...]\n\n"
@printf "${COMMENT}Available targets:${RESET}\n"
@awk '/^[a-zA-Z\-\\_0-9\.@]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${INFO}%-22s${RESET} %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
@printf "\n${COMMENT}Available arguments:${RESET}\n\n"
@awk '/^(([a-zA-Z\-\\_0-9\.@]+)\s=)/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${INFO}%-22s${RESET} %s (Default: %s)\n", $$1, helpMessage, $$3; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)