tests: fix a timestamp-related spurious failures
[automake.git] / tests / silent-yacc-generic.test
blobb7489dac99b444de9c4cf25db9a142cce4541852
1 #!/bin/sh
2 # Copyright (C) 2010 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)
7 # any later version.
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.
18 # Keep this in sync with sister test `silent-yacc-gcc.test'.
20 required='bison'
21 . ./defs || Exit 1
23 set -e
25 mkdir sub
27 cat >>configure.in <<'EOF'
28 AM_SILENT_RULES
29 AM_PROG_CC_C_O
30 AC_PROG_YACC
31 AC_CONFIG_FILES([sub/Makefile])
32 AC_OUTPUT
33 EOF
35 cat > Makefile.am <<'EOF'
36 # Need generic and non-generic rules.
37 bin_PROGRAMS = foo1 foo2
38 foo1_SOURCES = foo.y
39 foo2_SOURCES = $(foo1_SOURCES)
40 foo2_CFLAGS = $(AM_CPPFLAGS)
41 SUBDIRS = sub
42 EOF
44 cat > sub/Makefile.am <<'EOF'
45 AUTOMAKE_OPTIONS = subdir-objects
46 # Need generic and non-generic rules.
47 bin_PROGRAMS = bar1 bar2
48 bar1_SOURCES = bar.y
49 bar2_SOURCES = $(bar1_SOURCES)
50 bar2_CFLAGS = $(AM_CPPFLAGS)
51 EOF
53 cat > foo.y <<'EOF'
55 void yyerror (char *s) {}
56 int yylex (void) {return 0;}
57 int main(void) {return 0;}
59 %token EOF
61 fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
62 EOF
63 cp foo.y sub/bar.y
65 $ACLOCAL
66 $AUTOMAKE --add-missing
67 $AUTOCONF
69 # Force dependency tracking explicitly, so that slow dependency
70 # extractors are not rejected. Try also with dependency tracking
71 # explicitly disabled.
72 for config_args in \
73 --enable-dependency-tracking --disable-dependency-tracking
75 ./configure $config_args --enable-silent-rules
77 $MAKE >stdout || { cat stdout; Exit 1; }
78 cat stdout
80 $EGREP ' (-c|-o)' stdout && Exit 1
81 $EGREP '(mv|ylwrap) ' stdout && Exit 1
83 grep 'YACC .*foo\.' stdout
84 grep 'YACC .*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.
95 $MAKE clean
97 $MAKE >stdout || { cat stdout; Exit 1; }
98 cat stdout
100 $EGREP ' (-c|-o)' stdout && Exit 1
101 $EGREP '(mv|ylwrap) ' stdout && Exit 1
103 # Don't look for YACC, as probably yacc 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.
112 $MAKE clean
113 rm -f foo.[ch] sub/bar.[ch]
115 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
116 cat stdout
118 grep ' -c ' stdout
119 grep ' -o ' stdout
120 grep 'ylwrap ' stdout
122 $EGREP '(YACC|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.
127 $MAKE clean
129 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
130 cat stdout
132 # Don't look for ylwrap, as probably lex hasn't been re-run.
133 grep ' -c ' stdout
134 grep ' -o ' stdout
136 $EGREP '(YACC|CC|CCLD) ' stdout && Exit 1
138 # Ensure a truly clean reconfiguration/rebuild.
139 $MAKE clean
140 $MAKE maintainer-clean
141 rm -f foo.[ch] sub/bar.[ch]
143 done