automake
[Top][All Lists]
Advanced

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

Re: Absolute directories for tests.


From: Alexandre Duret-Lutz
Subject: Re: Absolute directories for tests.
Date: Wed, 08 Jan 2003 12:26:26 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu)

>>> "David" == David Kirkby <address@hidden> writes:

[...]

 David> The problem is that if run from the 'tests' directory, this runs okay,
 David> as the paths given in the test '../tools/src/mycksum' and
 David> '../examples/cop1.bmp' are correct relative to that 'tests' directory.
 David> However, if 'make distcheck' is run from the top directory of the
 David> package, the tests fails as those paths are wrong. 

To account for VPATH-builds, you should consider that sources files
lie in `$srcdir', not `.'.  Only built files are in the current directory.

The above two paths are probably better written
`$srcdir/../tools/src/mycksum' and '$srcdir/../examples/cop1.bmp'.

$(srcdir) is defined as a Make variable in each Makefile.  It is
also exported as an environment variable to each test run as
part of an Automake-style testsuite.

 David> Am I doing something fundamentally flawed? If not, is there a way of
 David> referring to the top level directory, so that for example $TOP/tests
 David> and $TOP/examples always point to the same directory, no matter where
 David> they are run from?

Makefiles define $(top_srcdir), but this isn't exported to
tests.  Probably because nobody needed that yet.

To answer your subject, there is no garanty that either
$(srcdir) or $(top_srcdir) are absolute or relative, they can be
either.  Autoconf has recently started to substitute
@abs_srcdir@ and @abs_top_srcdir@ (they do not get defined as
Makefile variables, but you could do this yourself), however
generally it's better to avoid using absolute paths.
-- 
Alexandre Duret-Lutz





reply via email to

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