Created
April 12, 2016 07:49
-
-
Save amitu/95b413d8da17c229dd494d0a0bff2790 to your computer and use it in GitHub Desktop.
Self documenting makefile
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
.DEFAULT_GOAL := help | |
node_modules: ## Install dependencies. | |
node_modules: package.json | |
npm install | |
help: ## Show this help. | |
@IFS=$$'\n' ; \ | |
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \ | |
for help_line in $${help_lines[@]}; do \ | |
IFS=$$':' ; \ | |
help_split=($$help_line) ; \ | |
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \ | |
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \ | |
printf '\033[36m'; \ | |
printf "%-15s %s" $$help_command ; \ | |
printf '\033[0m'; \ | |
printf "%s\n" $$help_info; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment