[Top][All Lists]

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

Re: Copy files in VPATH build

From: Ralf Wildenhues
Subject: Re: Copy files in VPATH build
Date: Sun, 31 Oct 2010 10:20:47 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

* Paul J. Davis wrote on Sun, Oct 31, 2010 at 12:10:01AM CEST:
> On Oct 30, 2010, at 5:17 PM, Jason Curl <address@hidden> wrote:
> > When building my package with "./configure" everything works well as
> > some datafiles that are required for tests are in the correct place
> > (my tests don't need to be installed with "make install"). However,
> > when I use VPATH builds with "../configure", I don't know how to get
> > my data files copied from the source to the current build path.
> > 
> > I've just read up on VPATH, and I think gmake is assuming, that
> > while the datafiles are in the source, the dependencies are
> > satisfied, even though they aren't in the build directory.
> > 
> > The following rules don't work:

Right.  If @srcdir@ is '.', then GNU make will error out here
(non-GNU make would destroy your data, except that it will barf over the
use of $< outside of inference rules first).

> > test.ini: @srcdir@/test.ini
> >  cp $< $@
> > 
> > ./test.ini: @srcdir@/test.ini
> >  cp $< $@
> > 
> > But the rule:
> > test2.ini: @srcdir@/test.ini
> >  cp $< $@
> > 
> > does work, but I don't need to rename the file in the copy, and when
> > not using VPATH, it just performs a useless copy.

Correct as well.

> The only thing I've way I've overcome this is to have a test runner
> that gets built by configure so it can have access to both the build
> and source directory paths.

Good idea.

An alternative can be to use AC_CONFIG_LINKS with identical source and
target name for files: the link-or-copy will the only be made if in a
VPATH build.  You need Autoconf >= 2.62 and Automake >= 1.11 for this to
work correctly (please set AC_PREREQ and Automake Option to this end,
because the older versions had bugs that could cause source file
removal.)  Please report any remaining bugs.

Hope that helps.


reply via email to

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