Re: [PATCH] Makefile: add help target
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 8, 2022, 18:58 UTC
- Message-ID
- <xmqq1qy7mmgf.fsf@gitster.g>
- In-Reply-To
- <YlBVBlwNVc8mEjn5@nand.local>
Taylor Blau <me@ttaylorr.com> writes:
> I could definitely see something like "make help" being helpful, since > make itself doesn't have a convenient way to list all of a Makefile's > targets.
But is listing all useful to begin with? I doubt it.
Most useful targets are all .PHONYs, so a possible approach is to make them double-colon rules, and have a section at the top, next to where we explain "# The default target of this Makefile is...", that lists all of them there, and have a rule
# The default target of this Makefile is...
all::
+# Common targets
+test::
+doc::
+...
+help::
+ sed -e '/help::/q' Makefile
# Import tree-wide shared Makefile behavior and libraries
include shared.makperhaps?
> I worry about this list getting stale, though.
Absolutely.
A well-curated list of common targets, maybe, but I find nothing interesting in the posted patch that lists way too many.
I also suspect that a well-curated list at the top would eliminate the need for the "help" target in the first place. Between "make help" and "less Makefile", the latter is much more intuitive.
Thanks.