Well, really simple. Let's increase complexity: suppose I have few different source lists and compiled object should be placed in different directories (we need 2 rules obviously? dir3/subdir3/%.o and dir4/subdir4/%.o) Those source lists MAY contain files that have equal file names. How could I use VPATH in this case? Of course, I'll try to figure out this by learning make docs, but probably your advice will be much faster and simpler.
Thanks a lot, Dmitry -----Original Message----- From: Paul Smith [mailto:[EMAIL PROTECTED] On Behalf Of Paul D. Smith Sent: Friday, April 07, 2006 8:16 PM To: Smirnov Dmitry Cc: [email protected] Subject: RE: Make: Filtering prerequisites %% "Smirnov Dmitry" <[EMAIL PROTECTED]> writes: sd> But the idea I'm trying to implement is simple: sd> Suppose I'm having the list of source files. These files can be located sd> anywhere. sd> All I need is to compile each source file and place the result (.o) into sd> some specific directory. sd> (let's suppose sources have different file names, i.e. there no sd> dir1/file1 and dir2/file1) If that's true then there's a very simple solution: use VPATH. Write your makefile like this: SOURCES = ... VPATH = $(sort $(dir $(SOURCES))) dir3/subdir3/%.o : %.c $(CC) $(CFLAGS) -c -o $@ $< All done! sd> Unfortunately, I cannot upgrade to 3.81 since it is a company sd> policy now to use 3.80. But probably I could try to convince sd> others that we need 3.81. Well there are a number of bugs in 3.80 that are fixed in 3.81. But you may not need any of the newer 3.81 features for what you want to do. -- ------------------------------------------------------------------------ ------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://make.paulandlesley.org "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
