tests: remove recipes that run tests with 'prove'
[platform/upstream/automake.git] / tests / silent-lex.test
1 #!/bin/sh
2 # Copyright (C) 2010-2012 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Check silent-rules mode for Lex.
18
19 required=lex
20 . ./defs || Exit 1
21
22 mkdir sub
23
24 cat >>configure.ac <<'EOF'
25 AM_SILENT_RULES
26 AM_PROG_CC_C_O
27 AC_PROG_LEX
28 AC_CONFIG_FILES([sub/Makefile])
29 AC_OUTPUT
30 EOF
31
32 cat > Makefile.am <<'EOF'
33 # Need generic and non-generic rules.
34 bin_PROGRAMS = foo1 foo2
35 foo1_SOURCES = foo.l
36 foo2_SOURCES = $(foo1_SOURCES)
37 foo2_LFLAGS = -n
38 foo2_CFLAGS = $(AM_CFLAGS)
39 SUBDIRS = sub
40 LDADD = $(LEXLIB)
41 EOF
42
43 cat > sub/Makefile.am <<'EOF'
44 AUTOMAKE_OPTIONS = subdir-objects
45 # Need generic and non-generic rules.
46 bin_PROGRAMS = bar1 bar2
47 bar1_SOURCES = bar.l
48 bar2_SOURCES = $(bar1_SOURCES)
49 bar2_LFLAGS = -n
50 bar2_CFLAGS = $(AM_CFLAGS)
51 LDADD = $(LEXLIB)
52 EOF
53
54 cat > foo.l <<'EOF'
55 %{
56 #define YY_NO_UNISTD_H 1
57 %}
58 %%
59 "END"   return EOF;
60 .
61 %%
62 /* Avoid possible link errors. */
63 int yywrap (void) { return 1; }
64 int   main (void) { return 0; }
65 EOF
66 cp foo.l sub/bar.l
67
68 $ACLOCAL
69 $AUTOMAKE --add-missing
70 $AUTOCONF
71
72 # Ensure per-target rules are used, to ensure their coverage below.
73 $FGREP 'foo2-foo.c' Makefile.in || Exit 99
74 $FGREP 'bar2-bar.c' sub/Makefile.in || Exit 99
75
76 ./configure --enable-silent-rules
77
78 $MAKE >stdout || { cat stdout; Exit 1; }
79 cat stdout
80
81 $EGREP ' (-c|-o)' stdout && Exit 1
82 $EGREP '(mv|ylwrap) ' stdout && Exit 1
83
84 grep 'LEX .*foo\.' stdout
85 grep 'LEX .*bar\.' stdout
86 grep ' CC .*foo\.' stdout
87 grep ' CC .*bar\.' stdout
88 grep 'CCLD .*foo1' stdout
89 grep 'CCLD .*bar1' stdout
90 grep 'CCLD .*foo2' stdout
91 grep 'CCLD .*bar2' stdout
92
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.
96 $MAKE clean
97
98 $MAKE >stdout || { cat stdout; Exit 1; }
99 cat stdout
100
101 $EGREP ' (-c|-o)' stdout && Exit 1
102 $EGREP '(mv|ylwrap) ' stdout && Exit 1
103
104 # Don't look for LEX, as probably lex hasn't been re-run.
105 grep ' CC .*foo\.' stdout
106 grep ' CC .*bar\.' stdout
107 grep 'CCLD .*foo1' stdout
108 grep 'CCLD .*bar1' stdout
109 grep 'CCLD .*foo2' stdout
110 grep 'CCLD .*bar2' stdout
111
112 # Ensure a truly clean rebuild.
113 $MAKE clean
114 rm -f *foo.c sub/*bar.c
115
116 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
117 cat stdout
118
119 grep ' -c ' stdout
120 grep ' -o ' stdout
121 grep 'ylwrap ' stdout
122
123 $EGREP '(LEX|CC|CCLD) ' stdout && Exit 1
124
125 # Cleaning and then rebuilding with the same V flag (and without
126 # removing the generated sources in between) shouldn't trigger a
127 # different set of rules.
128 $MAKE clean
129
130 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
131 cat stdout
132
133 # Don't look for ylwrap, as probably lex hasn't been re-run.
134 grep ' -c ' stdout
135 grep ' -o ' stdout
136
137 $EGREP '(LEX|CC|CCLD) ' stdout && Exit 1
138
139 :