Re: Automatically generate rules from a list variable

2008-10-24 Thread Sam Ravnborg
On Fri, Oct 24, 2008 at 07:13:36PM +0300, Andrei Deftu wrote: > On Fri, Oct 24, 2008 at 6:51 PM, Paul Smith <[EMAIL PROTECTED]> wrote: > > Why can't youjust use a normal pattern rule? Something like: > > > >%.cpp_o : %.cpp > ># bla bla > > > > ? > > Thanks but this rule ma

Re: Automatically generate rules from a list variable

2008-10-24 Thread Andrei Deftu
Thank you all. The problem is solved. Here is the template I was looking for: TARGETS := main1 main1_DEPENDS := modul1.cpp_o modul2.cpp_o SOURCES_CPP := modul1.cpp modul2.cpp main1.cpp modul1.cpp_DEPENDS := modul1.h modul2.cpp_DEPENDS := modul2.h OBJS_CPP := $(SOURCES_CPP:=_o) .SECONDEXPANSIO

Re: Automatically generate rules from a list variable

2008-10-24 Thread Paul Smith
On Fri, 2008-10-24 at 12:51 -0400, Mike Shal wrote: > > > Thanks but this rule matches every .cpp_o files and I want it to match > > > only the files from LIST. > Or you could use static patterns: Static patterns are unquestionably the right thing to use here. While more advanced capabilities

Re: Automatically generate rules from a list variable

2008-10-24 Thread Mike Shal
On 10/24/08, Greg Chicares <[EMAIL PROTECTED]> wrote: > On 2008-10-24 16:13Z, Andrei Deftu wrote: > > On Fri, Oct 24, 2008 at 6:51 PM, Paul Smith <[EMAIL PROTECTED]> wrote: > >> Why can't youjust use a normal pattern rule? Something like: > >> > >>%.cpp_o : %.cpp > >>#

Re: Automatically generate rules from a list variable

2008-10-24 Thread Boris Godin
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. Goodlu

Automatically generate rules from a list variable

2008-10-24 Thread Andrei Deftu
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:%=

Re: Automatically generate rules from a list variable

2008-10-24 Thread Greg Chicares
On 2008-10-24 16:13Z, Andrei Deftu wrote: > On Fri, Oct 24, 2008 at 6:51 PM, Paul Smith <[EMAIL PROTECTED]> wrote: >> Why can't youjust use a normal pattern rule? Something like: >> >>%.cpp_o : %.cpp >># bla bla >> >> ? > > Thanks but this rule matches every .cpp_o files a

Re: Automatically generate rules from a list variable

2008-10-24 Thread Andrei Deftu
On Fri, Oct 24, 2008 at 6:51 PM, Paul Smith <[EMAIL PROTECTED]> wrote: > Why can't youjust use a normal pattern rule? Something like: > >%.cpp_o : %.cpp ># bla bla > > ? Thanks but this rule matches every .cpp_o files and I want it to match only the files from LIST. e.g.:

Re: Automatically generate rules from a list variable

2008-10-24 Thread Paul Smith
On Fri, 2008-10-24 at 18:45 +0300, Andrei Deftu wrote: > 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 ># bl

Automatically generate rules from a list variable

2008-10-24 Thread Andrei Deftu
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