1) On alphaev7-dec-osf5.1b, pr401.test fails like this in the last part of the test (subdir-objects, Test using LIBOBJS from parent directory, the distcheck part from testSubDir/pr401-1.0/_build):
| configure: creating ./config.status | config.status: creating Makefile | config.status: executing depfiles commands | Make: Don't know how to make ./lib/feep.o. Stop. | *** Exit 1 | Stop. | FAIL: ../../automake-1.9a/tests/pr401.test Similarly pr401c (pr401b was SKIPped due to non-installed Libtool). This is because that `make' knows how to build `lib/feep.o', but not `./lib/feep.o' from the VPATH source. The prefix comes from LIBOBJDIR. The patch below fixes that by not adding `$(top_builddir)/' if that is `./', as is also done in rewrite_inputs_into_dependencies, for example. 2) But there is another bug lingering here: handle_LIBOBJS_or_ALLOCA returns $dir _always_ unprefixed; that is then used to compute $depfiles. So if you have a src/Makefile.am with subdir-objects, and reference to LIBOBJS, then there will be a spurious extra tree, like this: testSubDir lib [.deps may exist or not] sub2 lib .deps Eww. ;-) To fix this, we need to munge a bit in _AM_OUTPUT_DEPENDENCY_COMMANDS so that `am__include $(top_builddir)/...' will also be understood correctly. Note here that it seems necessary to go to lengths to extract top_builddir, because by the time `config.status' instantiates depfiles, the value of $ac_top_build_prefix will be `.', which is not what we need. (Maybe Autoconf should help out here? Dunno; the way I did surely is expensive, as it adds a fork per Makefile, to fix a corner case.) 3) To add to this, when above is fixed, we enter PR 373: distclean will try to remove $top_builddir/lib/.deps from all Makefiles where LIBOBJS is referenced, thus if there is more than one such Makefile, second try will fail, as that Makefile will still try to include that .deps file. (Note that the issue in (2) is still serious: there may be an unrelated build tree part below sub2/lib.) 4) [EMAIL PROTECTED]@ ...$(top_builddir)/..' may later be helpful anyway: if we're ever going to allow user-provided dependency mechanisms.. but since I don't consider this set in stone, it's IMHO better not to document it now. OK to apply the patch below, which fixes failures (1) and (2), and updates pr401 to expose (2), and the bug I made first when forgetting the change to m4/depout.m4? (Note that one could also replicate the algorithm used by Autoconf to compute top_builddir from $mf in depout.m4; also note that I intend to propose a complete rewrite of depout.m4 soon, including fixing some bugs in it along the way, and making it faster.) Cheers, Ralf * automake.in (handle_LIBOBJS_or_ALLOCA): With subdir-objects, do not prefix `$(top_builddir)/' aka `./' to nonempty LIBOBJDIR, to help BSD Make find the files also in a VPATH build. Also return the same path, possibly prefixed, for correct depdir computation. * m4/depout.m4 (_AM_OUTPUT_DEPENDENCY_COMMANDS): Extract `top_builddir' from Makefile as well, use it to replace `$(top_builddir)', for depdir computation. * tests/pr401.test: Update to expose wrong depdir computation. * tests/pr401b.test, tests/pr401c.test: Likewise. Index: automake.in =================================================================== RCS file: /cvs/automake/automake/automake.in,v retrieving revision 1.1621 diff -u -r1.1621 automake.in --- automake.in 9 Apr 2006 07:46:55 -0000 1.1621 +++ automake.in 6 May 2006 14:49:05 -0000 @@ -2175,7 +2175,15 @@ { if (option 'subdir-objects') { - define_variable ('LIBOBJDIR', "\$(top_builddir)/$dir", INTERNAL); + # In the top-level Makefile we do not use $(top_builddir), because + # we are already there, and since the targets are built without + # a $(top_builddir), it helps BSD Make to match them with + # dependencies. + if ($relative_dir ne '.') + { + $dir = '$(top_builddir)/' . $dir; + } + define_variable ('LIBOBJDIR', "$dir", INTERNAL); $clean_files{"\$($var)"} = MOSTLY_CLEAN; # If LTLIBOBJS is used, we must also clear LIBOBJS (which might # be created by libtool as a side-effect of creating LTLIBOBJS). Index: m4/depout.m4 =================================================================== RCS file: /cvs/automake/automake/m4/depout.m4,v retrieving revision 1.18 diff -u -r1.18 depout.m4 --- m4/depout.m4 9 Jan 2005 14:46:21 -0000 1.18 +++ m4/depout.m4 6 May 2006 15:50:53 -0000 @@ -26,13 +26,15 @@ else continue fi - # Extract the definition of DEPDIR, am__include, and am__quote + # Extract the definition of DEPDIR, am__include, am__quote, and top_builddir # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + am__top_builddir=`sed -n 's/^top_builddir = //p' < "$mf"` + test -z "am__top_builddir" && am__top_builddir=. # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with @@ -41,7 +43,8 @@ # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g' \ + -e 's&\$(top_builddir)&'"$am__top_builddir"'&g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` Index: tests/pr401.test =================================================================== RCS file: /cvs/automake/automake/tests/pr401.test,v retrieving revision 1.2 diff -u -r1.2 pr401.test --- tests/pr401.test 14 May 2005 20:28:55 -0000 1.2 +++ tests/pr401.test 4 May 2006 17:23:56 -0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2005 Free Software Foundation, Inc. +# Copyright (C) 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -117,6 +117,8 @@ $AUTOCONF $AUTOMAKE --add-missing ./configure +test ! -d src/lib +test ! -d 'src/$(top_builddir)' $MAKE $MAKE check $MAKE distclean Index: tests/pr401b.test =================================================================== RCS file: /cvs/automake/automake/tests/pr401b.test,v retrieving revision 1.2 diff -u -r1.2 pr401b.test --- tests/pr401b.test 14 May 2005 20:28:55 -0000 1.2 +++ tests/pr401b.test 4 May 2006 17:23:00 -0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2005 Free Software Foundation, Inc. +# Copyright (C) 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -118,6 +118,8 @@ $AUTOCONF $AUTOMAKE --add-missing ./configure +test ! -d src/lib +test ! -d 'src/$(top_builddir)' $MAKE $MAKE check $MAKE distclean Index: tests/pr401c.test =================================================================== RCS file: /cvs/automake/automake/tests/pr401c.test,v retrieving revision 1.2 diff -u -r1.2 pr401c.test --- tests/pr401c.test 14 May 2005 20:28:55 -0000 1.2 +++ tests/pr401c.test 4 May 2006 17:23:00 -0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2005 Free Software Foundation, Inc. +# Copyright (C) 2005, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -120,6 +120,8 @@ $AUTOMAKE --add-missing ./configure $MAKE +test ! -d src/lib +test ! -d 'src/$(top_builddir)' $MAKE check $MAKE distclean