bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Potential Bug: `.PHONY` targets and order-only prerequisites


From: Jacob Kopczynski
Subject: Re: Potential Bug: `.PHONY` targets and order-only prerequisites
Date: Wed, 18 May 2022 10:22:33 -0700

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. This portion of the documentation particularly needs changing:
> Occasionally, however, you have a situation where you want to impose
> a specific ordering on the rules to be invoked without forcing the
> target to be updated if one of those rules is executed. In that case,
> you want to define order-only prerequisites.
The natural reading of this strongly implies that an order-only prerequisite literally only affects the order of things. I would suggest
> Occasionally, however, you have a situation where you do not want to
> force the target to be updated if a rule is executed, but you do want to
> ensure that rule is executed before the target every time the target is
> built. In that case, you want to define order-only prerequisites.

Thanks,
Jacob

On Tue, May 17, 2022 at 3:40 PM Paul Smith <psmith@gnu.org> wrote:
On Tue, 2022-05-17 at 22:32 +0000, Martin Dorey wrote:
> >  all your targets are .PHONY, and thus are always rebuilt anyway
>
> If you "make down", the rule for "down-clean" doesn't run.  They're
> only rebuilt if something causes them to be considered.
>
> >  order-only prerequisites are totally irrelevant and have no impact
> > on
> > your makefile.
>
> If you comment-out the order-only prerequisite that says that the up
> target depends on down-clean, then the recipe for down-clean doesn't
> get run when you "make up".

Sure, of course.

What I was trying to say was, any rule that would normally be run will
be run regardless of order-only or not, because all the targets in the
makefile are phony.  So adding or removing the order-only operator in a
prerequisites list makes no difference to how the targets will be
processed, in this specific makefile.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]