tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / silent2.sh
blob550907f7eaf664bb9fb5b60ce198b3abed242662
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 silent-rules mode, without libtool, non-fastdep case
18 # (so that, with GCC, we also cover the other code paths in depend2).
20 # Please keep this file in sync with silent.test.
22 required=gcc
23 . ./defs || exit 1
25 mkdir sub
27 cat >>configure.ac <<'EOF'
28 AM_SILENT_RULES
29 AC_CONFIG_FILES([sub/Makefile])
30 AC_PROG_CC
31 AM_PROG_CC_C_O
32 AC_OUTPUT
33 EOF
35 cat > Makefile.am <<'EOF'
36 # Need generic and non-generic rules.
37 bin_PROGRAMS = foo bar
38 bar_CFLAGS = $(AM_CFLAGS)
39 SUBDIRS = sub
40 EOF
42 cat > sub/Makefile.am <<'EOF'
43 AUTOMAKE_OPTIONS = subdir-objects
44 # Need generic and non-generic rules.
45 bin_PROGRAMS = baz bla
46 bla_CFLAGS = $(AM_CFLAGS)
47 EOF
49 cat > foo.c <<'EOF'
50 int main ()
52 return 0;
54 EOF
55 cp foo.c bar.c
56 cp foo.c sub/baz.c
57 cp foo.c sub/bla.c
59 $ACLOCAL
60 $AUTOMAKE --add-missing
61 $AUTOCONF
63 ./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
64 $MAKE >stdout || { cat stdout; exit 1; }
65 cat stdout
66 $EGREP ' (-c|-o)' stdout && exit 1
67 grep 'mv ' stdout && exit 1
68 grep 'CC .*foo\.' stdout
69 grep 'CC .*bar\.' stdout
70 grep 'CC .*baz\.' stdout
71 grep 'CC .*bla\.' stdout
72 grep 'CCLD .*foo' stdout
73 grep 'CCLD .*bar' stdout
74 grep 'CCLD .*baz' stdout
75 grep 'CCLD .*bla' stdout
77 $MAKE clean
78 $MAKE V=1 >stdout || { cat stdout; exit 1; }
79 cat stdout
80 grep ' -c' stdout
81 grep ' -o foo' stdout
82 $EGREP '(CC|LD) ' stdout && exit 1