Merge branch 'yacc-quote-fix'
[automake.git] / tests / remake-subdir.test
blob7df8a879c3e2470fde3fe84ba62460cac4e66174
1 #! /bin/sh
2 # Copyright (C) 2011-2012 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)
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 # Check that remake rules works from subdirectories, even with non-GNU
18 # make implementations.
19 # See also the other similar tests `remake-subdir*.test', and the
20 # related test `aclocal5.test'.
22 . ./defs || Exit 1
24 if using_gmake; then
25 remake=$MAKE
26 else
27 remake="$MAKE Makefile"
30 magic1='::MagicString::One::'
31 magic2='__MagicString__Two__'
33 debug_info ()
35 grep -i magic configure Makefile.in Makefile sub/Makefile.in sub/Makefile
38 cat >> configure.in <<'END'
39 AC_CONFIG_FILES([sub/Makefile])
40 AC_SUBST([MAGIC], [magic])
41 AC_OUTPUT
42 END
44 cat > Makefile.am <<'END'
45 SUBDIRS = sub
46 END
48 mkdir sub
49 : > sub/Makefile.am
51 $ACLOCAL
52 $AUTOCONF
53 $AUTOMAKE
55 ./configure
56 $MAKE
57 debug_info
59 $sleep
60 sed "s|magic|$magic1|" configure.in > t
61 mv -f t configure.in
62 cd sub
63 $remake
64 cd ..
65 debug_info
66 $FGREP $magic1 configure
67 $FGREP $magic1 Makefile
68 $FGREP $magic1 sub/Makefile
70 $sleep
71 cd sub
72 echo MAGIC = $magic2 >> Makefile.am
73 $remake
74 cd ..
75 debug_info
76 $FGREP $magic2 sub/Makefile
77 $FGREP $magic2 sub/Makefile.in
78 $FGREP $magic1 sub/Makefile sub/Makefile.in && Exit 1
79 $FGREP $magic2 Makefile Makefile.in && Exit 1