help-make
[Top][All Lists]
Advanced

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

How to generate rules from two lists ?


From: Christophe LYON
Subject: How to generate rules from two lists ?
Date: Wed, 26 Mar 2008 16:58:13 +0100
User-agent: Thunderbird 2.0.0.12 (X11/20080213)

Hi all,

I would like to generate rules from two lists. Currently, I use only one list, then I call repetitively a "generating" variable, like in the following example:

   deps = gcc binutils newlib

   generate = $(1): $(addprefix $(1)-, $(deps))

   $(call generate, configure)
   $(call generate, all)
   $(call generate, install)

I would like to automatize this process, so I tried this kind of code:

   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)


Thanks,

Christophe.




reply via email to

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