On Wed, 2008-03-26 at 16:58 +0100, Christophe LYON wrote:
>     targets = configure all install
>     deps    = gcc binutils newlib
> 
>     generate = $(1): $(addprefix $(1)-, $(deps))
> 
>     $(foreach target, $(targets), $(call generate, $(target)))
> 
> However, the last line is not expanded as I expected (error "multiple 
> target patterns").
> 
> I *do* understand why (all rules are generated on a single line), but
> is there a way to do what I want? (not especially with the function
> foreach)

You have to use eval:

  $(foreach target,$(targets),$(eval $(call generate,$(target))))

If your rules get much more complex, beware issues around escaping inner
variables (in the generate value).

-- 
-----------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>                 http://make.mad-scientist.us
 "Please remain calm--I may be mad, but I am a professional."--Mad Scientist




_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to