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

From: Junio C Hamano <[email-masked]>
Date: Wed, 22 Sep 2021 18:23:22 -0700

Æ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?