You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by tv...@aventail.com on 1999/10/07 23:49:53 UTC

Re: Makefile suggestions?

"David Reid" <ab...@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>

Re: Makefile suggestions?

Posted by David Reid <ab...@dial.pipex.com>.
In fact I'm not sure that it's an issue for BSD.  VPATH won't be needed for
the unix makefile, and the only time it would apply would be if there were a
BSD specific directory added (unlikely).

I guess the issue is how many platforms will have their own directories and
how many will need the VPATH functionality.

david
----- Original Message -----
From: Jens-Uwe Mager <ju...@helios.de>
To: <ne...@apache.org>
Sent: 08 October 1999 12:54
Subject: Re: Makefile suggestions?


> On Fri, Oct 08, 1999 at 07:07:00AM -0400, Jim Jagielski wrote:
> > IIRC it's a GNUmake "exclusive". It's certainly not in most BSD (4.4)
> > makes.
> >
> > I'd prefer we not have to force people to use gmake.
> >
> > David Reid wrote:
> > >
> > > Just how non-portable is VPATH?
> > >
> > > d.
>
> It is from the System V make. But it is so useful that I cannot believe
> the BSD folks don't do it.
>
> --
> Jens-Uwe Mager
>
> HELIOS Software GmbH
> Steinriede 3
> 30827 Garbsen
> Germany
>
> Phone: +49 5131 709320
> FAX: +49 5131 709325
> Internet: jum@helios.de


Re: Makefile suggestions?

Posted by Ben Laurie <be...@algroup.co.uk>.
Jens-Uwe Mager wrote:
> 
> On Fri, Oct 08, 1999 at 07:07:00AM -0400, Jim Jagielski wrote:
> > IIRC it's a GNUmake "exclusive". It's certainly not in most BSD (4.4)
> > makes.
> >
> > I'd prefer we not have to force people to use gmake.
> >
> > David Reid wrote:
> > >
> > > Just how non-portable is VPATH?
> > >
> > > d.
> 
> It is from the System V make. But it is so useful that I cannot believe
> the BSD folks don't do it.

Believe it.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

Re: Makefile suggestions?

Posted by Tony Finch <do...@dotat.at>.
Jens-Uwe Mager <ju...@helios.de> wrote:
>Jim Jagielski wrote:
>>David Reid wrote:
>>> 
>>> Just how non-portable is VPATH?
>>
>> IIRC it's a GNUmake "exclusive". It's certainly not in most BSD (4.4)
>> makes. I'd prefer we not have to force people to use gmake.

+1

>It is from the System V make. But it is so useful that I cannot believe
>the BSD folks don't do it.

PMake has the .PATH pseudo-target instead.

Tony.
-- 
f.a.n.finch    dot@dotat.at    fanf@demon.net

Re: Makefile suggestions?

Posted by Jens-Uwe Mager <ju...@helios.de>.
On Fri, Oct 08, 1999 at 07:07:00AM -0400, Jim Jagielski wrote:
> IIRC it's a GNUmake "exclusive". It's certainly not in most BSD (4.4)
> makes.
> 
> I'd prefer we not have to force people to use gmake.
> 
> David Reid wrote:
> > 
> > Just how non-portable is VPATH?
> > 
> > d.

It is from the System V make. But it is so useful that I cannot believe
the BSD folks don't do it.

-- 
Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:		+49 5131 709320
FAX:		+49 5131 709325
Internet:	jum@helios.de

Re: Makefile suggestions?

Posted by David Reid <ab...@dial.pipex.com>.
Just how non-portable is VPATH?

d.
----- Original Message -----
From: Ben Laurie <be...@algroup.co.uk>
To: <ne...@apache.org>
Sent: 08 October 1999 10:54
Subject: Re: Makefile suggestions?


> tvaughan@aventail.com wrote:
> >
> > "David Reid" <ab...@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
>
> Sweet, but non-portable.
>
> Cheers,
>
> Ben.
>
> --
> http://www.apache-ssl.org/ben.html
>
> "My grandfather once told me that there are two kinds of people: those
> who work and those who take the credit. He told me to try to be in the
> first group; there was less competition there."
>      - Indira Gandhi


Re: Makefile suggestions?

Posted by Ben Laurie <be...@algroup.co.uk>.
tvaughan@aventail.com wrote:
> 
> "David Reid" <ab...@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

Sweet, but non-portable.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

Re: Makefile suggestions?

Posted by David Reid <ab...@dial.pipex.com>.
I'll try to explain what I'm aiming at and see if it makes sense to you, the
viewing public!

The VPATH isn't that important as there are other ways round it, but I
always like neat and tidy solutions, not messy horrible ones.

What I'd like is that when we have a new platform being added to APR they
look at the unix code then go from there.

e.g. The new platform can use almost all of the network code but need a
different poll (for some weird reason).  They simply have to create a
directory alongside unix, create their poll.c file, add a Makefile.in (that
can be copied from A.N.Other directory) and alter configure.in to reflect
the fact that they have their directory.

This is neat, clean and incredibly quick/easy to do.  It keeps the
directories clean and allows people to easily track what will need looked at
when getting code up to date.  I appreciate what Brian and the others are
saying and I don't want to make life difficult.  If a platform HAS to have
the dependencies then it can have Brian's solution, if it doesn't need them
then it could use VPATH.  I think both are viable options that solve the
issue.

david
----- Original Message -----
From: Brian Havard <br...@kheldar.apana.org.au>
To: <ne...@apache.org>
Sent: 08 October 1999 14:48
Subject: Re: Makefile suggestions?


> On Fri, 8 Oct 1999 10:46:54 +0100, David Reid wrote:
>
> >The VPATH works like a dream and makes it very easy to do what I had in
> >mind.  Thanks for the hint!
>
> I just tried this technique (for the OS/2 time directory) and it works
fine
> for me apart from one hitch, "make depend" doesn't work and I can see any
> easy work-around.
>
> On the other hand, using my suggestion of having a source file that just
> #includes the unix source works just fine with make depend and doesn't
depend
> on any special make voodoo.
>
> --
>
____________________________________________________________________________
__
>  |  Brian Havard                 |  "He is not the messiah!
|
>  |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of
Brian |
>  -------------------------------------------------------------------------
-----
>


Re: Makefile suggestions?

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On Fri, 8 Oct 1999 10:46:54 +0100, David Reid wrote:

>The VPATH works like a dream and makes it very easy to do what I had in
>mind.  Thanks for the hint!

I just tried this technique (for the OS/2 time directory) and it works fine
for me apart from one hitch, "make depend" doesn't work and I can see any
easy work-around.

On the other hand, using my suggestion of having a source file that just
#includes the unix source works just fine with make depend and doesn't depend
on any special make voodoo.

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Re: Makefile suggestions?

Posted by David Reid <ab...@dial.pipex.com>.
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: <tv...@aventail.com>
To: <ne...@apache.org>
Sent: 07 October 1999 22:49
Subject: Re: Makefile suggestions?


> "David Reid" <ab...@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>