help-make
[Top][All Lists]
Advanced

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

RE: Make: Filtering prerequisites


From: Paul D. Smith
Subject: RE: Make: Filtering prerequisites
Date: Fri, 7 Apr 2006 12:15:49 -0400

%% "Smirnov Dmitry" <address@hidden> 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 <address@hidden>          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




reply via email to

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