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

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

automake 1.9.6

File size: 2.2 KB
Line 
1#! /bin/sh
2# Copyright (C) 2001, 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 to make sure ylwrap put in right location.
22# Report from Tim Van Holder.
23# Also make sure depcomp does not needlessly update headers.
24# Report from Paolo Bonzini.
25
26required='gcc bison GNUmake'
27. ./defs || exit 1
28
29set -e
30
31cat > configure.in << 'END'
32AC_INIT([yacc6], [1.0])
33AC_CONFIG_AUX_DIR([aux1])
34AM_INIT_AUTOMAKE
35AC_CONFIG_FILES([Makefile])
36AC_PROG_CC
37AC_PROG_YACC
38AC_CONFIG_FILES([sub/Makefile])
39AC_OUTPUT
40END
41
42cat > Makefile.am << 'END'
43SUBDIRS = sub
44
45test-time-unchanged:
46 test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = z
47test-time-changed:
48 test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = sub/main.$(OBJEXT)
49END
50
51mkdir aux1 sub
52
53cat > sub/Makefile.am << 'END'
54bin_PROGRAMS = foo bar
55AM_YFLAGS = -d
56foo_SOURCES = foo.y main.c
57foo_CPPFLAGS = -DFOO
58bar_SOURCES = bar.y main.c
59END
60
61cat > sub/foo.y << 'END'
62%{
63int yylex () {return 0;}
64void yyerror (char *s) {}
65%}
66%token TOKEN
67%%
68foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
69END
70
71cp sub/foo.y sub/bar.y
72
73cat >sub/main.c <<'EOF'
74#ifdef FOO
75# include "foo.h"
76#else
77# include "bar.h"
78#endif
79
80int
81main()
82{
83 return 0;
84}
85EOF
86
87$ACLOCAL
88$AUTOCONF
89$AUTOMAKE -a
90test -f aux1/ylwrap
91test ! -f ylwrap
92test ! -f sub/ylwrap
93$FGREP '(top_srcdir)/aux1/ylwrap' sub/Makefile.in
94./configure
95$MAKE
96grep '#.*line.*foo.y' sub/foo.c
97grep '#.*line.*bar.y' sub/bar.c
98
99$sleep
100: > z
101$sleep
102touch sub/bar.y
103$MAKE
104$MAKE test-time-unchanged
105$sleep
106$PERL -pi -e s/TOKEN/TEKON/g sub/bar.y
107$MAKE
108$MAKE test-time-changed
Note: See TracBrowser for help on using the repository browser.