autoconf
[Top][All Lists]
Advanced

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

Re: $srcdir


From: Philip Willoughby
Subject: Re: $srcdir
Date: Wed, 5 Mar 2003 21:16:04 +0000 (GMT)

Today, Dr. David Kirkby wrote:

>I'm sorry I don't really know if this is an automake issue or an
>autoconf one, so please excuse the posting to both groups. I'm
>confused just how to best refer to files and in particular the use of
>$srcdir, which I assumed refereed to the directory 'src' below the top
>directory of a package, but seems to be undefined when I try to use
>it. Putting 'echo $srcdir' in a test script, just echoes a blank line,
>with no directory information.

I think this is right - no doubt someone will correct me if not ;-).

$srcdir refers to the directory containing the input Makefile the Makefile
you're looking at it from was generated from.  Let me try explaining that
again....

If you have the following structure:

.
.
.
./Makefile.in
./src/Makefile.in
.
.
.

and then you make a build dir and run configure in it you'll have:

.
.
.
./Makefile
./src/Makefile
../Makefile.in
../src/Makefile.in
.
.
.

In which case at the top level $srcdir will be set to ../ and in the src
dir it will be set to ../../src/

Of course, most people don't use separate build directories, and thus
$srcdir is left empty - you don't need to see files in a separate
directory in this case.

Anyway, you probably want to use $top_srcdir, which is the root of the
original package - thus if you need to refer to the src directory in the
source area you should use $top_srcdir/src/.  Think carefully though - if
you want to refer to a built component you should use $top_builddir instead
of $top_srcdir, or everyone who uses separate build directories as standard
(in other words, me ;-)) will be very annoyed...

Regards,

Philip Willoughby

Systems Programmer, Department of Computing, Imperial College, London, UK
-- 
echo address@hidden | tr "bizndfohces" "pwgd9ociaku"

Why reinvent the wheel? . . . . . . . . . Because we can make it rounder...




reply via email to

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