Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / subdir8.test
blob9ad4a5c617c63364b8e4716c8944c777b119e912
1 #! /bin/sh
2 # Copyright (C) 2003, 2004 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 3, or (at your option)
7 # any later version.
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.)
20 # PR automake/46
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 required='GNUmake gcc'
25 . ./defs || Exit 1
27 set -e
29 echo 'AC_CONFIG_FILES([sub/Makefile])' >confiles.m4
31 cat >> configure.in << 'END'
32 AC_PROG_CC
33 AM_PROG_CC_C_O
34 m4_include([confiles.m4])
35 MORE_DEFS
36 AC_OUTPUT
37 END
39 cat > Makefile.am << 'END'
40 SUBDIRS = sub
41 ACLOCAL_AMFLAGS = -I m4
42 END
44 mkdir sub
46 cat > sub/Makefile.am << 'END'
47 bin_PROGRAMS = wish
48 wish_SOURCES = a.c
49 END
51 cat > sub/a.c << 'END'
52 #include <stdio.h>
53 int main ()
55 printf ("hi liver!\n");
56 return 0;
58 END
60 mkdir m4
61 echo 'AC_DEFUN([MORE_DEFS], [])' > m4/moredefs.m4
63 $ACLOCAL -I m4
64 $AUTOCONF
65 $AUTOMAKE --copy --add-missing
66 ./configure
67 $MAKE
69 # Now add a new directory.
71 mkdir sub/maude
72 cat > sub/maude/Makefile.am << 'END'
73 include_HEADERS = foo.h
74 END
76 : > sub/maude/foo.h
78 echo 'SUBDIRS = maude' >> sub/Makefile.am
80 mkdir maude
81 : > maude/Makefile.am
83 # Update confile.m4 *after* updating sub/Makefile.am.
84 # (subdir5.test do it in the other way: it updates configure.in
85 # before Makefile.am)
86 echo 'AC_CONFIG_FILES([maude/Makefile sub/maude/Makefile])' >> confiles.m4
88 # We want a simple rebuild from sub/ to create sub/maude/Makefile
89 # and maude/Makefile automatically.
90 cd sub
91 $MAKE
92 cd ..
93 test -f maude/Makefile
94 test -f sub/maude/Makefile
96 # Make sure the dependencies of aclocal.m4 or honored at least from
97 # the top-level directory.
98 echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
99 $MAKE
100 grep GREPME Makefile
101 grep GREPME maude/Makefile
102 grep GREPME sub/Makefile
103 grep GREPME sub/maude/Makefile