Merge branch 'fix-pr13588-pax-hangs' into branch-1.13.2
[automake.git] / t / remake-subdir2.sh
blob0eac565db77d77bd0634c647355bc7959912ab4e
1 #! /bin/sh
2 # Copyright (C) 2011-2013 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 when makefiles
18 # are not named "Makefile".
19 # See also the other similar tests 'remake-subdir*.sh', and the
20 # related test 'aclocal5.sh'.
22 . test-init.sh
24 magic1='::MagicString::One::'
25 magic2='__MagicString__Two__'
27 debug_info ()
29 grep -i magic configure build.in build.mk sub/build.in sub/build.mk
32 cat > configure.ac <<END
33 AC_INIT([$me], [1.0])
34 AM_INIT_AUTOMAKE
35 AC_CONFIG_FILES([build.mk:build.in])
36 AC_CONFIG_FILES([sub/build.mk:sub/build.in])
37 AC_SUBST([MAGIC], [magic])
38 AC_OUTPUT
39 END
41 cat > build.am <<'END'
42 AM_MAKEFLAGS = -f build.mk
43 SUBDIRS = sub
44 END
46 mkdir sub
47 cat > sub/build.am <<'END'
48 AM_MAKEFLAGS = -f build.mk
49 END
51 $ACLOCAL
52 $AUTOCONF
53 $AUTOMAKE
54 ./configure
55 ls -l # For debugging.
57 $MAKE -f build.mk
58 debug_info
60 $sleep
61 sed "s|magic|$magic1|" configure.ac > t
62 mv -f t configure.ac
63 cd sub
64 $MAKE -f build.mk build.mk
65 cd ..
66 debug_info
67 $FGREP $magic1 configure
68 $FGREP $magic1 build.mk
69 $FGREP $magic1 sub/build.mk
71 $sleep
72 cd sub
73 echo MAGIC = $magic2 >> build.am
74 $MAKE -f build.mk build.mk
75 cd ..
76 debug_info
77 $FGREP $magic2 sub/build.mk
78 $FGREP $magic2 sub/build.in
79 $FGREP $magic1 sub/build.in sub/build.mk && exit 1
80 $FGREP $magic2 build.in build.mk && exit 1