2 # Copyright (C) 2011-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, when yacc-generated headers are
18 # involved (i.e., the '-d' option is in *YFLAGS).
25 cat >>configure.ac <<'EOF'
31 cat > Makefile.am <<'EOF'
32 # Need generic and non-generic rules.
34 bin_PROGRAMS = foo bar
36 bar_SOURCES = $(foo_SOURCES)
37 bar_YFLAGS = $(AM_YFLAGS)
42 void yyerror (char *s) { return; }
43 int yylex (void) { return 0; }
44 int main (void) { return 0; }
48 fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
52 $AUTOMAKE --add-missing
55 # Check that the expected non-generic rules has been truly generated.
56 # Otherwise, the coverage offered by this test will be weaker then
57 # expected and planned.
58 $FGREP 'bar-parse.c' Makefile.in
59 $FGREP '$(bar_YFLAGS)' Makefile.in
61 ./configure --enable-silent-rules
63 $MAKE >stdout || { cat stdout; exit 1; }
66 $EGREP ' (-c|-d|-o)' stdout && exit 1
67 $EGREP '(mv|ylwrap) ' stdout && exit 1
69 grep 'YACC *parse\.c' stdout
70 grep 'updating *parse\.h' stdout
71 grep 'YACC *bar-parse\.c' stdout
72 grep 'updating *bar-parse\.h' stdout
74 grep ' CC *parse\.' stdout
75 grep ' CC *bar-parse\.' stdout
76 grep 'CCLD *foo' stdout
77 grep 'CCLD *bar' stdout
79 # Check recovering from header removal.
80 rm -f parse.h bar-parse.h
81 $MAKE parse.h bar-parse.h >stdout || { cat stdout; exit 1; }
84 $EGREP ' (-c|-d|-o)' stdout && exit 1
85 $EGREP '(mv|ylwrap) ' stdout && exit 1
87 grep 'YACC *parse\.c' stdout
88 grep 'updating *parse\.h' stdout
89 grep 'YACC *bar-parse\.c' stdout
90 grep 'updating *bar-parse\.h' stdout
92 # Cleaning and then rebuilding with the same V flag (and without
93 # removing the generated sources in between) shouldn't trigger a
94 # different set of rules.
97 $MAKE >stdout || { cat stdout; exit 1; }
100 $EGREP ' (-c|-d|-o)' stdout && exit 1
101 $EGREP '(mv|ylwrap) ' stdout && exit 1
103 # Don't look for "YACC *.c" and "updating *.h", as yacc shouldn't
105 grep ' CC *parse\.' stdout
106 grep ' CC *bar-parse\.' stdout
107 grep 'CCLD *foo' stdout
108 grep 'CCLD *bar' stdout
110 # Check recovering from header removal.
111 rm -f parse.h bar-parse.h
112 $MAKE parse.h bar-parse.h >stdout || { cat stdout; exit 1; }
115 $EGREP ' (-c|-d|-o)' stdout && exit 1
116 $EGREP '(mv|ylwrap) ' stdout && exit 1
118 grep 'YACC *parse\.c' stdout
119 grep 'updating *parse\.h' stdout
120 grep 'YACC *bar-parse\.c' stdout
121 grep 'updating *bar-parse\.h' stdout
123 # Ensure a truly clean rebuild.
124 $MAKE maintainer-clean
126 ./configure --enable-silent-rules
128 $MAKE V=1 >stdout || { cat stdout; exit 1; }
134 grep 'ylwrap ' stdout
136 $EGREP '(YACC|CC|CCLD) ' stdout && exit 1
138 # Check recovering from header removal.
139 rm -f parse.h bar-parse.h
140 $MAKE V=1 parse.h bar-parse.h >stdout || { cat stdout; exit 1; }
144 grep 'ylwrap ' stdout
146 grep 'YACC' stdout && exit 1
148 # Cleaning and then rebuilding with the same V flag (and without
149 # removing the generated sources in between) shouldn't trigger a
150 # different set of rules.
153 $MAKE V=1 >stdout || { cat stdout; exit 1; }
156 # Don't look for ylwrap, as probably lex hasn't been re-run.
160 $EGREP '(YACC|CC|CCLD) ' stdout && exit 1
162 # Check recovering from header removal.
163 rm -f parse.h bar-parse.h
164 $MAKE V=1 parse.h bar-parse.h >stdout || { cat stdout; exit 1; }
168 grep 'ylwrap ' stdout
170 grep 'YACC' stdout && exit 1