Last active
August 27, 2020 07:57
-
-
Save necrophonic/f72364519ee182a78220b80968f931de to your computer and use it in GitHub Desktop.
Makefile help macro for self documenting Makefiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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