tests: avoid a spurious failure on MSYS
[platform/upstream/automake.git] / t / remake-all-1.sh
1 #! /bin/sh
2 # Copyright (C) 2010-2013 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 the "all" target triggers rebuilt of outdated Makefiles.
18 # See also sister test 'remake-all-2.sh'.
19
20 . test-init.sh
21
22 mkfile=Makefile
23
24 magic1=::MagicStringOne::
25 magic2=__MagicStringTwo__
26 magic3=%%MagicStringThree%%
27
28 cat > configure.ac <<END
29 AC_INIT([$me], [1.0])
30 AM_INIT_AUTOMAKE
31 AC_CONFIG_FILES([$mkfile sub/$mkfile])
32 FOO='$magic1'
33 AC_OUTPUT
34 END
35
36 mkdir sub
37 echo SUBDIRS = sub > $mkfile.am
38 : > sub/$mkfile.am
39
40 $ACLOCAL
41 $AUTOMAKE
42
43 $EGREP "^all-am:.* $mkfile( |$)" $mkfile.in sub/$mkfile.in
44
45 $AUTOCONF
46 ./configure
47
48 $FGREP "$magic1" mkfile.in && exit 1 # Sanity check.
49
50 # Two code paths in configure.am:
51
52 # - either a file in $(am__configure_deps) has been updated ...
53 $sleep
54 echo "AC_SUBST([FOO])" >> configure.ac
55 $MAKE
56 $FGREP FOO $mkfile # For debugging.
57 $FGREP $magic1 $mkfile
58
59 # - ... or not; i.e., Makefile.am or an included file has.
60 $sleep
61 echo "# $magic2" >> $mkfile.am
62 echo "# $magic3" >> sub/$mkfile.am
63 $MAKE
64 $FGREP $magic2 $mkfile
65 $FGREP $magic3 sub/$mkfile
66
67 :