C++ Logo

SG15

Advanced search

Subject: Re: [SG15] module source suffixes
From: Johan Boulé (johan.boule_at_[hidden])
Date: 2019-08-28 11:26:59


Ben Boeckel wrote:
> Going from POSIX, it seems that is allowed, but not required. There is
> nothing saying that make has to do the restat. While I suspect gmake is
> the most common version out there, BSD's make is also heavily used and
> I'd need to check its behavior with this.

Does cmake generate different flavours of makefiles or do they need to
conform to the least common denominator ?

>> bmi: bmi.trigger
>> cp mxx $@.new # dummy precompile
>> test -e $@ && cmp $@.new $@ && rm $@.new || mv -v $@.new $@
>> TZ=UTC touch -t 197001010000.01 $<
>
> This resets the time to be too old, no? Wouldn't you want to use
> something like `touch -r=$@ $<` instead (though the max of all $@ is
> more complicated)? With this, bmi is out-of-date after running it
> because it is older than bmi.trigger.

The touch is changing bmi.trigger to make it older than bmi, ensuring that
the rule won't be run anymore (unless the mxx source file changes).

I tried `touch -r=$@ $<` and it works too :) I wasn't sure what make does
when a prereq has the same mtime as the target: turns out it considers it
up-to-date. I don't know in practice, but it might be a bit more fragile
tho, because the `touch -r` command ought to have the maximum resolution
supported by the filesystem and not truncate any part of the mtime.

Regards,

Johan Boule


SG15 list run by sg15-owner@lists.isocpp.org

Older archives