2 # Copyright (C) 2010-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)
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 for Yacc.
18 # Keep this in sync with sister test 'silent-yacc-gcc.test'.
25 cat >>configure.ac <<'EOF'
28 AC_CONFIG_FILES([sub/Makefile])
32 cat > Makefile.am <<'EOF'
33 # Need generic and non-generic rules.
34 bin_PROGRAMS = foo1 foo2
36 foo2_SOURCES = $(foo1_SOURCES)
38 foo2_CFLAGS = $(AM_CPPFLAGS)
42 cat > sub/Makefile.am <<'EOF'
43 AUTOMAKE_OPTIONS = subdir-objects
44 # Need generic and non-generic rules.
45 bin_PROGRAMS = bar1 bar2
47 bar2_SOURCES = $(bar1_SOURCES)
49 bar2_CFLAGS = $(AM_CPPFLAGS)
54 void yyerror (char *s) { return; }
55 int yylex (void) { return 0; }
56 int main (void) { return 0; }
60 fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
65 $AUTOMAKE --add-missing
68 # Ensure per-target rules are used, to ensure their coverage below.
69 $FGREP 'foo2-foo.c' Makefile.in || Exit 99
70 $FGREP 'bar2-bar.c' sub/Makefile.in || Exit 99
72 ./configure --enable-silent-rules
74 $MAKE >stdout || { cat stdout; Exit 1; }
77 $EGREP ' (-c|-o)' stdout && Exit 1
78 $EGREP '(mv|ylwrap) ' stdout && Exit 1
80 grep 'YACC .*foo\.' stdout
81 grep 'YACC .*bar\.' stdout
82 grep ' CC .*foo\.' stdout
83 grep ' CC .*bar\.' stdout
84 grep 'CCLD .*foo1' stdout
85 grep 'CCLD .*bar1' stdout
86 grep 'CCLD .*foo2' stdout
87 grep 'CCLD .*bar2' stdout
89 # Cleaning and then rebuilding with the same V flag (and without
90 # removing the generated sources in between) shouldn't trigger a
91 # different set of rules.
94 $MAKE >stdout || { cat stdout; Exit 1; }
97 $EGREP ' (-c|-o)' stdout && Exit 1
98 $EGREP '(mv|ylwrap) ' stdout && Exit 1
100 # Don't look for YACC, as probably yacc hasn't been re-run.
101 grep ' CC .*foo\.' stdout
102 grep ' CC .*bar\.' stdout
103 grep 'CCLD .*foo1' stdout
104 grep 'CCLD .*bar1' stdout
105 grep 'CCLD .*foo2' stdout
106 grep 'CCLD .*bar2' stdout
108 # Ensure a truly clean rebuild.
110 rm -f *foo.[ch] sub/*bar.[ch]
112 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
117 grep 'ylwrap ' stdout
119 $EGREP '(YACC|CC|CCLD) ' stdout && Exit 1
121 # Cleaning and then rebuilding with the same V flag (and without
122 # removing the generated sources in between) shouldn't trigger a
123 # different set of rules.
126 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
129 # Don't look for ylwrap, as probably lex hasn't been re-run.
133 $EGREP '(YACC|CC|CCLD) ' stdout && Exit 1