Re: [PATCH v2 4/5] Makefile: respect build info declared in "config.mak"
- From
Jeff King <peff@peff.net>
- Date
- Dec 28, 2024, 19:43 UTC
- Message-ID
- <20241228194345.GA1535629@coredump.intra.peff.net>
- In-Reply-To
- <Z2XAiDC4pJ9OjTpC@pks.im>
On Fri, Dec 20, 2024 at 08:07:52PM +0100, Patrick Steinhardt wrote:
Show 20 quoted lines
> > > +# Never include it on the first read-through, only after make has tried to > > > +# refresh includes. We do not want the old values to pollute our new run of the > > > +# rule above. > > > +ifdef MAKE_RESTARTS > > > -include GIT-VERSION-FILE > > > +endif > [...] > Okay, I did find an issue where it does not work: > > $ git clean -dfx > $ make GIT-USER-AGENT > $ cat GIT-USER-AGENT > git/ > $ cat GIT-VERSION-FILE > cat: GIT-VERSION-FILE: No such file or directory > > It does not generate the version file at all anymore when it's not an > explicit dependency. While I could of course add the missing dependency > I don't know whether there are any other implicit dependencies that > would be broken, as well. My gut feeling says "probably".
Doh, of course. We really want to say "do include this and consider it a dependency, but don't read it yet". But I don't think there's a way to tell make to do that.
I looked over your alternative approach with the OVERRIDE variable. I can't think of any downsides, aside from the general head-spinning complexity. ;) So that seems like a good approach for now (and I see it's already in master. Yay).
-Peff