Last active
December 8, 2020 14:14
-
-
Save taraspos/00fb83f19733681e3b14b968bea999b0 to your computer and use it in GitHub Desktop.
Multi-file documented Makefile
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
# improved version of help from the article https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | |
# but with the support of included makefiles | |
.PHONY: help | |
help: | |
@for m in $(MAKEFILE_LIST); do \ | |
grep -E '^[a-zA-Z0-9_\/%-]+:.*?## .*$$' $$m | \ | |
sort | \ | |
awk -v f="$$m" ' BEGIN {FS = ":.*?## "}; NR == 1 { printf "%s:\n", f } {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}';\ | |
done | |
command1: ## example command1 | |
@echo "You just run command1" |
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
include common.Makefile | |
command2: ## example command2 | |
@echo "You just run command2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And you would get result like: