2 # Copyright (C) 2011-2017 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)
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 silent-rules mode, on 'make' implementations that do not
18 # support nested variables (Bug#9928, Bug#10237).
22 cat >>configure.ac
<<'EOF'
28 cat > Makefile.am
<<'EOF'
29 # Need generic and non-generic rules.
30 bin_PROGRAMS = foo bar
31 bar_CFLAGS = $(AM_CFLAGS)
33 # Check that AM_V and AM_DEFAULT_V work as advertised.
34 pkg_verbose = $(pkg_verbose_@AM_V@)
35 pkg_verbose_ = $(pkg_verbose_@AM_DEFAULT_V@)
36 pkg_verbose_0 = @echo PKG-GEN $@;
40 $(pkg_verbose)echo $@ >$@
62 -) makerules=`cat` || exit ;;
65 for makefile in makefile Makefile; do
66 test -f $makefile && break
70 nested_var_pat='^[^#].*\$([^)]*\$'
73 -) printf '%s\n' "$makerules" | grep "$nested_var_pat";;
74 *) grep "$nested_var_pat" $makefile;;
77 echo >&2 "mymake: $makefile contains nested variables"
82 -) printf '%s\n' "$makerules" | $mymake_MAKE "$@";;
83 *) exec $mymake_MAKE "$@";;
87 mymake_MAKE
=${MAKE-make}
89 export MAKE mymake_MAKE
91 # As a sanity check, verify that 'mymake' rejects Makefiles that
92 # use nested variables.
93 cat > Makefile
<<'END'
100 $MAKE -f foo.mk
&& exit 99
101 cat foo.mk |
$MAKE -f - && exit 99
102 test -f bar
&& exit 99
103 sed '/a =/d' foo.mk
> Makefile
104 $MAKE && test -f bar ||
exit 99
105 rm -f bar Makefile foo.mk
108 $AUTOMAKE --add-missing
111 .
/configure
--enable-silent-rules >stdout ||
{ cat stdout
; exit 1; }
113 grep '^checking whether \./mymake supports nested variables\.\.\. no *$' \
115 $EGREP 'CC|AM_V|GEN' Makefile
# For debugging.
116 grep '^AM_V_CC = *\$(am__v_CC_0) *$' Makefile
117 grep '^AM_V_GEN = *\$(am__v_GEN_0) *$' Makefile
119 $EGREP ' (-c|-o)' stdout
&& exit 1
120 grep 'mv ' stdout
&& exit 1
121 grep 'echo .*oop' stdout
&& exit 1
122 grep 'CC .*foo\.' stdout
123 grep 'CC .*bar\.' stdout
124 grep 'CCLD .*foo' stdout
125 grep 'CCLD .*bar' stdout
126 grep 'PKG-GEN .*oop' stdout
129 .
/configure
--disable-silent-rules > stdout ||
{ cat stdout
; exit 1; }
131 grep '^checking whether \./mymake supports nested variables\.\.\. no *$' \
133 $EGREP 'CC|AM_V|GEN' Makefile
# For debugging.
134 grep '^AM_V_CC = *\$(am__v_CC_1) *$' Makefile
135 grep '^AM_V_GEN = *\$(am__v_GEN_1) *$' Makefile
139 grep ' -o foo' stdout
140 grep ' -o bar' stdout
141 grep 'echo .*>oop' stdout
142 $EGREP '(CC|LD) ' stdout
&& exit 1