C++ Logo


Advanced search

Re: [SG15] module source suffixes

From: Johan Boulé <johan.boule_at_[hidden]>
Date: Wed, 28 Aug 2019 16:26:59 -0000
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 $_at_[hidden] # dummy precompile
>> test -e $@ && cmp $_at_[hidden] $@ && rm $_at_[hidden] || mv -v $_at_[hidden] $@
>> 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.


Johan Boule

Received on 2019-08-28 11:29:09