Skip to content

Instantly share code, notes, and snippets.

@necrophonic
Last active August 27, 2020 07:57
Show Gist options
  • Save necrophonic/f72364519ee182a78220b80968f931de to your computer and use it in GitHub Desktop.
Save necrophonic/f72364519ee182a78220b80968f931de to your computer and use it in GitHub Desktop.
Makefile help macro for self documenting Makefiles
## Add the "help" target as the first target in your makefile. Then, any target
## that is marked up with a double hash as shown will display as a help message
## when you type just "make" or "make help"
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
my_target: ## This target does a thing
echo "hello"
clean: ## This cleans things up
echo "Sweepy sweep"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment