help-make
[Top][All Lists]
Advanced

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

Re: Automatically generate rules from a list variable


From: Boris Godin
Subject: Re: Automatically generate rules from a list variable
Date: Fri, 24 Oct 2008 14:28:11 -0200
User-agent: Thunderbird 2.0.0.17 (Windows/20080914)

Try this:

LIST = file1.cpp file2.cpp file3.cpp
define CHOSEN_CPP
$(1)_o: $(1)
    @gcc -c $$< -o $$@
    # or whatever you do (see "define" to understand expansion)
endef

$(foreach FILE,$(LIST), \
  $(eval $(call CHOSEN_CPP,$(FILE)))


I think this should "make" it, although didn't test it.
Goodluck.

Andrei Deftu wrote:
Hi!

I have the following scenario

LIST := file1.cpp file2.cpp file3.cpp

and I want to generate these rules

file1.cpp_o: file1.cpp
       # bla bla
file2.cpp_o: file1.cpp
       # bla bla
file2.cpp_o: file1.cpp
       # bla bla

but I want to write only a single rule for this, like:
$(LIST:%=%_o): $(@:%_o=%)
       # bla bla

The problem is that this is not valid and I don't know how to write a
rule for a list that expands to a rule for every element of the list
and each of this rule must have as a target and as a dependency the
current element of the list. Thanks.


_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make

  

--
Boris Godin
Java Developer - Gameloft COR
Paraná 560, Nueva Córdoba (CP 5000)
Tel.: (+54 0351) 460 26 26 int. 111
MSN:
address@hidden

reply via email to

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