source: trunk/essentials/sys-devel/automake-1.9/tests/subdir8.test

Last change on this file was 3086, checked in by bird, 18 years ago

automake 1.9.6

File size: 2.6 KB
Line 
1#! /bin/sh
2# Copyright (C) 2003 Free Software Foundation, Inc.
3#
4# This file is part of GNU Automake.
5#
6# GNU Automake is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10#
11# GNU Automake is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with Automake; see the file COPYING. If not, write to
18# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19# Boston, MA 02110-1301, USA.
20
21# Test to make sure that adding a new directory works, even from
22# subdirectories. (subdir5.test makes sure it works when make
23# is run from the top-level directory.)
24# PR automake/46
25
26# This test assumes that the `make' utility is able to start
27# over and reload Makefiles which have been remade (a non-POSIX feature).
28required='GNUmake gcc'
29. ./defs || exit 1
30
31set -e
32
33echo 'AC_CONFIG_FILES([sub/Makefile])' >confiles.m4
34
35cat >> configure.in << 'END'
36AM_PROG_CC_C_O
37AC_PROG_CC
38m4_include([confiles.m4])
39MORE_DEFS
40AC_OUTPUT
41END
42
43cat > Makefile.am << 'END'
44SUBDIRS = sub
45ACLOCAL_AMFLAGS = -I m4
46END
47
48mkdir sub
49
50cat > sub/Makefile.am << 'END'
51bin_PROGRAMS = wish
52wish_SOURCES = a.c
53END
54
55cat > sub/a.c << 'END'
56#include <stdio.h>
57int main ()
58{
59 printf ("hi liver!\n");
60 return 0;
61}
62END
63
64mkdir m4
65echo 'AC_DEFUN([MORE_DEFS], [])' > m4/moredefs.m4
66
67$ACLOCAL -I m4
68$AUTOCONF
69$AUTOMAKE --copy --add-missing
70./configure
71$MAKE
72
73# Now add a new directory.
74
75mkdir sub/maude
76cat > sub/maude/Makefile.am << 'END'
77include_HEADERS = foo.h
78END
79
80: > sub/maude/foo.h
81
82echo 'SUBDIRS = maude' >> sub/Makefile.am
83
84mkdir maude
85: > maude/Makefile.am
86
87# Update confile.m4 *after* updating sub/Makefile.am.
88# (subdir5.test do it in the other way: it updates configure.in
89# before Makefile.am)
90echo 'AC_CONFIG_FILES([maude/Makefile sub/maude/Makefile])' >> confiles.m4
91
92# We want a simple rebuild from sub/ to create sub/maude/Makefile
93# and maude/Makefile automatically.
94cd sub
95$MAKE
96cd ..
97test -f maude/Makefile
98test -f sub/maude/Makefile
99
100# Make sure the dependencies of aclocal.m4 or honored at least from
101# the top-level directory.
102echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
103$MAKE
104grep GREPME Makefile
105grep GREPME maude/Makefile
106grep GREPME sub/Makefile
107grep GREPME sub/maude/Makefile
Note: See TracBrowser for help on using the repository browser.