Skip to content

Self-document the makefile #10596

@philderbeast

Description

@philderbeast

Could we make our makfile self-documenting?

$ make help
make: *** No rule to make target 'help'.  Stop.
$ git diff
diff --git a/Makefile b/Makefile
index 24d840ce3..ca654d72f 100644
--- a/Makefile
+++ b/Makefile
@@ -268,3 +268,9 @@ PROCS := $(shell sysctl -n hw.logicalcpu)
 else
 PROCS := $(shell nproc)
 endif
+
+.PHONY: help
+
+help: ## --> The help recipe is showing the help target comment (and the others)!
+       @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
+        sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
$ make help
fix-whitespace                 Run fix-whitespace in fix mode
help                           --> The help recipe is showing the help target comment (and the others)!
init                           Set up git hooks and ignored revisions
lint-json                      Run HLint in JSON mode
lint                           Run HLint
style-commit                   Run the code styler on the previous commit
style-modified                 Run the code styler on modified files
style                          Run the code styler
whitespace                     Run fix-whitespace in check mode

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions