The thing that the docs refer to as "impose order" is not a single thing,
but two. I would characterize a normal prerequisite as doing three things
rather than two:
- *update-marking: *cause a target to be marked out of date if the prereq
is marked out of date
- *require-existence: *require the prereq to be built successfully at least
once before the target is built
- *imposed-order: *require the prereq to be built before the target, if
both are being built
A prereq which truly was order-only would *exclusively* do the last one,
imposing order. The "order-only" prereqs as they stand do both
*imposed-order* and *require-existence*. For .PHONY targets,
*require-existence* always mandates *update-marking*, which is why the
overlap between those two cases is particularly confusing - a phony target
which drops only update-marking is a contradiction in terms, so the natural
assumption to make is that the effect of "order-only" prereqs is *not* that,
and is instead something non-paradoxical.

I looked deeper into the list archives and saw that this discussion has
come up before; Stefano Lattarini experienced the same problem in 2012
<https://lists.gnu.org/archive/html/bug-make/2012-06/msg00008.html> (thread
starts 2012/06/11). Phillip Guenther said
<https://lists.gnu.org/archive/html/bug-make/2012-06/msg00011.html> that
this pure-order effect is not achievable with the structure of make, which
presumably remains true.

I agree with Lattarini's recommendations, which I'll reproduce below for
convenience. The primary one was the suggestion of alternate names that
might be used for what are currently called order-only prerequisites -
"existence-only prerequisites" seems like the clearest one to me.

Thanks,
Jacob

Lattarini:

>   - the name "order-only prerequisites" is IMHO poorly chosen, and don't
>     really correspond to their actual semantics; a more appropriate might
>     be "weak prerequisites" or "existence-only prerequisites";
>   - the explanation given in the manual is imprecise and confusing; since
>     the explanation you've given here is OTOH very clear and concise, I
>     suggest you report it in the manual;
>   - it might make sense to state explicitly that order-only prereqs
>     which are phony behave in all ways like standard prerequisites.

The referenced 'explanation you've given here' is from Paul Smith -
presumably the same one that has responded to me? It was

> No, that's not how order-only prerequisites work.  An order-only
> prerequisite is treated identically to a normal prerequisite except for
> exactly one thing: when make checks to see if a target needs to be
> remade, the time-last-modified values for any order-only prerequisites
> are not considered.


On Wed, May 18, 2022 at 11:14 AM Paul Smith <psm...@gnu.org> wrote:

> On Wed, 2022-05-18 at 10:22 -0700, Jacob Kopczynski wrote:
> > I believe I understand. The name "order-only" is highly misleading
> > and should be changed - it does considerably more than "only"
> > "order"; the only thing it does not do is check the timestamp.
>
> As described in the docs there are only two things a prerequisite can
> do: impose order and effect the out-of-date decision of the target.
> Order-only prerequisites do one of them (impose order) and don't do the
> other (effect out-of-date decisions).
>
> What are the "considerably more" things that order-only prerequisites
> do, besides impose order?
>
> I do agree that the docs need clarification though.
>

Reply via email to