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 Lex.
24 cat >>configure.ac <<'EOF'
27 AC_CONFIG_FILES([sub/Makefile])
31 cat > Makefile.am <<'EOF'
32 # Need generic and non-generic rules.
33 bin_PROGRAMS = foo1 foo2
35 foo2_SOURCES = $(foo1_SOURCES)
37 foo2_CFLAGS = $(AM_CFLAGS)
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_CFLAGS)
55 #define YY_NO_UNISTD_H 1
61 /* Avoid possible link errors. */
62 int yywrap (void) { return 1; }
63 int main (void) { return 0; }
68 $AUTOMAKE --add-missing
71 # Ensure per-target rules are used, to ensure their coverage below.
72 $FGREP 'foo2-foo.c' Makefile.in || exit 99
73 $FGREP 'bar2-bar.c' sub/Makefile.in || exit 99
75 ./configure --enable-silent-rules
77 $MAKE >stdout || { cat stdout; exit 1; }
80 $EGREP ' (-c|-o)' stdout && exit 1
81 $EGREP '(mv|ylwrap) ' stdout && exit 1
83 grep 'LEX .*foo\.' stdout
84 grep 'LEX .*bar\.' stdout
85 grep ' CC .*foo\.' stdout
86 grep ' CC .*bar\.' stdout
87 grep 'CCLD .*foo1' stdout
88 grep 'CCLD .*bar1' stdout
89 grep 'CCLD .*foo2' stdout
90 grep 'CCLD .*bar2' 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|-o)' stdout && exit 1
101 $EGREP '(mv|ylwrap) ' stdout && exit 1
103 # Don't look for LEX, as probably lex hasn't been re-run.
104 grep ' CC .*foo\.' stdout
105 grep ' CC .*bar\.' stdout
106 grep 'CCLD .*foo1' stdout
107 grep 'CCLD .*bar1' stdout
108 grep 'CCLD .*foo2' stdout
109 grep 'CCLD .*bar2' stdout
111 # Ensure a truly clean rebuild.
113 rm -f *foo.c sub/*bar.c
115 $MAKE V=1 >stdout || { cat stdout; exit 1; }
120 grep 'ylwrap ' stdout
122 $EGREP '(LEX|CC|CCLD) ' stdout && exit 1
124 # Cleaning and then rebuilding with the same V flag (and without
125 # removing the generated sources in between) shouldn't trigger a
126 # different set of rules.
129 $MAKE V=1 >stdout || { cat stdout; exit 1; }
132 # Don't look for ylwrap, as probably lex hasn't been re-run.
136 $EGREP '(LEX|CC|CCLD) ' stdout && exit 1