RE: Multiple rules for same target: what is the order of prerequisites in $^ and what does $< expand to?

"Cook, Malcolm" <[email protected]>
Newsgroups gmane.comp.gnu.make.general
Message-ID <DS7PR20MB467194FF5B9F51D286DF378ABEC1A@DS7PR20MB4671.namprd20.prod.outlook.com>
>On Wed, 2023-09-27 at 16:50 +0200, Renaud Pacalet wrote:
>> Thanks for your answer, Bahman. Not sure what "equivalent" means but
>> with the following Makefile:
>> 
>> %.a: %.b
>> 
>> a.a: a.c
>>      echo $^
>
>The first pattern rule here does not define a pattern rule. It
>*cancels* a pattern rule. See:
>https://www.gnu.org/software/make/manual/html_node/Canceling-Rules.html
>
>It's not possible for two different pattern rules to both be in effect
>when building the same target, just like it's not possible for multiple
>implicit rules with recipes to be in effect.
>
>Basically, the way it works is that the prerequisites on the rule that
>has the recipe come first, and any other prerequisites added by rules
>without recipes are added afterwards, in the order in which they appear
>in the makefile.
>

Excellent!  

This answers a question I've wondered about in the past.  

Might this be included as part of [Multiple Rules for One Target](https://www.gnu.org/software/make/manual/make.html#Multiple-Rules) documentation?

~ Malcolm

>-- 
>Paul D. Smith <mailto:[email protected]> Find some GNU make tips at:
>https://www.gnu.org http://make.mad-scientist.net
>"Please remain calm...I may be mad, but I am a professional." --Mad
>Scientist>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.