maint: run "make update-copyright"
[platform/upstream/automake.git] / tests / silent6.test
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.in <<'EOF'
22 AM_SILENT_RULES
23 AC_OUTPUT
24 EOF
25
26 cat > Makefile.am <<'EOF'
27 my_verbose = $(my_verbose_$(V))
28 my_verbose_ = $(my_verbose_$(AM_DEFAULT_VERBOSITY))
29 my_verbose_0 = @echo GEN $@;
30
31 all-local: foo
32
33 foo: foo.in
34         $(my_verbose)cp $(srcdir)/foo.in $@
35 EXTRA_DIST = foo.in
36 CLEANFILES = foo
37 EOF
38
39 : >foo.in
40
41 $ACLOCAL
42 $AUTOMAKE --add-missing
43 $AUTOCONF
44
45 ./configure --enable-silent-rules
46 $MAKE >stdout || { cat stdout; Exit 1; }
47 cat stdout
48 grep '^ *GEN foo *$' stdout
49 grep 'cp ' stdout && Exit 1
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 \.*/foo\.in foo' stdout
56
57 $MAKE distclean
58
59 ./configure --disable-silent-rules
60 $MAKE >stdout || { cat stdout; Exit 1; }
61 cat stdout
62 grep 'GEN ' stdout && Exit 1
63 grep 'cp \.*/foo\.in foo' stdout
64
65 $MAKE clean
66 $MAKE V=0 >stdout || { cat stdout; Exit 1; }
67 cat stdout
68 grep '^ *GEN foo *$' stdout
69 grep 'cp ' stdout && Exit 1
70
71 $MAKE distclean
72
73 $sleep
74 # Things should also work with -Wall in AM_INIT_AUTOMAKE.
75 cat > configure.in <<'END'
76 AC_INIT([silent6], [1.0])
77 AM_INIT_AUTOMAKE([-Wall])
78 AC_CONFIG_FILES([Makefile])
79 END
80
81 $ACLOCAL
82 AUTOMAKE_fails
83 $AUTOMAKE -Wno-error
84
85 # AM_SILENT_RULES should turn off the warning.
86 $sleep
87 echo 'AM_SILENT_RULES' >> configure.in
88 $ACLOCAL
89 $AUTOMAKE
90 grep 'AM_V_GEN' Makefile.in
91 $AUTOMAKE --force -Wno-all -Wportability
92 grep 'AM_V_GEN' Makefile.in
93
94 # The `silent-rules' option to AM_INIT_AUTOMAKE should work likewise.
95 $sleep
96 cat > configure.in <<'END'
97 AC_INIT([silent6], [1.0])
98 AM_INIT_AUTOMAKE([silent-rules])
99 AC_CONFIG_FILES([Makefile])
100 END
101 $ACLOCAL
102 $AUTOMAKE
103 grep 'AM_V_GEN' Makefile.in
104 $AUTOMAKE --force -Wno-all -Wportability
105 grep 'AM_V_GEN' Makefile.in
106
107 :