bug-make
[Top][All Lists]
Advanced

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

Re: Order-only prerequisites


From: Frank Heckenbach
Subject: Re: Order-only prerequisites
Date: Fri, 09 Jun 2023 09:28:38 +0200

Henrik Carlqvist wrote:

> On Wed, 07 Jun 2023 08:29:15 +0200
> > As I said, a way to specify in which order recipes are invoked
> > (here, a before b) if they are invoked, without influencing whether
> > they are invoked (only a, only b or a and b, as given on the command
> > line).
> 
> So you really don't want any target to depend upon another target? Then why do
> you care about the order? If order is important, what would happen if make is
> run with -j and starts several jobs in parallell? 

They should run after each other, as per the manual ("... will be
completed before ...").

Roughly speaking, my project consists of several major parts and I
want to be able to selectively rebuild them. E.g., B does depend on
A, but sometimes I want to only rebuild B even though there were
changes to A, because I don't care about those changes at the moment
and rebuilding A takes a long time.

But when I rebuild both of them, especially when I do a full
rebuild, they should be built in the order of their dependencies, as
usual.

I had hoped that order-only prerequisites would do what I want, but
I see now they don't and I'll have to do it some other way.
(Basically, I'm duplicating the rules, one copy with and one without
dependencies, "all" depends on those with dependencies, but manually
I can use those without.)

Paul Smith wrote:

> The documentation of order-only prequisites says what they're for:
> 
> > A normal prerequisite makes two statements: first, it imposes an
> > order in which recipes will be invoked: the recipes for all
> > prerequisites of a target will be completed before the recipe for the
> > target is run.  Second, it imposes a dependency relationship: if any
> > prerequisite is newer than the target, then the target is considered
> > out-of-date and must be rebuilt.
> > 
> > [Order-only prerequisites] impose a specific ordering on the rules to
> > be invoked _without_ forcing the target to be updated if one of those
> > rules is executed.
> 
> Makes treats order-only prereqs identically to "normal" prereqs in
> every way, EXCEPT that at the time where it checks to see whether the
> target needs to be rebuilt it doesn't consider the timestamps of the
> order-only prerequisites.  That's all there is.

I still suggest mentioning that they still cause the prerequisites
to be built (when necessary), and I'm still not happy with the
naming. Maybe that's because I'm a mathematician and used to exact
wording, but to me "a b" and "b a" are different orders of the same
set, but "b" and "a b" are not, so they're not about order only.



reply via email to

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