[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to generate rules from two lists ?
From: |
Paul Smith |
Subject: |
Re: How to generate rules from two lists ? |
Date: |
Wed, 26 Mar 2008 12:49:14 -0400 |
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 <address@hidden> http://make.mad-scientist.us
"Please remain calm--I may be mad, but I am a professional."--Mad Scientist