]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Fix rebuilding of removed subdir/Makefile.in files.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Fri, 22 Aug 2008 11:19:04 +0000 (13:19 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Fri, 22 Aug 2008 12:54:20 +0000 (14:54 +0200)
* lib/am/configure.am (%MAKEFILE-IN%) [?!TOPDIR_P?]: If
subdir/Makefile.in was removed, am--refresh would not update
it.  Fix up for it by running the per-directory rebuild rule.
* tests/remake6.test, tests/remake6.test: New tests.
* tests/Makefile.am: Adjust.
* NEWS, THANKS: Update.
Report and initial patch by Ilya N. Golubev.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
14 files changed:
ChangeLog
NEWS
THANKS
doc/Makefile.in
lib/Automake/Makefile.in
lib/Automake/tests/Makefile.in
lib/Makefile.in
lib/am/Makefile.in
lib/am/configure.am
m4/Makefile.in
tests/Makefile.am
tests/Makefile.in
tests/remake6.test [new file with mode: 0755]
tests/remake7.test [new file with mode: 0755]

index cc540cd707e45e1d780ff8965d3ad4b468c85ccb..136668c4c0d41ba306ce4d4e331b15aefedd3bbf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix rebuilding of removed subdir/Makefile.in files.
+       * lib/am/configure.am (%MAKEFILE-IN%) [?!TOPDIR_P?]: If
+       subdir/Makefile.in was removed, am--refresh would not update
+       it.  Fix up for it by running the per-directory rebuild rule.
+       * tests/remake6.test, tests/remake7.test: New tests.
+       * tests/Makefile.am: Adjust.
+       * NEWS, THANKS: Update.
+       Report and initial patch by Ilya N. Golubev.
+
 2008-08-19  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * tests/notrans.test: Use multiple man files of each type.
diff --git a/NEWS b/NEWS
index 181ba05eb04a0d970ab52105dad3e3f7d9834674..bd1f369b81f6c79f5d5e67bed829eb742c51853b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -55,6 +55,9 @@ New in 1.10a:
     stub rules.  This allows `make' to trigger a rerun of `aclocal'
     also if some previously needed macro file has been removed.
 
+  - Rebuild rules now also work for a removed `subdir/Makefile.in' in
+    an otherwise up to date tree.
+
   - The `color-tests' option causes colored test result output on terminals.
 
   - New prefix `notrans_' for manpages which should not be transformed
diff --git a/THANKS b/THANKS
index 3442ba044cce83726899e808d3274672598f4d01..20be34e185bad9fe2469b0f8f97f62d1380aad29 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -116,6 +116,7 @@ Harlan Stenn                Harlan.Stenn@pfcs.com
 He Li                  tippa000@yahoo.com
 Henrik Frystyk Nielsen frystyk@w3.org
 Ian Lance Taylor       ian@cygnus.com
+Ilya N. Golubev                gin@mo.msk.ru
 Imacat                 imacat@mail.imacat.idv.tw
 Inoue                  inoue@ainet.or.jp
 James Amundson         amundson@users.sourceforge.net
index b5f1f42ebdf97717ba59946b9869d258d3e06376..e82c47e2c0f9cc0ef0428403d58cde99568fd5e0 100644 (file)
@@ -208,8 +208,8 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
              exit 1;; \
          esac; \
        done; \
index 78f967040d71a3686ca90c1f4038a3dc3d36c73f..a5a014a021ec6688afe483f8e78f8546ae53868d 100644 (file)
@@ -237,8 +237,8 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
              exit 1;; \
          esac; \
        done; \
index 8d9cd996d692faa98d8e313f675768e126409c84..5cb486e5149dd3f1e8fc42f8c602e24f0f8ddec6 100644 (file)
@@ -165,8 +165,8 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
              exit 1;; \
          esac; \
        done; \
index 9ec820988a331a1d1f3841354e80f8ca10fe2339..2c0e7a08ebb13183389f40aabcc713ec50c25f0b 100644 (file)
@@ -213,8 +213,8 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
              exit 1;; \
          esac; \
        done; \
index cf4a60496c425d7c0df4b58dc7fcba95e63ebbb3..9796e1011b0e7457ae1a00570adea3fbd0f4b414 100644 (file)
@@ -204,8 +204,8 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
              exit 1;; \
          esac; \
        done; \
index 879f837c62815e473abbfef838d49c8b14a4bad0..4623f4148e017a2d8f2e31b8ecddaf401bb9a082 100644 (file)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007  Free Software
+## Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 2008  Free Software
 ## Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -41,8 +41,13 @@ endif %?TOPDIR_P%
            *$$dep*) \
 ?TOPDIR_P?           echo ' cd $(srcdir) && $(AUTOMAKE) --%STRICTNESS% %USE-DEPS%'; \
 ?TOPDIR_P?           cd $(srcdir) && $(AUTOMAKE) --%STRICTNESS% %USE-DEPS% \
-?!TOPDIR_P?          cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
+?TOPDIR_P?             && exit 0; \
+?!TOPDIR_P?          ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+## If on the other hand, subdir/Makefile.in has been removed, then toplevel
+## am--refresh will not be aware of any need to run.  We still invoke it
+## due to $? listing all prerequisites.  Fix up for it by running the rebuild
+## rule for this file only, below.
+?!TOPDIR_P?            && { if test -f $@; then exit 0; else break; fi; }; \
              exit 1;; \
          esac; \
        done; \
index 75eb69d32f35c09e10ac6e41061e4835ffd83562..4a2504e5d6a0d1e5d3180d6d73ccdf210e0af9e2 100644 (file)
@@ -201,8 +201,8 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
              exit 1;; \
          esac; \
        done; \
index 45624affae0da0e731a213e53a79b08a468a445b..1e19657c2a9c4b2b0c6f00739ef39839ebd27ff7 100644 (file)
@@ -496,6 +496,8 @@ remake2.test \
 remake3.test \
 remake4.test \
 remake5.test \
+remake6.test \
+remake7.test \
 regex.test \
 req.test \
 reqd.test \
index 766ab9d50d8e84942b6ca3dcdca74649132fec2c..969a57bb034e4c6c6645ec5a14b4afcc67856148 100644 (file)
@@ -647,6 +647,8 @@ remake2.test \
 remake3.test \
 remake4.test \
 remake5.test \
+remake6.test \
+remake7.test \
 regex.test \
 req.test \
 reqd.test \
@@ -803,8 +805,8 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
              exit 1;; \
          esac; \
        done; \
diff --git a/tests/remake6.test b/tests/remake6.test
new file mode 100755 (executable)
index 0000000..b94dda3
--- /dev/null
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 2008  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 3, 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 <http://www.gnu.org/licenses/>.
+
+# Make sure remaking rules work when subdir Makefile.in has been removed.
+
+. ./defs || exit 1
+set -e
+
+cat > configure.in << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_OUTPUT(Makefile sub/Makefile)
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+END
+mkdir sub
+: > sub/Makefile.am
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+./configure
+$MAKE
+
+# Now, we are set up.  Ensure that, for either missing Makefile.in,
+# or updated Makefile.am, rebuild rules are run, and run exactly once
+# only.
+
+rm -f Makefile.in
+$MAKE >stdout
+cat stdout
+test `grep -c " --run " stdout` -eq 1
+
+rm -f sub/Makefile.in
+$MAKE >stdout
+cat stdout
+test `grep -c " --run " stdout` -eq 1
+
+$sleep  # Let touched files appear newer.
+
+touch Makefile.am
+$MAKE >stdout
+cat stdout
+test `grep -c " --run " stdout` -eq 1
+
+touch sub/Makefile.am
+$MAKE >stdout
+cat stdout
+test `grep -c " --run " stdout` -eq 1
diff --git a/tests/remake7.test b/tests/remake7.test
new file mode 100755 (executable)
index 0000000..7207285
--- /dev/null
@@ -0,0 +1,70 @@
+#! /bin/sh
+# Copyright (C) 2008  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 3, 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 <http://www.gnu.org/licenses/>.
+
+# Make sure remaking rules fail when they should.
+
+. ./defs || exit 1
+set -e
+
+cat > configure.in << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_OUTPUT(Makefile sub/Makefile)
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+END
+mkdir sub
+: > sub/Makefile.am
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+./configure
+$MAKE
+
+$sleep
+
+# Fail for broken input files.
+
+echo "if FOO" > sub/Makefile.am
+$MAKE && exit 1
+
+: >sub/Makefile.am
+$MAKE
+
+mv Makefile.am backup
+echo "if FOO" > Makefile.am
+$MAKE && exit 1
+
+# Fail for missing input files, with or without missing
+# Makefile.in files.
+
+cp backup Makefile.am
+mv sub/Makefile.am sub/backup
+$MAKE && exit 1
+
+rm -f sub/Makefile.in
+$MAKE && exit 1
+
+mv sub/backup sub/Makefile.am
+rm -f Makefile.am
+$MAKE && exit 1
+
+rm -f Makefile.in
+$MAKE && exit 1
+: