Merge branch 'improve-release-process' into maint
[automake.git] / t / silent6.sh
blob3593adf5d725114e6faf70d17f8e06f504bdc48c
1 #!/bin/sh
2 # Copyright (C) 2009-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 # Check user extensibility of silent-rules mode.
19 . ./defs || exit 1
21 cat >>configure.ac <<'EOF'
22 AM_SILENT_RULES
23 AC_CONFIG_FILES([sub/Makefile])
24 AC_OUTPUT
25 EOF
27 # We delegate all the work to the subdir makefile. This is done
28 # to ensure any command-line setting of $(V) gets correctly passed
29 # down to recursive make invocations.
30 echo SUBDIRS = sub > Makefile.am
32 mkdir sub
33 cat > sub/Makefile.am <<'EOF'
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
40 list = 0 1 2
41 .PHONY: gen-headers
42 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]"; \
46 fi; \
47 rm -f $$headers || exit 1; \
48 ## Only fake header generation.
49 : generate-header --flags $$headers
51 foo: foo.in
52 $(my_verbose)cp $(srcdir)/foo.in $@
53 EXTRA_DIST = foo.in
54 CLEANFILES = foo
55 EOF
57 : > sub/foo.in
59 $ACLOCAL
60 $AUTOMAKE --add-missing
61 $AUTOCONF
63 do_check ()
65 case ${1-} in
66 --silent) silent=:;;
67 --verbose) silent=false;;
68 *) fatal_ "do_check(): incorrect usage";;
69 esac
70 shift
71 $MAKE clean
72 $MAKE ${1+"$@"} >output 2>&1 || { cat output; exit 1; }
73 sed 's/^/ /' output
74 if $silent; then
75 $FGREP 'cp ' output && exit 1
76 $FGREP 'generate-header' output && exit 1
77 $FGREP 'rm -f' output && exit 1
78 grep '[012]\.h' output && exit 1
79 grep '^ XGEN foo$' output
80 grep '^ GEN \[headers\]$' output
81 else
82 $FGREP 'GEN ' output && exit 1
83 $FGREP 'cp ./foo.in foo' output
84 $FGREP "rm -f sub/0.h sub/1.h sub/2.h" output
85 $FGREP "generate-header --flags sub/0.h sub/1.h sub/2.h" output
89 ./configure --enable-silent-rules
90 do_check --silent
91 do_check --verbose V=1
93 $MAKE distclean
95 ./configure --disable-silent-rules
96 do_check --verbose
97 do_check --silent V=0
99 $MAKE distclean