Last active
August 1, 2021 10:26
-
-
Save leo-pfeiffer/06f6a365ae3db552502539238a808d62 to your computer and use it in GitHub Desktop.
Auto help command for 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
## https://stackoverflow.com/a/35730928/12168211 | |
## Automatic help command | |
## Comment directly before target name used as help | |
.PHONY: help | |
# Show this help. | |
help: | |
@awk '/^#/{c=substr($$0,3);next}c&&/^[[:alpha:]][[:alnum:]_-]+:/{print substr($$1,1,index($$1,":")),c}1{c=0}' $(MAKEFILE_LIST) | column -s: -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment