fixup: list of yacc/lex tests was botched
[platform/upstream/automake.git] / tests / yacc-pr204.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2004, 2010, 2011 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 # For PR 204.
18 # C sources derived from nodist_ yacc sources should not be distributed.
19 # See also related test `yacc-nodist.test'.
20 # The tests 'lex-nodist.test' and 'lex-pr204.test' does similar checks
21 # for lex-generated C files.
22
23 required=yacc
24 . ./defs || Exit 1
25
26 set -e
27
28 cat >> configure.in <<'EOF'
29 AM_MAINTAINER_MODE
30 AC_PROG_CC
31 AC_PROG_YACC
32 AC_OUTPUT
33 EOF
34
35 # The PARSE2 intermediate variable is there to make
36 # sure Automake match 'nodist_' against the right
37 # variable name...
38 cat > Makefile.am << 'EOF'
39 AM_YFLAGS = -d
40 EXTRA_PROGRAMS = foo
41 PARSE2 = parse2.y
42 nodist_foo_SOURCES = parse.y $(PARSE2)
43
44 distdirtest: distdir
45         test ! -f $(distdir)/parse.c
46         test ! -f $(distdir)/parse.y
47         test ! -f $(distdir)/parse.h
48         test ! -f $(distdir)/parse2.c
49         test ! -f $(distdir)/parse2.y
50         test ! -f $(distdir)/parse2.h
51 EOF
52
53 cat > parse.y << 'END'
54 %{
55 int yylex () {return 0;}
56 void yyerror (char *s) {}
57 %}
58 %%
59 maude : 'm' 'a' 'u' 'd' 'e' {};
60 END
61
62 cp parse.y parse2.y
63
64 $ACLOCAL
65 $AUTOCONF
66 $AUTOMAKE -a
67
68 ./configure
69 $MAKE distdirtest
70
71 # Make sure parse.c and parse2.c are still targets.
72 $MAKE parse.c parse2.c
73 test -f parse.c
74 test -f parse2.c
75
76 # Ensure the rebuild rule works despite AM_MAINTAINER_MODE, because
77 # it's a nodist_ parser.
78 $sleep
79 touch parse.y parse2.y
80 $sleep
81 $MAKE parse.c parse2.c
82 stat parse.c parse.y parse2.c parse2.y || : # For debugging.
83 test `ls -t parse.c parse.y | sed 1q` = parse.c
84 test `ls -t parse2.c parse2.y | sed 1q` = parse2.c
85
86 :