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

It's a important feature of pattern rules that you can define multiple pattern
rules that match the same target.  Consider the various pattern rules for
%.o:
$ make -pq | grep '%\.o:' 
%.o:
%.o: %.c
%.o: %.cc
%.o: %.C
%.o: %.cpp
%.o: %.p
%.o: %.f
%.o: %.F
%.o: %.m
%.o: %.r
%.o: %.s
%.o: %.S
%.o: %.mod
$

In order to support that, pattern rules are independent unless they have the
exact same target and prerequisite list; this lets you override or delete an
existing pattern rule by defining it again.  However, it also means that
prerequisite accumulation simply can't be supported for them: how would you
tell make *which* of the existing pattern rules would you want to accumulate
the prerequisites onto?

So your Makefile defines two distinct pattern rules:

$ make -pq | fgrep -C3 %.b  
#  recipe to execute (from 'Makefile', line 4):
        @echo "making $@ from '$^ | $|'" 

%.b: | C

%.b: A B
#  recipe to execute (from 'Makefile', line 7):
        @echo "making $@ from '$^ | $|'" 

$

You'll need to include all the prerequisites in the rule when you define it. 
This perhaps may mean accumulating them into variables and only actually
declaring the pattern rule using those variables once you know the
prerequisites are fully calculated.


Philip Guenther


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49661>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


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

Reply via email to