2 # Copyright (C) 2001, 2002, 2003, 2004, 2009, 2010, 2011 Free Software
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.
19 # This test runs `make' from the top-level directory, subdir8.test
20 # do it from a subdirectory.
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 subdir8.test.
26 required='GNUmake gcc'
31 cat >> configure.in << 'END'
37 cat > Makefile.am << 'END'
46 printf ("hi liver!\n");
53 $AUTOMAKE --include-deps --copy --add-missing
57 # Now add new directories.
59 # First we add a new directory by modifying configure.in directly.
60 # We update configure.in *before* updating sub/Makefile.am; subdir8.test
61 # does it in the other way: it updates confiles.m4 (which is m4_included
62 # by configure.in there) after Makefile.am.
64 # Modified configure dependencies must be newer than config.status.
66 sed <configure.in >configure.tmp -e '/^AC_OUTPUT$/i\
67 AC_CONFIG_FILES([maude/Makefile])\
68 m4_include([confile.m4])\
69 ' # last newline required by older OpenBSD sed
70 mv -f configure.tmp configure.in
72 cat configure.in # might be useful for debugging
78 cat > maude/Makefile.am << 'END'
79 include_HEADERS = foo.h
84 echo 'SUBDIRS = maude' >> Makefile.am
86 # We want a simple rebuild to create maude/Makefile automatically.
88 grep '^SUBDIRS = *maude *$' Makefile.in
89 grep '^SUBDIRS = *maude *$' Makefile
90 test -f maude/Makefile
92 # Then we add a new directory by modifying a file included (through
93 # `m4_include') by configure.in.
95 # Modified configure dependencies must be newer than config.status.
97 cat >> confile.m4 << 'END'
98 AC_CONFIG_FILES([maude2/Makefile])
101 : > maude2/Makefile.am
102 echo 'SUBDIRS += maude2' >> Makefile.am
104 # We want a simple rebuild to create maude2/Makefile and update
105 # all other Makefiles automatically.
107 grep '^SUBDIRS =.* maude2' Makefile.in
108 grep '^SUBDIRS =.* maude2' Makefile
110 for ext in '.in' ''; do
111 for d in . maude maude2; do
112 grep '^GREPME =' $d/Makefile$ext