Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / silent2.test
1 #!/bin/sh
2 # Copyright (C) 2009, 2010 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, non-fastdep case
18 # (so that, with GCC, we also cover the other code paths in depend2).
19
20 # Please keep this file in sync with silent.test.
21
22 required=gcc
23 . ./defs || Exit 1
24
25 set -e
26
27 mkdir sub
28
29 cat >>configure.in <<'EOF'
30 AM_SILENT_RULES
31 AC_CONFIG_FILES([sub/Makefile])
32 AC_PROG_CC
33 AM_PROG_CC_C_O
34 AC_OUTPUT
35 EOF
36
37 cat > Makefile.am <<'EOF'
38 # Need generic and non-generic rules.
39 bin_PROGRAMS = foo bar
40 bar_CFLAGS = $(AM_CFLAGS)
41 SUBDIRS = sub
42 EOF
43
44 cat > sub/Makefile.am <<'EOF'
45 AUTOMAKE_OPTIONS = subdir-objects
46 # Need generic and non-generic rules.
47 bin_PROGRAMS = baz bla
48 bla_CFLAGS = $(AM_CFLAGS)
49 EOF
50
51 cat > foo.c <<'EOF'
52 int main ()
53 {
54   return 0;
55 }
56 EOF
57 cp foo.c bar.c
58 cp foo.c sub/baz.c
59 cp foo.c sub/bla.c
60
61 $ACLOCAL
62 $AUTOMAKE --add-missing
63 $AUTOCONF
64
65 ./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
66 $MAKE >stdout || { cat stdout; Exit 1; }
67 cat stdout
68 $EGREP ' (-c|-o)' stdout && Exit 1
69 grep 'mv ' stdout && Exit 1
70 grep 'CC .*foo\.' stdout
71 grep 'CC .*bar\.' stdout
72 grep 'CC .*baz\.' stdout
73 grep 'CC .*bla\.' stdout
74 grep 'CCLD .*foo' stdout
75 grep 'CCLD .*bar' stdout
76 grep 'CCLD .*baz' stdout
77 grep 'CCLD .*bla' stdout
78
79 $MAKE clean
80 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
81 cat stdout
82 grep ' -c' stdout
83 grep ' -o foo' stdout
84 $EGREP '(CC|LD) ' stdout && Exit 1
85
86 :