Skip to content

Instantly share code, notes, and snippets.

@auxiliumknowledge
Last active March 20, 2024 07:05
Show Gist options
  • Save auxiliumknowledge/607d6ceb37c6a4e8fa3cb255555243e3 to your computer and use it in GitHub Desktop.
Save auxiliumknowledge/607d6ceb37c6a4e8fa3cb255555243e3 to your computer and use it in GitHub Desktop.
Display a help output for included makefiles too
# Improved from the Symfony Conf example
help: ## This comment creates ouput
@grep -E '(^[a-zA-Z_]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | sed 's/[^:]*\(:.*\)/\1/' | cut -c 1 --complement | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
build: ## Build your application
include submakefile
# --- Example output ---
# --- include files are always appended ---
# help This comment creates ouput
# build Build your application
# test Run all tests
test: ## Run all tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment