From: Ralf Wildenhues Date: Mon, 11 Apr 2011 05:06:08 +0000 (+0200) Subject: Fix hp depmode for VPATH builds with GNU make. X-Git-Tag: v1.11.1b~29^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ae0d32e09b89de68955485fbc906202832f7d74;p=thirdparty%2Fautomake.git Fix hp depmode for VPATH builds with GNU make. * lib/depcomp: Be sure to remove VPATH-prefixed object from dependency output when creating stub rule. * tests/depcomp10.test: New test. * tests/Makefile.am (TESTS): Update. * NEWS: Update. Report by Bruno Haible. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index ea292223a..4ce4b8318 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-04-11 Ralf Wildenhues + + Fix hp depmode for VPATH builds with GNU make. + * lib/depcomp: Be sure to remove VPATH-prefixed object from + dependency output when creating stub rule. + * tests/depcomp10.test: New test. + * tests/Makefile.am (TESTS): Update. + * NEWS: Update. + Report by Bruno Haible. + 2011-04-10 Stefano Lattarini test defs: fix 'javac' requirement for older JDK versions diff --git a/NEWS b/NEWS index 3cd5ab079..c8219bd41 100644 --- a/NEWS +++ b/NEWS @@ -57,7 +57,7 @@ Bugs fixed in 1.11.0a: - The parallel-tests driver now does not produce erroneous results with Tru64/OSF 5.1 sh upon unreadable log files any more. - - The makedepend depmode now works better with VPATH builds. + - The makedepend and hp depmodes now works better with VPATH builds. - Java sources specified with check_JAVA are not compiled anymore upon "make all", but only upon "make check". diff --git a/lib/depcomp b/lib/depcomp index 8097c1930..e996e5d71 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -1,7 +1,7 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2011-04-09-11; # UTC +scriptversion=2011-04-11-05; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2011, # Free Software Foundation, Inc. @@ -158,10 +158,12 @@ gcc) ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as -## well. +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + sed -e 's/^\\$//' -e '/^$/d' -e -e "s|.*$object$||" '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; diff --git a/tests/Makefile.am b/tests/Makefile.am index bf07f2b0e..4e878050c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -278,6 +278,7 @@ depcomp7.test \ depcomp8a.test \ depcomp8b.test \ depcomp9.test \ +depcomp10.test \ depdist.test \ depend.test \ depend2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index d8bf050e7..991b3f062 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -548,6 +548,7 @@ depcomp7.test \ depcomp8a.test \ depcomp8b.test \ depcomp9.test \ +depcomp10.test \ depdist.test \ depend.test \ depend2.test \ diff --git a/tests/depcomp10.test b/tests/depcomp10.test new file mode 100644 index 000000000..4fdee406e --- /dev/null +++ b/tests/depcomp10.test @@ -0,0 +1,81 @@ +#! /bin/sh +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# hp depmode should work with GNU make in VPATH mode (bug similar to +# depcomp9.test). + +# Here's the bug: hp depmode will prefix VPATH to the object file name, +# thus the second gmake will invoke depcomp with object='../../src/foo.o', +# causing errors such as: +# cpp: "", line 0: error 4066: Cannot create "../../gllib/.deps/nonblocking.TPo" file for "-M../../gllib/.deps/nonblocking.TPo" option. (No such file or dir ++ectory[errno=2]) + +required=GNUmake +. ./defs || Exit 1 + +mkdir src src/sub build + +cat >> configure.in << 'END' +AC_PROG_CC +AM_PROG_CC_C_O +AC_CONFIG_FILES([src/Makefile]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +SUBDIRS = src +END + +cat > src/Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects +bin_PROGRAMS = foo +foo_SOURCES = foo.c foo.h sub/subfoo.c +END + +cat > src/foo.h <src/foo.c <src/sub/subfoo.c <out 2>&1 || { cat out; Exit 1; } +cat out +grep 'src/[._]deps' out && Exit 1 + +: