Merge branch 'simplify-exit-trap-workaround' into maint
[platform/upstream/automake.git] / t / silent7.sh
1 #!/bin/sh
2 # Copyright (C) 2009-2012 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Check user extensibility of silent-rules mode.
18
19 . ./defs || exit 1
20
21 cat >>configure.ac <<'EOF'
22 AM_SILENT_RULES
23 AC_OUTPUT
24 EOF
25
26 cat > Makefile.am <<'EOF'
27 all-local: foo
28
29 ## And here's how you should do it in your own code:
30 foo: foo.in
31         $(AM_V_GEN)cp $(srcdir)/foo.in $@
32         $(AM_V_at)echo more >> $@
33
34 EXTRA_DIST = foo.in
35 CLEANFILES = foo
36 EOF
37
38 : >foo.in
39
40 $ACLOCAL
41 $AUTOMAKE --add-missing
42 $AUTOCONF
43
44 ./configure --disable-silent-rules
45 $MAKE >stdout || { cat stdout; exit 1; }
46 cat stdout
47 grep 'GEN ' stdout && exit 1
48 grep 'cp ' stdout
49 grep 'echo ' stdout
50
51 $MAKE clean
52 $MAKE V=1 >stdout || { cat stdout; exit 1; }
53 cat stdout
54 grep 'GEN ' stdout && exit 1
55 grep 'cp ' stdout
56 grep 'echo ' stdout
57
58 $MAKE clean
59 $MAKE V=0 >stdout || { cat stdout; exit 1; }
60 cat stdout
61 grep 'GEN .*foo' stdout
62 grep 'cp ' stdout && exit 1
63 grep 'echo ' stdout && exit 1
64
65 $MAKE distclean
66
67 ./configure --enable-silent-rules
68 $MAKE >stdout || { cat stdout; exit 1; }
69 cat stdout
70 grep 'GEN .*foo' stdout
71 grep 'cp ' stdout && exit 1
72 grep 'echo ' stdout && exit 1
73
74 $MAKE clean
75 $MAKE V=0 >stdout || { cat stdout; exit 1; }
76 cat stdout
77 grep 'GEN .*foo' stdout
78 grep 'cp ' stdout && exit 1
79 grep 'echo ' stdout && exit 1
80
81 $MAKE clean
82 $MAKE V=1 >stdout || { cat stdout; exit 1; }
83 cat stdout
84 grep 'GEN ' stdout && exit 1
85 grep 'cp ' stdout
86 grep 'echo ' stdout
87
88 # Ensure that setting 'silent-rules' in a Makefile.am produces an error.
89 echo 'AUTOMAKE_OPTIONS = silent-rules' >> Makefile.am
90 AUTOMAKE_fails --force
91
92 :