Subject: Re: [PATCH] Makefile: add missing dependencies of 'config-list.h'

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Fri, 09 Apr 2021 00:08:23 +0200

On Thu, Apr 08 2021, SZEDER Gábor wrote:

> We auto-generate the list of supported configuration variables from
> 'Documentation/config/*.txt', and that list used to be created by the
> 'generate-cmdlist.sh' helper script and stored in the 'command-list.h'
> header.  Commit 709df95b78 (help: move list_config_help to
> builtin/help, 2020-04-16) extracted this into a dedicated
> 'generate-configlist.sh' script and 'config-list.h' header, and added
> a new target in the 'Makefile' as well, but while doing so it forgot
> to extract the dependencies of the latter.  Consequently, since then
> 'config-list.h' is not re-generated when 'Documentation/config/*.txt'
> is updated, while 'command-list.h' is re-generated unnecessarily:
>
>   $ touch Documentation/config/log.txt
>   $ make -j4
>       GEN command-list.h
>       CC help.o
>       AR libgit.a
>
> Fix this and list all config-related documentation files as
> dependencies of 'config-list.h' and remove them from the dependencies
> of 'command-list.h'.
>
>   $ touch Documentation/config/log.txt
>   $ make
>       GEN config-list.h
>       CC builtin/help.o
>       LINK git
>
> Signed-off-by: SZEDER Gábor <[email-masked]>
> ---
>  Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 5a022367d4..2c41f125e0 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2151,13 +2151,13 @@ $(BUILT_INS): git$X
>  
>  config-list.h: generate-configlist.sh
>  
> -config-list.h:
> +config-list.h: Documentation/*config.txt Documentation/config/*.txt
>  	$(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh \
>  		>$@+ && mv $@+ $@
>  
>  command-list.h: generate-cmdlist.sh command-list.txt
>  
> -command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
> +command-list.h: $(wildcard Documentation/git*.txt)
>  	$(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \
>  		$(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \
>  		command-list.txt >$@+ && mv $@+ $@

This change makes sense.

I have a not-yet-submitted patch series where I added some more
config/*/*.txt that wouldn't be caught by this rule, I'd updated the
Documentation/Makefile, but missed this part in the top-level Makefile.

So a relation question: Does anyone actually prefer this state of
affairs of having a Makefile, Documentation/Makefile, t/Makefile
t/perf/Makefile and template/Makefile?

It seems to me with ever-closer coupling between them that it's getting
to be more of a hassle to manage state between them than it would be to
just move them all into one big Makefile.