]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Dependency bug fix
authorTom Tromey <tromey@redhat.com>
Sun, 22 Sep 1996 20:42:37 +0000 (20:42 +0000)
committerTom Tromey <tromey@redhat.com>
Sun, 22 Sep 1996 20:42:37 +0000 (20:42 +0000)
TODO
automake.in
tests/ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/depend2.test [new file with mode: 0755]

diff --git a/TODO b/TODO
index 89aad9c7e1e66bf0a9a7ce6e9fae82d8777e7cfa..dc38bad7eafdb2ad78027d48fced57c9bcef4093 100644 (file)
--- a/TODO
+++ b/TODO
@@ -3,8 +3,6 @@ Priorities for release:
 
 must move CONFIG_HEADER from tags.am... allow it to work in subdir.
 
-if @...@ substitution in _PROGRAMS, then require EXTRA_PROGRAMS!
-
 take diff-n-query code from libit
 
 must at least partially rewrite dist system (to handle distributing
index 9905c4ad93c55862efbee27cdc4f6af3e70c506c..35535431ffe7682744d284e8469801b8064b8464 100755 (executable)
@@ -1731,16 +1731,24 @@ sub scan_dependency_file
     local ($target, @dependencies);
     local ($one_dep, $xform);
 
-    local ($srcdir_rx, $fixup_rx, $fixup2_rx);
-    ($srcdir_rx = $srcdir_name) =~ s/(\W)/\\$1/g;
-
+    local ($srcdir_rx, $fixup_rx);
     # If the top srcdir is absolute, then the current directory is
-    # just relative_dir.
-    ($fixup_rx = $srcdir_name . '/' . $relative_dir . '/') =~ s/(\W)/\\$1/g;
-
-    # But if the top srcdir is relative, then we need some dots first.
-    ($fixup2_rx = ($srcdir_name . '/' . $top_builddir . '/'
-                  . $relative_dir . '/')) =~ s/(\W)/\\$1/g;
+    # just relative_dir.  But if the top srcdir is relative, then we
+    # need to add some dots first.  The same holds when matching
+    # srcdir directly.
+    if ($srcdir_name =~ /^\//)
+    {
+       ($fixup_rx = $srcdir_name . '/' . $relative_dir . '/')
+           =~ s/(\W)/\\$1/g;
+       ($srcdir_rx = $srcdir_name) =~ s/(\W)/\\$1/g;
+    }
+    else
+    {
+       ($fixup_rx = ($srcdir_name . '/' . $top_builddir . '/'
+                     . $relative_dir . '/')) =~ s/(\W)/\\$1/g;
+       ($srcdir_rx = ($srcdir_name . '/' . $top_builddir))
+           =~ s/(\W)/\\$1/g;
+    }
 
     while (<DEP_FILE>)
     {
@@ -1783,13 +1791,6 @@ sub scan_dependency_file
                ($xform = $one_dep) =~ s/^$fixup_rx//;
                push (@dependencies, $xform);
            }
-           elsif ($one_dep =~ /^$fixup2_rx/)
-           {
-               # The dependency points to the current directory in
-               # some way.
-               ($xform = $one_dep) =~ s/^$fixup2_rx//;
-               push (@dependencies, $xform);
-           }
            elsif ($one_dep =~ /^$srcdir_rx\//)
            {
                # The dependency is in some other directory in the package.
index a82e7d0523c1a1d7f2e1b18c90b0b5243a0dfb92..ca3b493adc56289edca557c1cb4b61df9ce79af1 100644 (file)
@@ -1,3 +1,7 @@
+Sun Sep 22 14:42:09 1996  Tom Tromey  <tromey@creche.cygnus.com>
+
+       * depend2.test: New file.
+
 Sat Sep 21 14:01:10 1996  Tom Tromey  <tromey@creche.cygnus.com>
 
        * primary2.test: New file.
index 87886b7986d9341fff102c1fd708d0af1e806ed2..ad66088670a962f2fe8a9c7fcb7855ec5e559696 100644 (file)
@@ -15,6 +15,6 @@ man.test info.test obsolete.test lex.test scripts.test subdir2.test \
 exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \
 order.test libobj2.test interp.test alllib.test block.test libobj3.test \
 gnits.test interp2.test colneq.test implicit.test spell.test spell2.test \
-confsub.test primary.test primary2.test
+confsub.test primary.test primary2.test depend2.test
 
 EXTRA_DIST = defs $(TESTS)
index 8b65426e72a1a9e04f07b208c68b50ae8849edb0..64f91d4ac6cb008a1dd0cbb28797238996cca5fc 100644 (file)
@@ -53,7 +53,7 @@ man.test info.test obsolete.test lex.test scripts.test subdir2.test \
 exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \
 order.test libobj2.test interp.test alllib.test block.test libobj3.test \
 gnits.test interp2.test colneq.test implicit.test spell.test spell2.test \
-confsub.test primary.test primary2.test
+confsub.test primary.test primary2.test depend2.test
 
 EXTRA_DIST = defs $(TESTS)
 mkinstalldirs = $(top_srcdir)/mkinstalldirs
diff --git a/tests/depend2.test b/tests/depend2.test
new file mode 100755 (executable)
index 0000000..410ac1c
--- /dev/null
@@ -0,0 +1,68 @@
+#! /bin/sh
+
+# Test that automatically generated dependencies are correctly
+# rewritten into distribution Makefiles.  This test is set up to look
+# like a C program was built in a subdir of the distribution.
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+PACKAGE=nonesuch
+VERSION=nonesuch
+AC_ARG_PROGRAM
+AC_PROG_MAKE_SET
+AM_PROG_INSTALL
+AC_OUTPUT(Makefile src/Makefile)
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = src
+END
+
+mkdir src
+cat > src/Makefile.am << 'END'
+bin_PROGRAMS = copyin
+END
+
+: > src/copyin.c
+
+mkdir build
+mkdir build/src
+mkdir build/src/.deps
+
+: > build/src/.deps/.P
+
+cat > build/src/.deps/copyin.P << 'END'
+copyin.o: ../../src/copyin.c ../config.h /usr/include/stdio.h \
+ /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/libio.h \
+ /usr/local/lib/gcc-lib/i586-unknown-linuxaout/cygnus-2.7.1-951112/../../../../i586-unknown-linuxaout/include/_G_config.h \
+ /usr/include/sys/types.h /usr/include/linux/types.h \
+ /usr/include/asm/types.h /usr/include/sys/stat.h \
+ /usr/include/linux/stat.h ../../lib/filetypes.h ../../src/system.h \
+ /usr/include/string.h \
+ /usr/local/lib/gcc-lib/i586-unknown-linuxaout/cygnus-2.7.1-951112/include/stddef.h \
+ /usr/include/time.h /usr/include/stdlib.h /usr/include/errno.h \
+ /usr/include/linux/errno.h \
+ /usr/local/lib/gcc-lib/i586-unknown-linuxaout/cygnus-2.7.1-951112/include/float.h \
+ /usr/include/alloca.h /usr/include/unistd.h /usr/include/posix_opt.h \
+ /usr/include/gnu/types.h /usr/include/confname.h \
+ /usr/include/sys/sysmacros.h /usr/include/fcntl.h \
+ /usr/include/linux/fcntl.h /usr/include/utime.h \
+ /usr/include/linux/utime.h /usr/include/dirent.h \
+ /usr/include/linux/limits.h /usr/include/linux/dirent.h \
+ /usr/include/posix1_lim.h ../../src/cpiohdr.h ../../src/cpio.h \
+ ../../src/extern.h \
+ /usr/local/lib/gcc-lib/i586-unknown-linuxaout/cygnus-2.7.1-951112/../../../../include/libintl.h \
+ /usr/include/locale.h ../../lib/ansidecl.h ../../lib/dstring.h \
+ ../../lib/error.h ../../src/defer.h ../../src/rmt.h \
+ ../../lib/fnmatch.h
+END
+
+mkdir outdir
+
+$AUTOMAKE --include-deps --build-dir=`pwd`/build --srcdir-name=.. \
+   --output-dir=`pwd`/outdir || exit 1
+
+# The buggy output contains this string.
+fgrep '../../lib/filetypes.h' outdir/src/Makefile.in && exit 1
+exit 0