Skip to content

Commit f6d0b68

Browse files
committed
Merge pull request honza#736 from codeinabox/makefile-help
Snippet for `help` target for self-documented Makefile
2 parents 8f2c44f + c7f4b0a commit f6d0b68

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

snippets/make.snippets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,8 @@ snippet el
4343
# .DEFAULT_GOAL := target
4444
snippet default
4545
.DEFAULT_GOAL := ${1}
46+
# help target for self-documentated Makefile
47+
snippet help
48+
help: ## Prints help for targets with comments
49+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $\$1, $\$2}'
50+
${0}

0 commit comments

Comments
 (0)