httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Reid" <ab...@dial.pipex.com>
Subject Re: Makefile suggestions?
Date Fri, 08 Oct 1999 09:46:54 GMT
The VPATH works like a dream and makes it very easy to do what I had in
mind.  Thanks for the hint!

david

----- Original Message -----
From: <tvaughan@aventail.com>
To: <new-httpd@apache.org>
Sent: 07 October 1999 22:49
Subject: Re: Makefile suggestions?


> "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