Skip to content

Instantly share code, notes, and snippets.

@b3cft
Last active March 10, 2020 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b3cft/6e5d10ae195629d36b5d9cc8f36fb925 to your computer and use it in GitHub Desktop.
Save b3cft/6e5d10ae195629d36b5d9cc8f36fb925 to your computer and use it in GitHub Desktop.
Makefile automagic help
SHELL=bash
.DEFAULT=help
ifndef VERBOSE
.SILENT:
endif
# Colours
NO_COLOUR=\033[0m
OK_COLOUR=\033[1;32m
INFO_COLOUR=\033[1;33m
SECTION_COLOUR=\033[1;37m
ERROR_COLOUR=\033[1;35m
WARN_COLOUR=\033[0;33m
help::
awk 'BEGIN {FS = ":.*##";} /^[a-zA-Z0-9_-]+:.*?##/ { printf " $(INFO_COLOUR)%-20s$(NO_COLOUR) %s\n", $$1, $$2 } /^##@/ { printf "\n$(SECTION_COLOUR)%s$(NO_COLOUR)\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Grouping one
target1: ## Description of target 1
target2: ## Description of target 2
##@ Grouping two
target3: ## Description of target 3
target4: ## Description of target 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment