Last active
February 12, 2020 15:39
-
-
Save svenax/39299582797b9d9fe29c102bb29baf42 to your computer and use it in GitHub Desktop.
Self documenting Makefile with target groups
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
##@ Group | |
command: ## Help for target 1 | |
@echo Target 1 | |
another_command: ## Help for target 2 | |
@echo Target 1 | |
more_stuff: ## Help for target 3 | |
@echo Target 1 | |
##@ Another group | |
a_long_target_name: ## With a help text | |
@echo The long one | |
##@ Utilities | |
.PHONY: help | |
help: ## Display this help | |
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment