2 # Copyright (C) 2003, 2004, 2009, 2010 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Test to make sure that adding a new directory works, even from
18 # subdirectories. (subdir5.test makes sure it works when make
19 # is run from the top-level directory.)
22 # This test assumes that the `make' utility is able to start
23 # over and reload Makefiles which have been remade (a non-POSIX feature).
24 # See also the related test subdir5.test.
25 required
='GNUmake gcc'
30 cat >> configure.
in << 'END'
33 m4_include
([confiles.
m4])
38 echo 'AC_CONFIG_FILES([sub/Makefile])' > confiles.
m4
40 cat > Makefile.am
<< 'END'
42 ACLOCAL_AMFLAGS
= -I m4
47 cat > sub
/Makefile.am
<< 'END'
52 cat > sub
/a.c
<< 'END'
56 printf ("hi liver!\n");
62 echo 'AC_DEFUN([MORE_DEFS], [])' > m
4/moredefs.
m4
66 $AUTOMAKE --copy --add-missing
70 # Now add new directories.
72 # We shouldn't need to $sleep here: configure ensures that files
73 # generated by it are newer than configure. Thus, even if
74 # Makefile.in is newer than configure but the updated Makefile.am
75 # below has the same timestamp as Makefile.in, the latter should
76 # be rebuilt due to its dependency on configure.in.
78 # The first step users typically do when adding a new subdir is
79 # editing configure.in. That is already tested by subdir5.test,
80 # though, so here we try to just edit a file that is included by
81 # configure.in, without touching configure.in itself.
84 cat > sub
/maude
/Makefile.am
<< 'END'
85 include_HEADERS
= foo.h
90 echo 'SUBDIRS = maude' >> sub
/Makefile.am
95 # Update confiles.m4 *after* updating sub/Makefile.am; subdir5.test do
96 # it in the other way: it updates configure.in before Makefile.am.
97 echo 'AC_CONFIG_FILES([maude/Makefile sub/maude/Makefile])' >> confiles.
m4
99 # We want a simple rebuild from sub/ to create sub/maude/Makefile
100 # and maude/Makefile automatically.
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])])' > m
4/moredefs.
m4
112 grep '^GREPME =' Makefile
113 grep '^GREPME =' maude
/Makefile
114 grep '^GREPME =' sub
/Makefile
115 grep '^GREPME =' sub
/maude
/Makefile