Merge branch 'maint'
[platform/upstream/automake.git] / t / silent.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 silent-rules mode, without libtool, standard depmode case.
18
19 # Please keep this file in sync with silent2.test.
20
21 required=cc
22 . ./defs || exit 1
23
24 mkdir sub
25
26 cat >>configure.ac <<'EOF'
27 AC_CONFIG_FILES([sub/Makefile])
28 AC_PROG_CC
29 AM_PROG_CC_C_O
30 AC_OUTPUT
31 EOF
32
33 cat > Makefile.am <<'EOF'
34 # Need generic and non-generic rules.
35 bin_PROGRAMS = foo bar
36 bar_CFLAGS = $(AM_CFLAGS)
37 SUBDIRS = sub
38 EOF
39
40 cat > sub/Makefile.am <<'EOF'
41 AUTOMAKE_OPTIONS = subdir-objects
42 # Need generic and non-generic rules.
43 bin_PROGRAMS = baz bla
44 bla_CFLAGS = $(AM_CFLAGS)
45 EOF
46
47 cat > foo.c <<'EOF'
48 int main ()
49 {
50   return 0;
51 }
52 EOF
53 cp foo.c bar.c
54 cp foo.c sub/baz.c
55 cp foo.c sub/bla.c
56
57 $ACLOCAL
58 $AUTOMAKE --add-missing
59 $AUTOCONF
60
61 ./configure --enable-silent-rules
62 $MAKE >stdout || { cat stdout; exit 1; }
63 cat stdout
64 $EGREP ' (-c|-o)' stdout && exit 1
65 grep 'mv ' stdout && exit 1
66 grep 'CC    .*foo\.' stdout
67 grep 'CC .*bar\.' stdout
68 grep 'CC .*baz\.' stdout
69 grep 'CC .*bla\.' stdout
70 grep 'CCLD .*foo' stdout
71 grep 'CCLD .*bar' stdout
72 grep 'CCLD .*baz' stdout
73 grep 'CCLD .*bla' stdout
74
75 $MAKE clean
76 $MAKE V=1 >stdout || { cat stdout; exit 1; }
77 cat stdout
78 grep ' -c' stdout
79 grep ' -o foo' stdout
80 $EGREP '(CC|LD) ' stdout && exit 1
81
82 :