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

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

automake 1.9.6

File size: 2.3 KB
Line 
1#! /bin/sh
2# Copyright (C) 2002, 2003, 2004 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., 51 Franklin Street, Fifth Floor,
19# Boston, MA 02110-1301, 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_INIT([yacc8], [1.0])
31AC_CONFIG_AUX_DIR([.])
32AM_INIT_AUTOMAKE
33AC_CONFIG_FILES([Makefile])
34AC_PROG_CC
35AM_PROG_CC_C_O
36AC_PROG_YACC
37AC_OUTPUT
38END
39
40cat > Makefile.am << 'END'
41AUTOMAKE_OPTIONS = subdir-objects
42bin_PROGRAMS = foo/foo
43foo_foo_SOURCES = foo/parse.y
44AM_YFLAGS = -d
45
46obj: foo/parse.$(OBJEXT)
47
48test1: obj
49 test -f foo/parse.c
50 test -f foo/parse.$(OBJEXT)
51
52test2: obj
53 test -f foo/parse.c
54 test -f foo/parse.$(OBJEXT)
55END
56
57mkdir foo
58
59cat > foo/parse.y << 'END'
60%{
61int yylex () {return 0;}
62void yyerror (char *s) {}
63%}
64%%
65foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
66END
67
68$ACLOCAL
69$AUTOCONF
70$AUTOMAKE -a
71
72mkdir sub
73cd sub
74
75../configure
76$MAKE test1
77
78# Aside of the rest of this test, let's see if we can recover from
79# parse.h removal
80test -f foo/parse.h
81rm -f foo/parse.h
82$MAKE foo/parse.h
83test -f foo/parse.h
84
85# Make sure foo/parse.h is not updated, unless when needed.
86$sleep
87: > z
88$sleep
89touch ../foo/parse.y
90$MAKE obj
91test `ls -1t foo/parse.h z | sed 1q` = z
92$sleep
93$PERL -pi -e 's/%%/%token TOKEN\n%%/g' ../foo/parse.y
94$MAKE obj
95test `ls -1t foo/parse.h z | sed 1q` = foo/parse.h
96
97# Now, adds another parser to test ylwrap.
98
99cd ..
100
101# Sleep some to make sure timestamp of Makefile.am will change.
102$sleep
103
104cp foo/parse.y foo/parse2.y
105cat >> Makefile.am << 'END'
106EXTRA_foo_foo_SOURCES = foo/parse2.y
107END
108
109$AUTOMAKE -a
110test -f ./ylwrap || exit 1
111
112cd sub
113# Regenerate Makefile (automatic in GNU Make, but not in other Makes)
114./config.status
115$MAKE test2
Note: See TracBrowser for help on using the repository browser.