doc: typos in test file.
[automake.git] / t / remake-all-2.sh
blob618fca4207911e288866bdfbcc9015e520bdd508
1 #! /bin/sh
2 # Copyright (C) 2010-2024 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 <https://www.gnu.org/licenses/>.
17 # Check that the "all" target triggers rebuilt of outdated makefiles.
18 # This handle the case in which the makefiles are not called 'Makefile'.
19 # See also sister test 'remake-all-1.sh'.
21 . test-init.sh
23 mkfile=foobar
25 magic1=::MagicStringOne::
26 magic2=__MagicStringTwo__
27 magic3=%%MagicStringThree%%
29 cat > configure.ac <<END
30 AC_INIT([$me], [1.0])
31 AM_INIT_AUTOMAKE
32 AC_CONFIG_FILES([$mkfile sub/$mkfile])
33 FOO='$magic1'
34 AC_OUTPUT
35 END
37 mkdir sub
39 cat > $mkfile.am <<END
40 SUBDIRS = sub
41 AM_MAKEFLAGS = -f $mkfile
42 END
44 cat > sub/$mkfile.am <<END
45 AM_MAKEFLAGS = -f $mkfile
46 END
48 $ACLOCAL
49 $AUTOMAKE
51 $EGREP "^all-am:.* $mkfile( |$)" $mkfile.in sub/$mkfile.in
53 $AUTOCONF
54 ./configure
56 $FGREP "$magic1" mkfile.in && exit 1 # Sanity check.
58 # Two code paths in configure.am:
60 # - either a file in $(am__configure_deps) has been updated ...
61 $sleep
62 echo "AC_SUBST([FOO])" >> configure.ac
63 $MAKE -f $mkfile
64 $FGREP FOO $mkfile # For debugging.
65 $FGREP $magic1 $mkfile
67 # - ... or not; i.e., Makefile.am or an included file has.
68 $sleep
69 echo "# $magic2" >> $mkfile.am
70 echo "# $magic3" >> sub/$mkfile.am
71 $MAKE -f $mkfile
72 $FGREP $magic2 $mkfile
73 $FGREP $magic3 sub/$mkfile