]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
For automake PR/46:
authorAlexandre Duret-Lutz <adl@gnu.org>
Thu, 24 Apr 2003 18:33:42 +0000 (18:33 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Thu, 24 Apr 2003 18:33:42 +0000 (18:33 +0000)
* lib/am/configure.am (%MAKEFILE-IN%): If Makefile.in is rebuilt
because of one of configure's dependencies, run automake without
argument to update the whole tree at once.  Depend upon
%CONFIGURE_DEPS%.
(%MAKEFILE%): If Makefile is rebuilt because config.status has
been updated, run config.status without arguments.
* automake.in (scan_autoconf_traces): Prepend $(top_srcdir)
before all files in @configure_deps.
* tests/subdir5.test: Modernize configure.in, make sure
maude/Makefile was actually created, and exercise %CONFIGURE_DEPS%.
* tests/subdir8.test: New file.
* tests/Makefile.am (TESTS): Add subdir8.test.
(XFAIL_TESTS): Replace subdir5.test by subdir8.test.

13 files changed:
ChangeLog
Makefile.in
automake.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/subdir5.test
tests/subdir8.test [new file with mode: 0755]

index 9bbe0f7f2c8ff9bd426672e69b4e8d336935568f..17f04c81a0446fdd8dc0109d1fd567c678530a0a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2003-04-24  Akim Demaille  <akim@epita.fr>
+           Alexandre Duret-Lutz  <adl@gnu.org>
+
+       For automake PR/46:
+       * lib/am/configure.am (%MAKEFILE-IN%): If Makefile.in is rebuilt
+       because of one of configure's dependencies, run automake without
+       argument to update the whole tree at once.  Depend upon
+       %CONFIGURE_DEPS%.
+       (%MAKEFILE%): If Makefile is rebuilt because config.status has
+       been updated, run config.status without arguments.
+       * automake.in (scan_autoconf_traces): Prepend $(top_srcdir)
+       before all files in @configure_deps.
+       * tests/subdir5.test: Modernize configure.in, make sure
+       maude/Makefile was actually created, and exercise %CONFIGURE_DEPS%.
+       * tests/subdir8.test: New file.
+       * tests/Makefile.am (TESTS): Add subdir8.test.
+       (XFAIL_TESTS): Replace subdir5.test by subdir8.test.
+
 2003-04-23  Alexandre Duret-Lutz  <adl@gnu.org>
 
        * automake.texi (Requirements): Typo in index
index 8ba170fe6273f4d305234602f763dc7e013456ba..37de4025e0582ffa9a11ff8baad42054dfc5a357 100644 (file)
@@ -181,11 +181,27 @@ all: all-recursive
 
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+       @for dep in $?; do \
+         case '$(top_srcdir)/configure.in $(ACLOCAL_M4) ' in \
+           *$$dep*) \
+             echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(top_srcdir) && $(AUTOMAKE) --gnu ; \
+             exit 0;; \
+         esac; \
+       done; \
+        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
        cd $(top_srcdir) && \
          $(AUTOMAKE) --gnu  Makefile
 Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-       cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
+       @case '$?' in \
+         *config.status*) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status'; \
+           cd $(top_builddir) && $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+       esac;
 
 $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
        $(SHELL) ./config.status --recheck
index dd7c55d7a77e9f08a6bee3fd08c53f939c691810..5a536a84b2bfca1b3bcc5f1decc4f0611b3f1e43 100755 (executable)
@@ -5358,7 +5358,7 @@ sub scan_autoconf_traces ($)
          # m4_include's performed during Autoconf's startup.
          # Obviously we don't want to distribute Autoconf's files
          # so we skip absolute filenames here.
-         push @configure_deps, $args[1]
+         push @configure_deps, '$(top_srcdir)/' . $args[1]
            unless $here =~ m,^(?:\w:)?[\\/],;
        }
    }
index 0a3700bf2bceb33845bf11fbc12166ce95b3d682..226870c6ad66ac40d32bd851673679b39bd79878 100644 (file)
@@ -134,11 +134,27 @@ dist_perllib_DATA = \
 all: all-recursive
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+       @for dep in $?; do \
+         case '$(top_srcdir)/configure.in $(ACLOCAL_M4) ' in \
+           *$$dep*) \
+             echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(top_srcdir) && $(AUTOMAKE) --gnu ; \
+             exit 0;; \
+         esac; \
+       done; \
+        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  lib/Automake/Makefile'; \
        cd $(top_srcdir) && \
          $(AUTOMAKE) --gnu  lib/Automake/Makefile
 Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+       @case '$?' in \
+         *config.status*) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status'; \
+           cd $(top_builddir) && $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
 uninstall-info-am:
 dist_perllibDATA_INSTALL = $(INSTALL_DATA)
 install-dist_perllibDATA: $(dist_perllib_DATA)
index 9aa67222e80d3fab6e6e0939309ae5d9eaeb1cff..52ab779d1b886fddf1199f365eebd026e0a908d8 100644 (file)
@@ -114,11 +114,27 @@ EXTRA_DIST = $(TESTS)
 all: all-am
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+       @for dep in $?; do \
+         case '$(top_srcdir)/configure.in $(ACLOCAL_M4) ' in \
+           *$$dep*) \
+             echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(top_srcdir) && $(AUTOMAKE) --gnu ; \
+             exit 0;; \
+         esac; \
+       done; \
+        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  lib/Automake/tests/Makefile'; \
        cd $(top_srcdir) && \
          $(AUTOMAKE) --gnu  lib/Automake/tests/Makefile
 Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+       @case '$?' in \
+         *config.status*) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status'; \
+           cd $(top_builddir) && $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
 uninstall-info-am:
 tags: TAGS
 TAGS:
index 784a337a0098a617ed888498f00614cebff61227..e376b5ce0fac31d56bdc44ab405cf00fd26c40a2 100644 (file)
@@ -132,11 +132,27 @@ mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile
 all: all-recursive
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+       @for dep in $?; do \
+         case '$(top_srcdir)/configure.in $(ACLOCAL_M4) ' in \
+           *$$dep*) \
+             echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(top_srcdir) && $(AUTOMAKE) --gnu ; \
+             exit 0;; \
+         esac; \
+       done; \
+        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  lib/Makefile'; \
        cd $(top_srcdir) && \
          $(AUTOMAKE) --gnu  lib/Makefile
 Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+       @case '$?' in \
+         *config.status*) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status'; \
+           cd $(top_builddir) && $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
 uninstall-info-am:
 dist_pkgvdataDATA_INSTALL = $(INSTALL_DATA)
 install-dist_pkgvdataDATA: $(dist_pkgvdata_DATA)
index e1c26674e1dd17a2e0a1a970629df59a04ee7182..b76ad01c872db25e103a33b6166b9f65812e92f4 100644 (file)
@@ -120,11 +120,27 @@ texinfos.am yacc.am
 all: all-am
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+       @for dep in $?; do \
+         case '$(top_srcdir)/configure.in $(ACLOCAL_M4) ' in \
+           *$$dep*) \
+             echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(top_srcdir) && $(AUTOMAKE) --gnu ; \
+             exit 0;; \
+         esac; \
+       done; \
+        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  lib/am/Makefile'; \
        cd $(top_srcdir) && \
          $(AUTOMAKE) --gnu  lib/am/Makefile
 Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+       @case '$?' in \
+         *config.status*) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status'; \
+           cd $(top_builddir) && $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
 uninstall-info-am:
 dist_amDATA_INSTALL = $(INSTALL_DATA)
 install-dist_amDATA: $(dist_am_DATA)
index fe53b48fb9f7004a4d1b7b80266c15ae6eb5c89f..cb265f3f1887ac1204e21c1d1119fb862176661e 100644 (file)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright 2001
+## Copyright (C) 2001, 2002, 2003
 ## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
 ## --------------------- ##
 
 ## This rule remakes the Makefile.in.
-%MAKEFILE-IN%: %MAINTAINER-MODE% %MAKEFILE-AM% %MAKEFILE-IN-DEPS% $(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4)
+%MAKEFILE-IN%: %MAINTAINER-MODE% %MAKEFILE-AM% %MAKEFILE-IN-DEPS% $(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) %CONFIGURE_DEPS%
+## If configure.ac or one of configure's dependencies has changed, all
+## Makefile.in are to be updated; it is then more efficient to run
+## automake on all the Makefiles at once.  It also allow Automake to be
+## run for newly added directories.
+       @for dep in $?; do \
+         case '$(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) %CONFIGURE_DEPS%' in \
+           *$$dep*) \
+             echo ' cd $(top_srcdir) && $(AUTOMAKE) --%STRICTNESS% %USE-DEPS%'; \
+             cd $(top_srcdir) && $(AUTOMAKE) --%STRICTNESS% %USE-DEPS%; \
+             exit 0;; \
+         esac; \
+       done; \
+## Otherwise, rebuild only this file.
+        echo ' cd $(top_srcdir) && $(AUTOMAKE) --%STRICTNESS% %USE-DEPS% %MAKEFILE-AM-SOURCES%'; \
        cd $(top_srcdir) && \
          $(AUTOMAKE) --%STRICTNESS% %USE-DEPS% %MAKEFILE-AM-SOURCES%
 
 ## This rule remakes the Makefile.
 %MAKEFILE%: %MAINTAINER-MODE% %MAKEFILE-IN% %MAKEFILE-DEPS% $(top_builddir)/config.status
+## If Makefile is to be updated because of config.status, then run
+## config.status without argument in order to (i) rerun all the
+## AC_CONFIG_COMMANDS including those that are not visible to
+## Automake, and (ii) to save time by running config.status all with
+## all the files, instead of once per file (iii) generate Makefiles
+## in newly added directories.
+       @case '$?' in \
+## Don't prefix $(top_builddir), because GNU make will strip it out
+## when it's `.'.
+         *config.status*) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status'; \
+           cd $(top_builddir) && $(SHELL) ./config.status;; \
+         *) \
 ## FIXME: $(am__depfiles_maybe) lets us re-run the rule to create the
 ## .P files.  Ideally we wouldn't have to do this by hand.
-       cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__depfiles_maybe)
-
-
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__depfiles_maybe);; \
+       esac;
 
 ## --------------------------- ##
 ## config.status & configure.  ##
index 360f8a03894acc9900f387155ff25216191ee958..64a198123e37afe21523ee5049fbba7e28c795f6 100644 (file)
@@ -147,11 +147,27 @@ EXTRA_DIST = dirlist
 all: all-am
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+       @for dep in $?; do \
+         case '$(top_srcdir)/configure.in $(ACLOCAL_M4) ' in \
+           *$$dep*) \
+             echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(top_srcdir) && $(AUTOMAKE) --gnu ; \
+             exit 0;; \
+         esac; \
+       done; \
+        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  m4/Makefile'; \
        cd $(top_srcdir) && \
          $(AUTOMAKE) --gnu  m4/Makefile
 Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+       @case '$?' in \
+         *config.status*) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status'; \
+           cd $(top_builddir) && $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
 amversion.m4: $(top_builddir)/config.status amversion.in
        cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 uninstall-info-am:
index cd0426f1ca093ee406d4cc7e4081707e0be6e1e1..14783df5f22f59353f2b4bfa9fd1f5165439d115 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 
-XFAIL_TESTS = subdir5.test auxdir2.test cond17.test txinfo5.test
+XFAIL_TESTS = subdir8.test auxdir2.test cond17.test txinfo5.test
 
 TESTS =        \
 acinclude.test \
@@ -383,6 +383,7 @@ subdir4.test \
 subdir5.test \
 subdir6.test \
 subdir7.test \
+subdir8.test \
 subdirbuiltsources.test \
 subcond.test \
 subcond2.test \
index c2a218ceee47acec397033deb4e008d7d24a55f0..12472b215aed871d4e38741e55d4077eb3f1ac29 100644 (file)
@@ -104,7 +104,7 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
-XFAIL_TESTS = subdir5.test auxdir2.test cond17.test txinfo5.test
+XFAIL_TESTS = subdir8.test auxdir2.test cond17.test txinfo5.test
 TESTS = \
 acinclude.test \
 aclibobj.test \
@@ -486,6 +486,7 @@ subdir4.test \
 subdir5.test \
 subdir6.test \
 subdir7.test \
+subdir8.test \
 subdirbuiltsources.test \
 subcond.test \
 subcond2.test \
@@ -578,11 +579,27 @@ check_SCRIPTS = defs
 all: all-am
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+       @for dep in $?; do \
+         case '$(top_srcdir)/configure.in $(ACLOCAL_M4) ' in \
+           *$$dep*) \
+             echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(top_srcdir) && $(AUTOMAKE) --gnu ; \
+             exit 0;; \
+         esac; \
+       done; \
+        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  tests/Makefile'; \
        cd $(top_srcdir) && \
          $(AUTOMAKE) --gnu  tests/Makefile
 Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+       @case '$?' in \
+         *config.status*) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status'; \
+           cd $(top_builddir) && $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
 defs: $(top_builddir)/config.status defs.in
        cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 uninstall-info-am:
index 038b111fb938fd22916d6bcfa9f66823e2859132..ddcc1d548db86e6091223f9d1af69bc0bb040ce0 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -19,6 +19,8 @@
 # Boston, MA 02111-1307, USA.
 
 # Test to make sure that adding a new directory works.
+# This test runs `make' from the top-level directory, subdir8.test
+# do it from a subdirectory.
 # PR automake/46
 
 # This test assumes that the `make' utility is able to start
 required='GNUmake gcc'
 . ./defs || exit 1
 
+set -e
+
 cat > configure.in << 'END'
-AC_INIT(a.c)
-AM_INIT_AUTOMAKE(maude, 1.0)
+AC_INIT(maude, 1.0)
+AM_INIT_AUTOMAKE
 AM_PROG_CC_C_O
 AC_PROG_CC
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES(Makefile)
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -48,8 +53,6 @@ int main ()
 }
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --include-deps --copy --add-missing
@@ -58,13 +61,17 @@ $MAKE
 
 # Now add a new directory.
 cat > configure.in << 'END'
-AC_INIT(a.c)
-AM_INIT_AUTOMAKE(maude, 1.0)
+AC_INIT(maude, 1.0)
+AM_INIT_AUTOMAKE
 AM_PROG_CC_C_O
 AC_PROG_CC
-AC_OUTPUT(Makefile maude/Makefile)
+AC_CONFIG_FILES(Makefile maude/Makefile)
+m4_include([confile.m4])
+AC_OUTPUT
 END
 
+: > confile.m4
+
 mkdir maude
 cat > maude/Makefile.am << 'END'
 include_HEADERS = foo.h
@@ -76,3 +83,17 @@ echo 'SUBDIRS = maude' >> Makefile.am
 
 # We want a simple rebuild to create maude/Makefile automatically.
 $MAKE
+test -f maude/Makefile
+
+# Add yet another directory
+mkdir maude2
+echo 'AC_CONFIG_FILES([maude2/Makefile])AC_SUBST([GREPME])' > confile.m4
+: > maude2/Makefile.am
+echo 'SUBDIRS += maude2' >> Makefile.am
+
+# We want a simple rebuild to create maude2/Makefile and update
+# all other Makefiles automatically.
+$MAKE
+grep GREPME Makefile
+grep GREPME maude/Makefile
+grep GREPME maude2/Makefile
diff --git a/tests/subdir8.test b/tests/subdir8.test
new file mode 100755 (executable)
index 0000000..9ef7219
--- /dev/null
@@ -0,0 +1,91 @@
+#! /bin/sh
+# Copyright (C) 2003  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test to make sure that adding a new directory works, even from
+# subdirectories.  (subdir5.test makes sure it works when make
+# is run from the top-level directory.)
+# PR automake/46
+
+# This test assumes that the `make' utility is able to start
+# over and reload Makefiles which have been remade (a non-POSIX feature).
+required='GNUmake gcc'
+. ./defs || exit 1
+
+set -e
+
+echo 'AC_CONFIG_FILES([sub/Makefile])' >confiles.m4
+
+cat >> configure.in << 'END'
+AM_PROG_CC_C_O
+AC_PROG_CC
+m4_include([confiles.m4])
+AC_OUTPUT
+END
+
+echo 'SUBDIRS = sub' > Makefile.am
+
+mkdir sub
+
+cat > sub/Makefile.am << 'END'
+bin_PROGRAMS = wish
+wish_SOURCES = a.c
+END
+
+cat > sub/a.c << 'END'
+#include <stdio.h>
+int main ()
+{
+   printf ("hi liver!\n");
+   return 0;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --copy --add-missing
+./configure
+$MAKE
+
+# Now add a new directory.
+
+mkdir sub/maude
+cat > sub/maude/Makefile.am << 'END'
+include_HEADERS = foo.h
+END
+
+: > sub/maude/foo.h
+
+echo 'SUBDIRS = maude' >> sub/Makefile.am
+
+mkdir maude
+: > maude/Makefile.am
+
+# Update confile.m4 *after* updating sub/Makefile.am.
+# (subdir5.test do it in the other way: it updates configure.in
+# before Makefile.am)
+echo 'AC_CONFIG_FILES([maude/Makefile sub/maude/Makefile])' >> confiles.m4
+
+# We want a simple rebuild from sub/ to create sub/maude/Makefile
+# and maude/Makefile automatically.
+cd sub
+$MAKE
+cd ..
+test -f maude/Makefile
+test -f sub/maude/Makefile