Subject: Re: [PATCH v2 4/5] Makefile: respect build info declared in "config.mak"

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 20 Dec 2024 17:47:14 +0100

On Fri, Dec 20, 2024 at 10:54:33AM -0500, Jeff King wrote:
> On Fri, Dec 20, 2024 at 01:22:48PM +0100, Patrick Steinhardt wrote:
> 
> > In preceding commits we fixed that build info set via e.g. `make
> > GIT_VERSION=foo` didn't get propagated to GIT-VERSION-GEN. Similarly
> > though, setting build info via "config.mak" does not work anymore either
> > because the variables are only declared as Makefile variables and thus
> > aren't accessible by the script.
> > 
> > Fix the issue by exporting those variables via "shared.mak". This also
> > allows us to deduplicate the export of GIT_USER_AGENT.
> 
> This looks good. It fixes the issue, and I am happy that:
> 
> >  asciidoctor-extensions.rb: asciidoctor-extensions.rb.in FORCE
> > -	$(QUIET_GEN)GIT_USER_AGENT="$(GIT_USER_AGENT)" $(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@
> > +	$(QUIET_GEN)$(SHELL_PATH) ../GIT-VERSION-GEN "$(shell pwd)/.." $< $@
> 
> ...these spots get even simpler.

Meh. I just noticed that this doesn't work: we include GIT-VERSION-FILE
and export its value, and consequently any subsequent invocation of
GIT-VERSION-GEN will continue to use the value that we have in
GIT-VERSION-FILE. So it's effectively only computed the first time.

This would all be much simpler if we didn't include the file in the
first place. In Documentation/Makefile we don't indeed use it anymore.
But in the top-level Makefile we do use it to generate the name of a
couple of archives. I'll have a look there.

Patrick