2 # Copyright (C) 2011-2015 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
65 $EGREP ' (-c|-d|-o)' stdout
&& exit 1
66 $EGREP '(mv|ylwrap) ' stdout
&& exit 1
68 grep 'YACC *parse\.c' stdout
69 grep 'updating *parse\.h' stdout
70 grep 'YACC *bar-parse\.c' stdout
71 grep 'updating *bar-parse\.h' stdout
73 grep ' CC *parse\.' stdout
74 grep ' CC *bar-parse\.' stdout
75 grep 'CCLD *foo' stdout
76 grep 'CCLD *bar' stdout
78 # Check recovering from header removal.
79 rm -f parse.h bar-parse.h
80 run_make
-O parse.h bar-parse.h
82 $EGREP ' (-c|-d|-o)' stdout
&& exit 1
83 $EGREP '(mv|ylwrap) ' stdout
&& exit 1
85 grep 'YACC *parse\.c' stdout
86 grep 'updating *parse\.h' stdout
87 grep 'YACC *bar-parse\.c' stdout
88 grep 'updating *bar-parse\.h' stdout
90 # Cleaning and then rebuilding with the same V flag (and without
91 # removing the generated sources in between) shouldn't trigger a
92 # different set of rules.
97 $EGREP ' (-c|-d|-o)' stdout
&& exit 1
98 $EGREP '(mv|ylwrap) ' stdout
&& exit 1
100 # Don't look for "YACC *.c" and "updating *.h", as yacc shouldn't
102 grep ' CC *parse\.' stdout
103 grep ' CC *bar-parse\.' stdout
104 grep 'CCLD *foo' stdout
105 grep 'CCLD *bar' stdout
107 # Check recovering from header removal.
108 rm -f parse.h bar-parse.h
109 run_make
-O parse.h bar-parse.h
111 $EGREP ' (-c|-d|-o)' stdout
&& exit 1
112 $EGREP '(mv|ylwrap) ' stdout
&& exit 1
114 grep 'YACC *parse\.c' stdout
115 grep 'updating *parse\.h' stdout
116 grep 'YACC *bar-parse\.c' stdout
117 grep 'updating *bar-parse\.h' stdout
119 # Ensure a truly clean rebuild.
120 $MAKE maintainer-clean
122 .
/configure
--enable-silent-rules
129 grep 'ylwrap ' stdout
131 $EGREP '(YACC|CC|CCLD) ' stdout
&& exit 1
133 # Check recovering from header removal.
134 rm -f parse.h bar-parse.h
135 run_make
-O V
=1 parse.h bar-parse.h
138 grep 'ylwrap ' stdout
140 grep 'YACC' stdout
&& exit 1
142 # Cleaning and then rebuilding with the same V flag (and without
143 # removing the generated sources in between) shouldn't trigger a
144 # different set of rules.
149 # Don't look for ylwrap, as probably lex hasn't been re-run.
153 $EGREP '(YACC|CC|CCLD) ' stdout
&& exit 1
155 # Check recovering from header removal.
156 rm -f parse.h bar-parse.h
157 run_make
-O V
=1 parse.h bar-parse.h
160 grep 'ylwrap ' stdout
162 grep 'YACC' stdout
&& exit 1