Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-document the makefile #10596

Open
philderbeast opened this issue Nov 26, 2024 · 1 comment · May be fixed by #10608
Open

Self-document the makefile #10596

philderbeast opened this issue Nov 26, 2024 · 1 comment · May be fixed by #10608

Comments

@philderbeast
Copy link
Collaborator

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
@ulysses4ever
Copy link
Collaborator

Yes! Bonus points if you trash everything that doesn't find its way to the help message 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants