Skip to content

Instantly share code, notes, and snippets.

@gleox
Last active November 2, 2023 10:18
Show Gist options
  • Save gleox/aa29dd5535f4bb75e67c3eaebe2bdfac to your computer and use it in GitHub Desktop.
Save gleox/aa29dd5535f4bb75e67c3eaebe2bdfac to your computer and use it in GitHub Desktop.
Makefile help target
## help : Show this help.
help: Makefile
@printf "Usage: make [target] [VARIABLE=value]\nTargets:\n"
@sed -n 's/^## //p' $< | awk 'BEGIN {FS = ":"}; { if(NF>1 && $$2!="") printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 ; else printf "%40s\n", $$1};'
@printf "Variables:\n"
@grep -E "^[A-Za-z0-9_]*\?=" $< | awk 'BEGIN {FS = "\\?="}; { printf " \033[36m%-25s\033[0m Default values: %s\n", $$1, $$2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment