Subject: Re: [PATCH 0/3] Makefile: make "sparse" and "hdr-check" non-.PHONY

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Thu, 23 Sep 2021 04:17:16 +0200

On Wed, Sep 22 2021, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason <[email-masked]> writes:
>
>> I've got some WIP efforts in other areas to do that for some other
>> rules.
>>
>> The problem is that you need to "mkdir .shrapnel" to create a
>> ".shrapnel/revision.sp". So you need the ".shrapnel/revision.sp" to
>> depend on the ".shrapnel".
>>
>> Except you'll find that the naïve implementation of that fails, since
>> any file you create will bump the mtime of the containing directory, so
>> you'll keep re-making ".shrapnel/revision.sp" because ".shrapnel"
>> changed, because ".shrapnel/revision.sp" changed...
>
> We depend on GNU make anyway.  Isn't its "order-only-prerequisites"
> feature what you exactly want to use for the above?

It looks like it, and that I should probably take more time one of these
days to read the GNU make manual through.

But in any case, I do think that's worthwhile in general, i.e. you can
depend on %.h and not need to exclude generated %.h that we make
ourselves if we put that into "gen/" or whatever, "clean" also becomes a
lot easier.

But I'd like to leave it for some future effort of moving *.o, *.sp
etc. generated files around, rather than making *.sp an odd special-case
now.