version.h rebuild change in stable

Vincent Lefevre vincent at vinc17.org
Sun Jun 2 01:42:13 UTC 2019


On 2019-06-02 08:31:01 +1000, Cameron Simpson wrote:
> On 01Jun2019 14:16, vincent lefevre <vincent at vinc17.org> wrote:
> > On 2019-06-01 16:36:38 +1000, Cameron Simpson wrote:
> > > I'm an opinionated make user. Can you explain why you want the
> > > "FORCE"
> > > target at all?
> > 
> > The goal is to make sure that version.h is up-to-date after an update
> > such as "git pull".
> 
> Ah, where the file timestamp is not a reliable indicator of change?

The idea was to update version.h only when there is to be a real
change in its contents (a temporary file was used for the detection).
This is not possible by using timestamp dependencies, AFAIK (well,
this is theoretically possible, but this would have required major
changes in Makefile.am).

Now, in Mutt, when version.h is modified, there aren't many things
to rebuild, thus having a dependency of version.h on every source
file could be a solution. I still much prefer the GNU make solution.

> Just spitballing here, but might it not be reasonable for "make clean" to
> rebuild version.h? It seems like you'd want a make clean after a git pull
> anyway.

No, certainly not! I don't want to rebuild *everything* after a
"git pull".

> > [...]
> > > Coming around to my opinions here, I think the BSD make is more correct:
> > > version.h got remade in the "FORCE" version of the Makefile, and its
> > > dependents need a rebuild. GNU make's presuming that file content are all
> > > there are - suppose an action changed something else significant not
> > > considered? Eg maybe the build process copies an ACL off version.h or some
> > > other thing beyond the content. Obviously we don't actually do that, but IMO
> > > GNU make is being too clever.
> > 
> > No, a rule with no prerequisites or recipe is undefined behavior in
> > POSIX, thus can be used as an extension, and this is what GNU make
> > does (see Section 4.7 Rules without Recipes or Prerequisites).
> 
> What if the FORCE target were:
> 
>  FORCE:
>    true
> 
> so that it had a do-nothing recipe? That feels portable.

If this works with BSD make, this would be fine, I think.

> The downside is of course that makes version.h unconditionally updated and
> that probably forces a rebuild of lots of stuff.

No, see the use of the .tmp file that was used with FORCE. This avoids
a change of the timestamp of version.h if the contents are not about
to be changed.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the Mutt-dev mailing list