automake
[Top][All Lists]
Advanced

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

Re: Copy files in VPATH build


From: Jason Curl
Subject: Re: Copy files in VPATH build
Date: Sun, 31 Oct 2010 13:09:13 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

On 31/10/2010 10:20, Ralf Wildenhues wrote:
* 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 $<  $@

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.

It's unfortunate that I can't use this functionality, one of my build machines is still ubuntu 8.04 and this still has autoconf 2.61 and automake 1.10.1.

I've implemented a shell script to do the copies for me based on a phony rule (moving the check out of make and into a script). Tested for VPATH and non-VPATH. It allows me to keep all changes local to the directory where the tests are made. The phony rules are a dependency to "all-local" so they get copied at the end of the process. I didn't use myprog_DEPENDENCIES as this would cause a link

e.g.
Makefile.am

all-local: cpreadini cpoptionini

cpreadini:
    @srcdir@/cpfiles.sh @srcdir@/read.ini ./read.ini

cpoptionini:
    @srcdir@/cpfiles.sh @srcdir@/option1.ini ./option1.ini
    @srcdir@/cpfiles.sh @srcdir@/option2.ini ./option2.ini

.PHONY: cpreadini cpoptionini

Feedback welcome.

Thanks for your help Ralf & Paul.
Jason.

Attachment: cpfiles.sh
Description: Text document


reply via email to

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