2 # Copyright (C) 2009-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)
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 user extensibility of silent-rules mode.
21 cat >>configure.ac
<<'EOF'
22 AC_CONFIG_FILES([sub/Makefile])
26 # We delegate all the work to the subdir makefile. This is done
27 # to ensure any command-line setting of $(V) gets correctly passed
28 # down to recursive make invocations.
29 echo SUBDIRS
= sub
> Makefile.am
32 cat > sub
/Makefile.am
<<'EOF'
33 AUTOMAKE_OPTIONS = -Wno-portability-recursive
34 my_verbose = $(my_verbose_$(V))
35 my_verbose_ = $(my_verbose_$(AM_DEFAULT_VERBOSITY))
36 my_verbose_0 = @echo " XGEN $@";
38 all-local: foo gen-headers
43 @headers=`for i in $(list); do echo sub/$$i.h; done`; \
44 if $(AM_V_P); then set -x; else \
45 echo " GEN [headers]"; \
47 rm -f $$headers || exit 1; \
48 ## Only fake header generation.
49 : generate-header --flags $$headers
52 $(my_verbose)cp $(srcdir)/foo.in $@
60 $AUTOMAKE --add-missing
67 --verbose) silent
=false
;;
68 *) fatal_
"do_check(): incorrect usage";;
72 run_make
-M -- ${1+"$@"}
74 $FGREP 'cp ' output
&& exit 1
75 $FGREP 'generate-header' output
&& exit 1
76 $FGREP 'rm -f' output
&& exit 1
77 grep '\bsub/[012]\.h\b' output
&& exit 1
78 grep '^ XGEN foo$' output
79 grep '^ GEN \[headers\]$' output
81 $FGREP 'GEN ' output
&& exit 1
82 $FGREP 'cp ./foo.in foo' output
83 # Be prepared to handle "creative quoting" in the shell traces.
84 # See automake bug#14760.
87 files
="${q}sub/0.h${q} ${q}sub/1.h${q} ${q}sub/2.h${q}"
88 $FGREP "rm -f $files" output ||
continue
89 $FGREP "generate-header --flags $files" output ||
continue
98 .
/configure
--enable-silent-rules
100 do_check
--verbose V
=1
104 .
/configure
--disable-silent-rules
106 do_check
--silent V
=0