From c7f4b0a7f7ab441249cca4fce8a559f5271f30eb Mon Sep 17 00:00:00 2001 From: Mathew Attlee Date: Tue, 17 May 2016 15:29:01 +0100 Subject: [PATCH] Snippet for `help` target for self-documented Makefile --- snippets/make.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snippets/make.snippets b/snippets/make.snippets index 68a75e2..b46ee70 100644 --- a/snippets/make.snippets +++ b/snippets/make.snippets @@ -43,3 +43,8 @@ snippet el # .DEFAULT_GOAL := target snippet default .DEFAULT_GOAL := ${1} +# help target for self-documentated Makefile +snippet help + help: ## Prints help for targets with comments + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $\$1, $\$2}' + ${0}