[Top][All Lists]

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

[bug #49661] syntax anomaly with order-only prereqs and pattern rules

From: anonymous
Subject: [bug #49661] syntax anomaly with order-only prereqs and pattern rules
Date: Mon, 21 Nov 2016 17:53:41 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; OpenBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36

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
$ make -pq | grep '%\.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:


  Message sent via/by Savannah

reply via email to

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