All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: Elia Pinto <gitter.spiros@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] Makefile: add help target
Date: Fri, 08 Apr 2022 17:44:44 +0200	[thread overview]
Message-ID: <220408.86a6cvbme0.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <YlBVBlwNVc8mEjn5@nand.local>


On Fri, Apr 08 2022, Taylor Blau wrote:

> On Fri, Apr 08, 2022 at 07:45:24AM +0000, Elia Pinto wrote:
>> Add a help target to the Makefile to be able to run make help, in the same way
>> does the Makefiles self-generated by some build systems.
>>
>> The target list has been statically extracted from the git Makefile with a
>> script and the results have been filtered in an essentially arbitrary way to
>> leave the ones that i imagines most interesting and frequent for a developer.
>
> 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.
>
> I worry about this list getting stale, though. If we add a new target,
> will we remember to update the "help" list here? It would be nice if we
> could dynamically generate this list, but I think that loses out on the
> filtering you've done here.

There's some nice suggestions at:
https://stackoverflow.com/questions/4219255/how-do-you-get-the-list-of-targets-in-a-makefile

I managed to get pretty close to this by massaging the various parsers
that were suggested there.

But I wonder if defining help as we go along wouldn't be the best and
least likely to break, and most likely to be kept up-to-date. I.e. some
variant of the comments added there.

Or better (maybe it's discussed in that SO thing, I didn't skim it all),
something like:

    HELP_all = the default target
    all::
    [...]

We could then even print a heading showing what target(s) we're running
by looking at MAKECMDGOALS.

Also, Elia's ad-hoc script here copied from StackOverflow looks awfully
similar to what I have in /usr/share/bash-completion/completions/make
installed with my OS. Available here:
https://github.com/scop/bash-completion/blob/master/completions/make

So maybe we could just make this an optional target that depended on
that widely-available bash completion?

That would also have the nice benefit that to the extent that the output
sucked we could maybe massage our Makefile a bit to make it better, and
then we'd not only benefit "make help" users, but anyone doing "make
<TAB>".

  reply	other threads:[~2022-04-08 15:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-08  7:45 [PATCH] Makefile: add help target Elia Pinto
2022-04-08  9:32 ` Philip Oakley
2022-04-08 15:30 ` Taylor Blau
2022-04-08 15:44   ` Ævar Arnfjörð Bjarmason [this message]
2022-04-08 18:58   ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2010-09-28  8:13 [PATCH] Makefile: Add " Stephen Boyd
2010-09-28  9:45 ` Junio C Hamano
2010-09-28 11:37   ` Sverre Rabbelier
2010-09-28 12:35     ` Andreas Ericsson
2010-09-29  6:10   ` yj2133011
2010-08-25  9:51 Stephen Boyd
2010-08-25 16:27 ` Sverre Rabbelier
2010-08-25 21:36   ` Stephen Boyd
2010-08-25 21:39     ` Sverre Rabbelier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=220408.86a6cvbme0.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitter.spiros@gmail.com \
    --cc=me@ttaylorr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.