httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvaug...@aventail.com
Subject Re: Makefile suggestions?
Date Thu, 07 Oct 1999 21:49:53 GMT
"David Reid" <abb37@dial.pipex.com> writes:

> I'm sure that most of you will know more about this than me, and will be
> able to answer this easily..
> 
> What I want to do is to setup the Makefiles in the beos directories to act
> as follows...
> 
> a)  look for the source file in the beos directory,
> b)  if it's not there compile the one from the unix directory.
> 
> Makefiles aren't a particular area of expertise for me, but I've got a
> solution.  It's ugly and I'm sure that someone out there will have a better,
> more elegant way of doing it.
> 
> I'm starting by looking at the src/lib/apr/misc/beos sub directory, which
> has only 2 files,  start.c and getopt.c.  getopt.c is identical to the one
> in the unix directory so I'd like it to compile that one and remove the
> version in the beos directory.

>From GNU make's info page:

<info>
`VPATH': Search Path for All Dependencies
-----------------------------------------

   The value of the `make' variable `VPATH' specifies a list of
directories that `make' should search.  Most often, the directories are
expected to contain dependency files that are not in the current
directory; however, `VPATH' specifies a search list that `make' applies
for all files, including files which are targets of rules.

   Thus, if a file that is listed as a target or dependency does not
exist in the current directory, `make' searches the directories listed
in `VPATH' for a file with that name.  If a file is found in one of
them, that file may become the dependency (see below).  Rules may then
specify the names of files in the dependency list as if they all
existed in the current directory.  *Note Writing Shell Commands with
Directory Search: Commands/Search.

   In the `VPATH' variable, directory names are separated by colons or
blanks.  The order in which directories are listed is the order followed
by `make' in its search.  (On MS-DOS and MS-Windows, semi-colons are
used as separators of directory names in `VPATH', since the colon can
be used in the pathname itself, after the drive letter.)

   For example,

     VPATH = src:../headers

specifies a path containing two directories, `src' and `../headers',
which `make' searches in that order.

   With this value of `VPATH', the following rule,

     foo.o : foo.c

is interpreted as if it were written like this:

     foo.o : src/foo.c

assuming the file `foo.c' does not exist in the current directory but
is found in the directory `src'.
</info>

But to support shadow builds, you'll need to do something like:

        VPATH = $(srcdir)/src:$(srcdir)/../headers

-Tom

-- 
Tom Vaughan <tvaughan at aventail dot com>

Mime
View raw message