Re: order-only prerequisites themselves get rebuilt when not needed

Dmitry Goncharov <[email protected]>
Newsgroups gmane.comp.gnu.make.bugs
Message-ID <CAG+Z0Cu=yfwNXGXVhKFPB8HMMetvrQkMGbFy_WfdH3RiuJf44Q@mail.gmail.com>
On Tue, Mar 18, 2025 at 8:06 AM Paul Smith <[email protected]> wrote:
> I see from the patch: you don't mean "never" you mean, only if the
> prerequisite does not exist will it be updated.

Right.

> I agree this preserves probably the most common reason for using OO
> prereqs (to create directories)

This preserves the directory creation use case and also the use of
order-only prerequisites for synchronization as sentinel files instead
of .WAIT.

> but I don't think I like this change.
> For one thing it feels too different from normal make behavior, in that
> we do "consider" a prerequisite but we do so only to check for
> existence, not for out-of-date-ness, which feels odd to me.
>
> Secondly, I believe the behavior provided by your patch is available
> already; you can use $(wildcard ...) to check if a file exists.  Isn't
> something like this (the gross bits can be hidden in a macro I suppose)
> the equivalent of the change in the patch?
>
>     xyz: foo | $(if $(wildcard bar),,bar) ;
>
>     foo bar: ;
>
> If bar exists then we expand to nothing, else we expand to bar.
>

It is equivalent, as far as i can tell.
What do you think we should do?

regards, Dmitry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.