On Fri, Dec 20, 2024 at 08:07:52PM +0100, Patrick Steinhardt wrote: > > > +# 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