Follow-up Comment #1, bug #63125 (project make):

A result of *foo.1* is definitely not right.

The value of *$<* is always set to the first prerequisite in the rule
definition which provides the recipe, if there is one.  Only if there isn't a
prerequisite listed in the rule itself will you get the first found
prerequisite.  See:


$ cat Makefile
foo: foo.1
foo: foo.2 ; : $@ $<

foo.%: ; : $@

bar: foo.3
bar: foo.4
bar: ; : $@ $<

$ make foo
: foo.2
: foo.1
: foo foo.2

$ make bar
: foo.3
: foo.4
: bar foo.3


We can see that the behavior in GNU make 3.81 was definitely wrong.

Also, recall that $^ shows a set of prerequisites that does NOT include
duplicates.  If you want to see the full set of prerequisites including
duplicates, you need to use $+.

However even if you use $+ you'll get a different answer because indeed $$< is
not set here.  There seems to be some dissension between the docs and the
code, which we should investigate.

In general it can be tricky to use automatic variables that contain
prerequisites, in the list of prerequisites, because there's a catch-22 there.
 Resolving it would require that each prerequisite be parsed and all automatic
variables be updated before any subsequent secondary expansion is done and I'm
not sure that's how it works.

FYI I checked and the behavior you see in 4.3 was the same as in 3.82.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63125>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/


Reply via email to