2 # Copyright (C) 2003, 2004, 2009, 2010, 2011 Free Software Foundation,
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Test to make sure that adding a new directory works, even from
19 # subdirectories. (subdir5.test makes sure it works when make
20 # is run from the top-level directory.)
23 # This test assumes that the `make' utility is able to start
24 # over and reload Makefiles which have been remade (a non-POSIX feature).
25 # See also the related test subdir5.test.
26 required='GNUmake gcc'
31 cat >> configure.in << 'END'
34 m4_include([confiles.m4])
39 echo 'AC_CONFIG_FILES([sub/Makefile])' > confiles.m4
41 cat > Makefile.am << 'END'
43 ACLOCAL_AMFLAGS = -I m4
48 cat > sub/Makefile.am << 'END'
53 cat > sub/a.c << 'END'
57 printf ("hi liver!\n");
63 echo 'AC_DEFUN([MORE_DEFS], [])' > m4/moredefs.m4
67 $AUTOMAKE --copy --add-missing
71 # Now add new directories.
73 # The first step users typically do when adding a new subdir is
74 # editing configure.in. That is already tested by subdir5.test,
75 # though, so here we try to just edit a file that is included by
76 # configure.in, without touching configure.in itself.
79 cat > sub/maude/Makefile.am << 'END'
80 include_HEADERS = foo.h
85 echo 'SUBDIRS = maude' >> sub/Makefile.am
90 # Update confiles.m4 *after* updating sub/Makefile.am; subdir5.test do
91 # it in the other way: it updates configure.in before Makefile.am.
92 # We sleep here because modified configure dependencies must be newer
95 echo 'AC_CONFIG_FILES([maude/Makefile sub/maude/Makefile])' >> confiles.m4
97 # We want a simple rebuild from sub/ to create sub/maude/Makefile
98 # and maude/Makefile automatically.
102 grep '^SUBDIRS = *maude *$' sub/Makefile.in
103 grep '^SUBDIRS = *maude *$' sub/Makefile
104 test -f maude/Makefile
105 test -f sub/maude/Makefile
107 # Make sure the dependencies of aclocal.m4 or honored at least from
108 # the top-level directory.
109 echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
112 for ext in '.in' ''; do
113 for d in . maude sub sub/maude; do
114 grep '^GREPME =' $d/Makefile$ext