source: trunk/essentials/sys-devel/automake-1.8/tests/yacc8.test

Last change on this file was 3118, checked in by bird, 18 years ago

automake 1.8.5

File size: 2.3 KB
Line 
1#! /bin/sh
2# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3#
4# This file is part of GNU Automake.
5#
6# GNU Automake is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10#
11# GNU Automake is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with Automake; see the file COPYING. If not, write to
18# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19# Boston, MA 02111-1307, USA.
20
21# Test for subdir parsers.
22
23required="gcc bison"
24
25. ./defs || exit 1
26
27set -e
28
29cat >> configure.in << 'END'
30AC_CONFIG_AUX_DIR([.])
31AC_PROG_CC
32AM_PROG_CC_C_O
33AC_PROG_YACC
34AC_OUTPUT
35END
36
37cat > Makefile.am << 'END'
38AUTOMAKE_OPTIONS = subdir-objects
39bin_PROGRAMS = foo/foo
40foo_foo_SOURCES = foo/parse.y
41AM_YFLAGS = -d
42
43obj: foo/parse.$(OBJEXT)
44
45test1: obj
46 test -f foo/parse.c
47 test -f foo/parse.$(OBJEXT)
48
49test2: obj
50 test -f foo/parse.c
51 test -f foo/parse.$(OBJEXT)
52END
53
54mkdir foo
55
56cat > foo/parse.y << 'END'
57%{
58int yylex () {return 0;}
59void yyerror (char *s) {}
60%}
61%%
62foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
63END
64
65$ACLOCAL
66$AUTOCONF
67$AUTOMAKE -a
68
69mkdir sub
70cd sub
71
72../configure
73$MAKE test1
74
75# Aside of the rest of this test, let's see if we can recover from
76# parse.h removal
77test -f foo/parse.h
78rm -f foo/parse.h
79$MAKE foo/parse.h
80test -f foo/parse.h
81
82# Make sure foo/parse.h is not updated, unless when needed.
83$sleep
84: > z
85$sleep
86touch ../foo/parse.y
87$MAKE obj
88test `ls -1t foo/parse.h z | sed 1q` = z
89$sleep
90$PERL -pi -e 's/%%/%token TOKEN\n%%/g' ../foo/parse.y
91$MAKE obj
92test `ls -1t foo/parse.h z | sed 1q` = foo/parse.h
93
94# Now, adds another parser to test ylwrap.
95
96cd ..
97
98# Sleep some to make sure timestamp of Makefile.am will change.
99$sleep
100
101cp foo/parse.y foo/parse2.y
102cat >> Makefile.am << 'END'
103EXTRA_foo_foo_SOURCES = foo/parse2.y
104END
105
106$AUTOMAKE -a
107test -f ./ylwrap || exit 1
108
109cd sub
110# Regenerate Makefile (automatic in GNU Make, but not in other Makes)
111./config.status
112$MAKE test2
Note: See TracBrowser for help on using the repository browser.