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'
32 cat > Makefile.am <<'EOF'
33 # Need generic and non-generic rules.
35 bin_PROGRAMS = foo bar
37 bar_SOURCES = $(foo_SOURCES)
38 bar_YFLAGS = $(AM_YFLAGS)
43 void yyerror (char *s) { return; }
44 int yylex (void) { return 0; }
45 int main (void) { return 0; }
49 fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
53 $AUTOMAKE --add-missing
56 # Check that the expected non-generic rules has been truly generated.
57 # Otherwise, the coverage offered by this test will be weaker then
58 # expected and planned.
59 $FGREP 'bar-parse.c' Makefile.in
60 $FGREP '$(bar_YFLAGS)' Makefile.in
62 ./configure --enable-silent-rules
64 $MAKE >stdout || { cat stdout; exit 1; }
67 $EGREP ' (-c|-d|-o)' stdout && exit 1
68 $EGREP '(mv|ylwrap) ' stdout && exit 1
70 grep 'YACC *parse\.c' stdout
71 grep 'updating *parse\.h' stdout
72 grep 'YACC *bar-parse\.c' stdout
73 grep 'updating *bar-parse\.h' stdout
75 grep ' CC *parse\.' stdout
76 grep ' CC *bar-parse\.' stdout
77 grep 'CCLD *foo' stdout
78 grep 'CCLD *bar' stdout
80 # Check recovering from header removal.
81 rm -f parse.h bar-parse.h
82 $MAKE parse.h bar-parse.h >stdout || { cat stdout; exit 1; }
85 $EGREP ' (-c|-d|-o)' stdout && exit 1
86 $EGREP '(mv|ylwrap) ' stdout && exit 1
88 grep 'YACC *parse\.c' stdout
89 grep 'updating *parse\.h' stdout
90 grep 'YACC *bar-parse\.c' stdout
91 grep 'updating *bar-parse\.h' stdout
93 # Cleaning and then rebuilding with the same V flag (and without
94 # removing the generated sources in between) shouldn't trigger a
95 # different set of rules.
98 $MAKE >stdout || { cat stdout; exit 1; }
101 $EGREP ' (-c|-d|-o)' stdout && exit 1
102 $EGREP '(mv|ylwrap) ' stdout && exit 1
104 # Don't look for "YACC *.c" and "updating *.h", as yacc shouldn't
106 grep ' CC *parse\.' stdout
107 grep ' CC *bar-parse\.' stdout
108 grep 'CCLD *foo' stdout
109 grep 'CCLD *bar' stdout
111 # Check recovering from header removal.
112 rm -f parse.h bar-parse.h
113 $MAKE parse.h bar-parse.h >stdout || { cat stdout; exit 1; }
116 $EGREP ' (-c|-d|-o)' stdout && exit 1
117 $EGREP '(mv|ylwrap) ' stdout && exit 1
119 grep 'YACC *parse\.c' stdout
120 grep 'updating *parse\.h' stdout
121 grep 'YACC *bar-parse\.c' stdout
122 grep 'updating *bar-parse\.h' stdout
124 # Ensure a truly clean rebuild.
125 $MAKE maintainer-clean
127 ./configure --enable-silent-rules
129 $MAKE V=1 >stdout || { cat stdout; exit 1; }
135 grep 'ylwrap ' stdout
137 $EGREP '(YACC|CC|CCLD) ' stdout && exit 1
139 # Check recovering from header removal.
140 rm -f parse.h bar-parse.h
141 $MAKE V=1 parse.h bar-parse.h >stdout || { cat stdout; exit 1; }
145 grep 'ylwrap ' stdout
147 grep 'YACC' stdout && exit 1
149 # Cleaning and then rebuilding with the same V flag (and without
150 # removing the generated sources in between) shouldn't trigger a
151 # different set of rules.
154 $MAKE V=1 >stdout || { cat stdout; exit 1; }
157 # Don't look for ylwrap, as probably lex hasn't been re-run.
161 $EGREP '(YACC|CC|CCLD) ' stdout && exit 1
163 # Check recovering from header removal.
164 rm -f parse.h bar-parse.h
165 $MAKE V=1 parse.h bar-parse.h >stdout || { cat stdout; exit 1; }
169 grep 'ylwrap ' stdout
171 grep 'YACC' stdout && exit 1