Last active
October 17, 2016 16:28
-
-
Save wojtek-oledzki/198af2c5c2bb732d8e0ba5e87d1aba1d to your computer and use it in GitHub Desktop.
Makefile with help
This file contains hidden or 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
.DEFAULT_GOAL := help | |
.PHONY: help | |
## This is demo target | |
# Example: make demo | |
demo: | |
echo "D E M O" | |
## Prints this help | |
help: | |
@awk -v skip=1 \ | |
'/^##/ { sub(/^[#[:blank:]]*/, "", $$0); doc_h=$$0; doc=""; skip=0; next } \ | |
skip { next } \ | |
/^#/ { doc=doc "\n" substr($$0, 2); next } \ | |
/:/ { sub(/:.*/, "", $$0); printf "\033[34m%-30s\033[0m\033[1m%s\033[0m %s\n\n", $$0, doc_h, doc; skip=1 }' \ | |
$(MAKEFILE_LIST) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment