Subject: Re: [PATCH] Makefile: add help target

From: Junio C Hamano <[email-masked]>
Date: Fri, 08 Apr 2022 11:58:24 -0700

Taylor Blau <[email-masked]> 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.mak

perhaps?

> 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.