Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jecolasurdo/baad23fc514369f991dfb09d11a44fd7 to your computer and use it in GitHub Desktop.
Save jecolasurdo/baad23fc514369f991dfb09d11a44fd7 to your computer and use it in GitHub Desktop.
makefile auto help
## This help screen
help:
printf "Available targets\n\n"
awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf "%-15s %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment