2 # Copyright (C) 2010-2017 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 Lex.
24 cat >>configure.ac
<<'EOF'
26 AC_CONFIG_FILES([sub/Makefile])
30 cat > Makefile.am
<<'EOF'
31 # Need generic and non-generic rules.
32 bin_PROGRAMS = foo1 foo2
34 foo2_SOURCES = $(foo1_SOURCES)
36 foo2_CFLAGS = $(AM_CFLAGS)
41 cat > sub
/Makefile.am
<<'EOF'
42 AUTOMAKE_OPTIONS = subdir-objects
43 # Need generic and non-generic rules.
44 bin_PROGRAMS = bar1 bar2
46 bar2_SOURCES = $(bar1_SOURCES)
48 bar2_CFLAGS = $(AM_CFLAGS)
54 #define YY_NO_UNISTD_H 1
60 /* Avoid possible link errors.
*/
61 int yywrap
(void
) { return 1; }
62 int main
(void
) { return 0; }
67 $AUTOMAKE --add-missing
70 # Ensure per-target rules are used, to ensure their coverage below.
71 $FGREP 'foo2-foo.c' Makefile.
in ||
exit 99
72 $FGREP 'bar2-bar.c' sub
/Makefile.
in ||
exit 99
74 .
/configure
--enable-silent-rules
78 $EGREP ' (-c|-o)' stdout
&& exit 1
79 $EGREP '(mv|ylwrap) ' stdout
&& exit 1
81 grep 'LEX .*foo\.' stdout
82 grep 'LEX .*bar\.' stdout
83 grep ' CC .*foo\.' stdout
84 grep ' CC .*bar\.' stdout
85 grep 'CCLD .*foo1' stdout
86 grep 'CCLD .*bar1' stdout
87 grep 'CCLD .*foo2' stdout
88 grep 'CCLD .*bar2' 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|-o)' stdout
&& exit 1
98 $EGREP '(mv|ylwrap) ' stdout
&& exit 1
100 # Don't look for LEX, as probably lex 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.c sub
/*bar.c
116 grep 'ylwrap ' stdout
118 $EGREP '(LEX|CC|CCLD) ' stdout
&& exit 1
120 # Cleaning and then rebuilding with the same V flag (and without
121 # removing the generated sources in between) shouldn't trigger a
122 # different set of rules.
127 # Don't look for ylwrap, as probably lex hasn't been re-run.
131 $EGREP '(LEX|CC|CCLD) ' stdout
&& exit 1