help-make
[Top][All Lists]
Advanced

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

Re: Deferred expansion and computed rules and rant about make bug


From: DaleWKing
Subject: Re: Deferred expansion and computed rules and rant about make bug
Date: Fri, 05 Aug 2005 17:55:46 +0000

> On 8/4/05, Dale King <address@hidden> wrote:
> > So I am looking for another workaround to the issue. I thought perhaps
> > target-specific variables might do it, but haven't gotten it to work.
> 
> First: is the second "standard include file" supposed to be the same
> as the first? It looks to me like the output you want is:
> 
> 123
> 789

Yes.

> Second, when you tried target-specific variables, did you use the :=
> instead of = ? This seems to work fine for me:

Yes, target-specific and pattern-specific variables were the answer I was
looking for. I didn't have time to figure out what was wrong with my first
attempt at target specific variables before sending the message.

It should probably be documented the way these type of variables are evaluated
in section 3.9 of the make manual.



> # The main make file
> targets :=
> 
> all: do-targets
> 
> # This comes from an included file for a
> foo := a
> target := abc
> flags := 123
> 
> # This comes from a standard include file
> $(target): flags:=$(flags)
> $(target):
>         @echo "$@ has flags: $(flags)"
> targets += $(target)
> 
> # This comes from an included file for b
> foo := b
> target := xyz
> flags := 789
> 
> # This comes from a standard include file
> $(target): flags:=$(flags)
> targets += $(target)
> $(target):
>         @echo "$@ has flags: $(flags)"
> 
> # this is back to the main include file
> do-targets: $(targets)
> 
> ### EOF ###
> 
> The only changes are to your standard include file. I get the output
> of '123' and '789' using make 3.79.1 and make 3.80. Note that if you
> want to use more variables than just $(flags) in your command script,
> you need a line to set each one.
> 
> Hope this helps,
> -Mike




reply via email to

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