.DEFAULT_GOAL = help .PHONY: help ##@ HELP help: ## display this help @awk 'BEGIN {FS = ":.*##"; \ printf "\033[1mUSAGE\n\033[0m make \033[36m<TARGET>\033[0m\n"} \ /^[a-zA-Z_-]+\.*[a-zA-Z]*:.*?##/ {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2} \ /^##@/ {printf "\n\033[1m%s\033[0m\n", substr($$0, 5)} \ /^###/ {printf "\033[0m\t\t %s\033[0m\n", substr($$0, 4)}' $(MAKEFILE_LIST) .PHONY: foo bar baz ##@ DEMO foo: bar ## foo target ### additional foo target details @echo foo bar: ## bar target @echo bar baz: ## baz target @echo baz
https://gist.github.com/prwhite/8168133
SHELL:=/bin/bash .PHONY: help help_target-funky+names.0k and_with_2_targets_and_spaces_like_bison help_target-funky+names.0k and_with_2_targets_and_spaces_like_bison: ## Funky ones & bison dual target display ok echo "bad - why are you not displaying?" help: ## bash help help: ## moar bash help @RE='^[a-zA-Z0-9 ._+-]*:[a-zA-Z0-9 ._+-]*##' ; while read line ; do [[ "$$line" =~ $$RE ]] && echo "$$line" ; done <$(MAKEFILE_LIST) ; RE=''
https://git.suckless.org/dmenu/file/Makefile.html
https://git.suckless.org/sprop/file/Makefile.html
with file rule variables (my name for them, `OBJ = ${SRC:.c=.o}`).
https://github.com/lpsantil/rt0/blob/master/Makefile
https://github.com/lpsantil/oop0/blob/master/Makefile