Created
October 11, 2018 04:54
-
-
Save blackandred/584544839d7634bf3e5e5fb09f6e509a to your computer and use it in GitHub Desktop.
Makefile template
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
.SILENT: | |
# Colors | |
COLOR_RESET = \033[0m | |
COLOR_INFO = \033[32m | |
COLOR_COMMENT = \033[33m | |
## This help screen | |
help: | |
printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n" | |
printf " make [target]\n\n" | |
printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n" | |
awk '/^[a-zA-Z\-\_0-9\.@]+:/ { \ | |
helpMessage = match(lastLine, /^## (.*)/); \ | |
if (helpMessage) { \ | |
helpCommand = substr($$1, 0, index($$1, ":")); \ | |
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ | |
printf " ${COLOR_INFO}%-16s${COLOR_RESET}\t\t%s\n", helpCommand, helpMessage; \ | |
} \ | |
} \ | |
{ lastLine = $$0 }' $(MAKEFILE_LIST) | |
## This is a task description | |
some_task: | |
echo "Hello" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment