Build and run in separate directory

Mike Alexander mta at umich.edu
Wed Feb 15 01:19:21 EST 2006


--On February 13, 2006 6:03:58 PM -0500 David Hampton 
<hampton-gnucash at rainbolthampton.net> wrote:

>> Index: intl-scm/Makefile.am
>> ===================================================================
>> --- intl-scm/Makefile.am	(revision 13074)
>> +++ intl-scm/Makefile.am	(working copy)
>> @@ -8,7 +8,7 @@
>>
>>  BUILT_SOURCES = guile-strings.c
>>
>> -SCMFILES = $(shell find ${top_srcdir}/src -name test -prune -o
>> -name  '*.scm' -print )
>> +SCMFILES = $(shell cd ${srcdir} && find ../src -name test -prune -o
>> -name '*.scm' -print )
>>
>>  # This needs to be generated in srcdir
>>  guile-strings.c: $(SCMFILES)
>
> I am unclear why this change has any effect.  What are the values of
> srcdir, top_srcdir, and top_builddir in intl-scm/Makefile.
>

That's the heart of the problem.  For the situation that causes 
problems they are

srcdir=../../../gnucash-1.9/intl-scm
top_srcdir=../../../gnucash-1.9
top_builddir=..

The cwd at the time is /tools/gnucash-1.9/build/darwin/intl-scm and all 
of these paths are relative to that directory.  The makefile builds a 
list of files relative to top_srcdir (while in 
/tools/gnucash-1.9/build/darwin/intl-scm), then cd's into srcdir and 
tries to use that list.  srcdir is 
/tools/gnucash-1.9/gnucash-1.9/intl-scm which is one level closer to 
the root than the directory where the list was constructed so the 
relative paths fail.

The original code produces a list that starts with

../../../gnucash-1.9/src/app-utils/app-utils.scm
../../../gnucash-1.9/src/app-utils/c-interface.scm
../../../gnucash-1.9/src/app-utils/config-var.scm

These are valid in /tools/gnucash-1.9/build/darwin/intl-scm where they 
were constructed, but not in /tools/gnucash-1.9/gnucash-1.9/intl-scm 
where they are used.

The changed code produces

../src/app-utils/app-utils.scm
../src/app-utils/c-interface.scm
../src/app-utils/config-var.scm

These are valid in /tools/gnucash-1.9/gnucash-1.9/intl-scm.  They are 
not valid in /tools/gnucash-1.9/build/darwin/intl-scm, but they aren't 
used there.

The list produced by the original code would also be correct if it had 
one less "../" on it since while you're in srcdir ../../gnucash-1.9/src 
is the same as ../src.

I hope this makes things somewhat more clear.  This isn't the only way 
to fix this, but it seemed reasonable.

-- 
Mike Alexander           mta at umich.edu
Ann Arbor, MI            PGP key ID: BEA343A6



More information about the gnucash-devel mailing list