-
-
Save eagafonov/194551ea188008689443bb069e1d2929 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