From: Ralf Wildenhues Date: Fri, 22 Aug 2008 11:19:04 +0000 (+0200) Subject: Fix rebuilding of removed subdir/Makefile.in files. X-Git-Tag: v1.10b~123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7456aefd1d03be416197986600242e994bd34546;p=thirdparty%2Fautomake.git 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/remake6.test: New tests. * tests/Makefile.am: Adjust. * NEWS, THANKS: Update. Report and initial patch by Ilya N. Golubev. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index cc540cd70..136668c4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-08-22 Ralf Wildenhues + + 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 * tests/notrans.test: Use multiple man files of each type. diff --git a/NEWS b/NEWS index 181ba05eb..bd1f369b8 100644 --- 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 3442ba044..20be34e18 100644 --- 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 diff --git a/doc/Makefile.in b/doc/Makefile.in index b5f1f42eb..e82c47e2c 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -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; \ diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in index 78f967040..a5a014a02 100644 --- a/lib/Automake/Makefile.in +++ b/lib/Automake/Makefile.in @@ -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; \ diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index 8d9cd996d..5cb486e51 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -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; \ diff --git a/lib/Makefile.in b/lib/Makefile.in index 9ec820988..2c0e7a08e 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -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; \ diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in index cf4a60496..9796e1011 100644 --- a/lib/am/Makefile.in +++ b/lib/am/Makefile.in @@ -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; \ diff --git a/lib/am/configure.am b/lib/am/configure.am index 879f837c6..4623f4148 100644 --- a/lib/am/configure.am +++ b/lib/am/configure.am @@ -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; \ diff --git a/m4/Makefile.in b/m4/Makefile.in index 75eb69d32..4a2504e5d 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -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; \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 45624affa..1e19657c2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -496,6 +496,8 @@ remake2.test \ remake3.test \ remake4.test \ remake5.test \ +remake6.test \ +remake7.test \ regex.test \ req.test \ reqd.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 766ab9d50..969a57bb0 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..b94dda393 --- /dev/null +++ b/tests/remake6.test @@ -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 . + +# 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 index 000000000..720728560 --- /dev/null +++ b/tests/remake7.test @@ -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 . + +# 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 +: