Re: [PATCH v2 4/5] Makefile: respect build info declared in "config.mak"
- From
Jeff King <peff@peff.net>
- Date
- Dec 20, 2024, 17:51 UTC
- Message-ID
- <20241220175136.GA203033@coredump.intra.peff.net>
- In-Reply-To
- <Z2WfirfrpYYFgYdw@pks.im>
On Fri, Dec 20, 2024 at 05:47:14PM +0100, Patrick Steinhardt wrote:
Show 12 quoted lines
> > 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.
I'm not sure what you mean.
I wondered earlier if we might into a chicken-and-egg problem like that, but I tested and it seemed to work fine. The rule for GIT-VERSION-FILE means we'll build it before make reads it, so that first run of it will get the updated value. And:
make GIT_VERSION=foo && bin-wrappers/git version make GIT_VERSION=bar && bin-wrappers/git version
does what you'd expect. And the docs work the same way:
cd Documentation make GIT_VERSION=foo git.1 && man -l git.1 make GIT_VERSION=bar git.1 && man -l git.1
Is there a case you found that doesn't work?
-Peff