Re: $< ignores order-only prerequisites

2015-01-18 Thread Paul Smith
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:

http://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html

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
prerequisite.

> foo bar:
> @ echo $@ $<

If you really want this behavior, you can write:

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



___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


$< ignores order-only prerequisites

2015-01-16 Thread Parke
Hi bug-make,

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.

Possibly relevant documentation:

https://www.gnu.org/software/make/manual/make.html#index-_0024_003c
https://www.gnu.org/software/make/manual/make.html#Prerequisite-Types

Below is a sample Makefile that demonstrates this unexpected behavior.

Thanks!

-Parke



$ cat Makefile

main: message foo bar

foo:  Makefile
bar:  |  Makefile

foo bar:
@ echo $@ $<

message:
@ echo
@ echo expected output:
@ echo
@ echo foo Makefile
@ echo bar Makeflie
@ echo
@ echo actual output:
@ echo

$ make

expected output:

foo Makefile
bar Makeflie

actual output:

foo Makefile
bar

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make