news: update w.r.t. recent depcomp changes
[automake.git] / t / silent-custom.sh
blob73fc4d060afd2ffdcfc9d83f94e74074ee19ccfc
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 . test-init.sh
21 cat >>configure.ac <<'EOF'
22 AC_CONFIG_FILES([sub/Makefile])
23 AC_OUTPUT
24 EOF
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
31 mkdir sub
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
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