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

2023-10-02 Thread Mark Piffer
For the sake of reliability I wouldn't use pure `$<` anywhere. And if the answer to your question "Which one, listed in another rule, becomes $: > > > On 9/27/23 17:01, Mark Piffer wrote: > > Is there a case (common or rare) where the answer to this question has > real world consequences? > > Yes,

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

2023-10-02 Thread Paul Smith
On Mon, 2023-10-02 at 09:06 +0200, Mark Piffer wrote: > For the sake of reliability I wouldn't use pure `$<` anywhere. I'm not sure what you mean by "reliability" (I'm not aware of any change to the behavior of $< in the 30+ year history of GNU make) and I don't know what you mean by "pure $<"; wh

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

2023-10-02 Thread Bahman Movaqar
On Mon, 2023-10-02 at 09:08 -0400, Paul Smith wrote: > The behavior is straightforward: when make parses a rule _without_ a > recipe, it will append new prerequisites to the END of its targets' > list of prerequisites. > > When make parses an explicit rule that _has_ a recipe, then those > prerequ

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

2023-10-02 Thread Paul Smith
On Mon, 2023-10-02 at 11:48 -0700, Bahman Movaqar wrote: > my-target : foo > my-target : > @echo 'my-target: $$(<) is $(<)' This is an unusual way to construct this rule. Normally it would be: my-target : foo @echo 'my-target: $$< is $<' whereupon the value of $< is reliab

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

2023-10-02 Thread Bahman Movaqar
On Mon, 2023-10-02 at 14:56 -0400, Paul Smith wrote: > On Mon, 2023-10-02 at 11:48 -0700, Bahman Movaqar wrote: > > my-target : foo > > my-target : > > @echo 'my-target: $$(<) is $(<)' > > This is an unusual way to construct this rule.  Normally it would be: > >   my-target : foo >   

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

2023-10-02 Thread Paul Smith
On Mon, 2023-10-02 at 12:00 -0700, Bahman Movaqar wrote: > Thanks for the hint re style.  Finding good examples of writing easy- > to-read make files is no easy feat.  That's why I do have these > inaccuracies in my personal style. I should say that the original method you posted is unusual IF YOU

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

2023-10-02 Thread Bahman Movaqar
On Mon, 2023-10-02 at 15:14 -0400, Paul Smith wrote: > You should put the "important" prerequisite, if one exists, on the rule > containing the recipe.  If that rule doesn't list any prerequisites, > you are effectively saying that none of the prerequisites is special > and they are all interchange