This is the mail archive of the
automake@gnu.org
mailing list for the automake project.
Re: Absolute directories for tests.
- From: Alexandre Duret-Lutz <duret_g at lrde dot epita dot fr>
- To: "Dr. David Kirkby" <drkirkby at ntlworld dot com>
- Cc: automake <automake at gnu dot org>
- Date: Wed, 08 Jan 2003 12:26:26 +0100
- Subject: Re: Absolute directories for tests.
- References: <3E193542.47AA8825@ntlworld.com>
>>> "David" == David Kirkby <drkirkby@ntlworld.com> 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