Last active
January 15, 2022 00:41
-
-
Save jeffsp/3e1b2e10b9181681a604dd9ec6d64ecf to your computer and use it in GitHub Desktop.
Easy way to embed help in a GNU make 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
.PHONY: target1 # Target 1 help text | |
target1: target2 target3 | |
@echo "Target 1" | |
.PHONY: target2 # Target 2 help text | |
target2: | |
@echo "Target 2" | |
.PHONY: target3 | |
target3: | |
@echo "No help for this target" | |
.PHONY: help # Generate list of targets with descriptions | |
help: | |
@grep '^.PHONY: .* #' Makefile | sed 's/\.PHONY: \(.*\) # \(.*\)/\1 \2/' | expand -t20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://github.com/jeffsp/makefile_help