Merge branch 'yacc-quote-fix'
[automake.git] / tests / remake10b.test
blobcb96339b6819023b6b920403fb259cc301d26a69
1 #! /bin/sh
2 # Copyright (C) 2010-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 # Test remake rules for am files included (also recursively) by
18 # Makefile.am.
19 # Keep in sync with sister tests `remake10a.test' and `remake10c.test'.
21 . ./defs || Exit 1
23 magic1=::MagicStringOne::
24 magic2=__MagicStringTwo__
25 magic3=%%MagicStringThree%%
27 if using_gmake; then
28 remake="$MAKE nil"
29 else
30 remake="$MAKE Makefile"
33 cat >> configure.in <<'END'
34 AC_OUTPUT
35 END
37 cat > Makefile.am <<'END'
38 .PHONY: nil
39 nil:
40 include foo.am
41 ## Used by "make distcheck" later.
42 check-local:
43 test -f $(top_srcdir)/foo.am
44 test ! -r $(top_srcdir)/bar.am
45 test x'$(FINGERPRINT)' = x'DummyValue'
46 END
48 echo 'FINGERPRINT = BadBadBad' > foo.am
50 $sleep # So that generated autotools files will be newer than prerequisites.
51 $ACLOCAL
52 $AUTOCONF
53 $AUTOMAKE
55 for vpath in : false; do
57 if $vpath; then
58 mkdir build
59 cd build
60 top_srcdir=..
61 else
62 top_srcdir=.
65 $top_srcdir/configure
66 $MAKE # Should be a no-op.
68 $sleep
69 echo "FINGERPRINT = $magic1" > $top_srcdir/foo.am
70 $remake
71 $FGREP FINGERPRINT Makefile # For debugging.
72 $FGREP $magic1 Makefile
74 $sleep
75 echo "FINGERPRINT = $magic2" > $top_srcdir/foo.am
76 $remake
77 $FGREP FINGERPRINT Makefile # For debugging.
78 $FGREP $magic1 Makefile && Exit 1
79 $FGREP $magic2 Makefile
81 $sleep
82 echo 'include $(top_srcdir)/bar.am' > $top_srcdir/foo.am
83 echo "FINGERPRINT = $magic3" > $top_srcdir/bar.am
84 $remake
85 $FGREP FINGERPRINT Makefile # For debugging.
86 $FGREP $magic1 Makefile && Exit 1
87 $FGREP $magic2 Makefile && Exit 1
88 $FGREP $magic3 Makefile
90 $sleep
91 echo "FINGERPRINT = $magic1" > $top_srcdir/bar.am
92 $remake
93 $FGREP $magic2 Makefile && Exit 1
94 $FGREP $magic3 Makefile && Exit 1
95 $FGREP $magic1 Makefile
97 $sleep
98 echo "FINGERPRINT = DummyValue" > $top_srcdir/foo.am
99 using_gmake || $remake
100 $MAKE distcheck
101 $FGREP $magic1 Makefile && Exit 1 # Sanity check.
102 $FGREP $magic2 Makefile && Exit 1 # Likewise.
103 $FGREP $magic3 Makefile && Exit 1 # Likewise.
105 $MAKE distclean
107 cd $top_srcdir
109 done