From ff85960623073046a09c808ae9469c6f83d28f47 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 22 Sep 1996 20:42:35 +0000 Subject: [PATCH] Dependency bug fix --- TODO | 2 -- automake.in | 33 +++++++++++----------- tests/ChangeLog | 4 +++ tests/Makefile.am | 2 +- tests/Makefile.in | 2 +- tests/depend2.test | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 91 insertions(+), 20 deletions(-) create mode 100755 tests/depend2.test diff --git a/TODO b/TODO index 89aad9c7..dc38bad7 100644 --- 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 diff --git a/automake.in b/automake.in index 9905c4ad..35535431 100755 --- a/automake.in +++ b/automake.in @@ -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 () { @@ -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. diff --git a/tests/ChangeLog b/tests/ChangeLog index a82e7d05..ca3b493a 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +Sun Sep 22 14:42:09 1996 Tom Tromey + + * depend2.test: New file. + Sat Sep 21 14:01:10 1996 Tom Tromey * primary2.test: New file. diff --git a/tests/Makefile.am b/tests/Makefile.am index 87886b79..ad660886 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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) diff --git a/tests/Makefile.in b/tests/Makefile.in index 8b65426e..64f91d4a 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 00000000..410ac1c4 --- /dev/null +++ b/tests/depend2.test @@ -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 -- 2.43.5