Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / remake-deleted-am-2.test
1 #! /bin/sh
2 # Copyright (C) 2011 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Check that inclusion of `.am' fragments by automake does not suffer
18 # of the "deleted header problem".  This test checks deeper inclusion
19 # stacks, and use VPATH builds.
20
21 . ./defs || Exit 1
22
23 set -e
24
25 echo AC_OUTPUT >> configure.in
26
27 $ACLOCAL
28 $AUTOCONF
29
30 cat > Makefile.am <<'END'
31 include $(srcdir)/foo.am
32 END
33
34 cat > foo.am <<'END'
35 # this is foo
36 include sub/bar.am
37 include baz.am
38 END
39
40 mkdir sub
41 echo 'include $(top_srcdir)/sub/zardoz.am' > sub/bar.am
42 echo '# this is zardoz' > sub/zardoz.am
43
44 echo 'include fnord.am' > baz.am
45 echo '# you are not seeing this' > fnord.am
46
47 $AUTOMAKE
48 # Sanity checks.
49 $FGREP 'this is zardoz' Makefile.in
50 $FGREP 'you are not seeing this' Makefile.in
51
52 mkdir build
53 cd build
54
55 srcdir=..
56
57 $srcdir/configure
58 $MAKE
59
60 $sleep
61 echo '# this is baz' > $srcdir/baz.am
62 rm -f $srcdir/fnord.am
63 $MAKE
64 # Sanity checks.
65 $FGREP 'you are not seeing this' $srcdir/Makefile.in Makefile && Exit 1
66 $FGREP 'this is baz' $srcdir/Makefile.in
67 $FGREP 'this is baz' Makefile
68
69 $sleep
70 rm -rf $srcdir/sub $srcdir/foo.am $srcdir/baz.am
71 echo '# no more inclusions' > $srcdir/Makefile.am
72 $MAKE
73 # Sanity checks.
74 $EGREP 'this is (foo|bar|baz)' Makefile $srcdir/Makefile.in && Exit 1
75 $FGREP 'no more inclusions' Makefile
76
77 :