| 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., 59 Temple Place - Suite 330,
|
|---|
| 19 | # Boston, MA 02111-1307, 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).
|
|---|
| 28 | required='GNUmake gcc'
|
|---|
| 29 | . ./defs || exit 1
|
|---|
| 30 |
|
|---|
| 31 | set -e
|
|---|
| 32 |
|
|---|
| 33 | echo 'AC_CONFIG_FILES([sub/Makefile])' >confiles.m4
|
|---|
| 34 |
|
|---|
| 35 | cat >> configure.in << 'END'
|
|---|
| 36 | AM_PROG_CC_C_O
|
|---|
| 37 | AC_PROG_CC
|
|---|
| 38 | m4_include([confiles.m4])
|
|---|
| 39 | MORE_DEFS
|
|---|
| 40 | AC_OUTPUT
|
|---|
| 41 | END
|
|---|
| 42 |
|
|---|
| 43 | cat > Makefile.am << 'END'
|
|---|
| 44 | SUBDIRS = sub
|
|---|
| 45 | ACLOCAL_AMFLAGS = -I m4
|
|---|
| 46 | END
|
|---|
| 47 |
|
|---|
| 48 | mkdir sub
|
|---|
| 49 |
|
|---|
| 50 | cat > sub/Makefile.am << 'END'
|
|---|
| 51 | bin_PROGRAMS = wish
|
|---|
| 52 | wish_SOURCES = a.c
|
|---|
| 53 | END
|
|---|
| 54 |
|
|---|
| 55 | cat > sub/a.c << 'END'
|
|---|
| 56 | #include <stdio.h>
|
|---|
| 57 | int main ()
|
|---|
| 58 | {
|
|---|
| 59 | printf ("hi liver!\n");
|
|---|
| 60 | return 0;
|
|---|
| 61 | }
|
|---|
| 62 | END
|
|---|
| 63 |
|
|---|
| 64 | mkdir m4
|
|---|
| 65 | echo '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 |
|
|---|
| 75 | mkdir sub/maude
|
|---|
| 76 | cat > sub/maude/Makefile.am << 'END'
|
|---|
| 77 | include_HEADERS = foo.h
|
|---|
| 78 | END
|
|---|
| 79 |
|
|---|
| 80 | : > sub/maude/foo.h
|
|---|
| 81 |
|
|---|
| 82 | echo 'SUBDIRS = maude' >> sub/Makefile.am
|
|---|
| 83 |
|
|---|
| 84 | mkdir 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)
|
|---|
| 90 | echo '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.
|
|---|
| 94 | cd sub
|
|---|
| 95 | $MAKE
|
|---|
| 96 | cd ..
|
|---|
| 97 | test -f maude/Makefile
|
|---|
| 98 | test -f sub/maude/Makefile
|
|---|
| 99 |
|
|---|
| 100 | # Make sure the dependencies of aclocal.m4 or honored at least from
|
|---|
| 101 | # the top-level directory.
|
|---|
| 102 | echo 'AC_DEFUN([MORE_DEFS], [AC_SUBST([GREPME])])' > m4/moredefs.m4
|
|---|
| 103 | $MAKE
|
|---|
| 104 | grep GREPME Makefile
|
|---|
| 105 | grep GREPME maude/Makefile
|
|---|
| 106 | grep GREPME sub/Makefile
|
|---|
| 107 | grep GREPME sub/maude/Makefile
|
|---|