[Top][All Lists]

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

Re: $< ignores order-only prerequisites

From: Paul Smith
Subject: Re: $< ignores order-only prerequisites
Date: Sun, 18 Jan 2015 14:59:24 -0500

On Fri, 2015-01-16 at 12:52 -0800, Parke wrote:
> It appears that if there are no normal prerequisites, $< will ignore
> any order-only prerequisites.
> This is not the behavior I expected, and I could not find
> documentation describing this behavior.

I agree it should be documented explicitly, but I don't necessarily
think it's wrong.

You may note that the $^ variable doesn't contain order-only
prerequisites either.  The idea is that prerequisites that are
order-only are qualitatively different than normal prerequisites;
they're there only to ensure things happen in a particular order.  The
manual gives a hint:


when it says that order-only prerequisites don't create a "dependency
relationship"; because of this they aren't included in the normal
dependency variables like $^ and $<.

If the prerequisite needed to be both ordered AND create a dependency
relationship, then it would be a normal prerequisite not an order-only

> foo bar:
>         @ echo $@ $<

If you really want this behavior, you can write:

foo bar:
        @ echo $@ $(firstword $< $|)

reply via email to

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