Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / yacc6.test
blobcd383a125c54749c990622b4464b9cf9e5b7766c
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007 Free Software
3 # Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Test to make sure ylwrap put in right location.
19 # Report from Tim Van Holder.
20 # Also make sure depcomp does not needlessly update headers.
21 # Report from Paolo Bonzini.
23 required='gcc bison GNUmake'
24 . ./defs || Exit 1
26 set -e
28 cat > configure.in << 'END'
29 AC_INIT([yacc6], [1.0])
30 AC_CONFIG_AUX_DIR([aux1])
31 AM_INIT_AUTOMAKE
32 AC_CONFIG_FILES([Makefile])
33 AC_PROG_CC
34 AM_PROG_CC_C_O
35 AC_PROG_YACC
36 AC_CONFIG_FILES([sub/Makefile])
37 AC_OUTPUT
38 END
40 cat > Makefile.am << 'END'
41 SUBDIRS = sub
43 test-time-unchanged:
44 test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = z
45 test-time-changed:
46 test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = sub/main.$(OBJEXT)
47 END
49 mkdir aux1 sub
51 cat > sub/Makefile.am << 'END'
52 bin_PROGRAMS = foo bar
53 AM_YFLAGS = -d
54 foo_SOURCES = foo.y main.c
55 foo_CPPFLAGS = -DFOO
56 bar_SOURCES = bar.y main.c
57 BUILT_SOURCES = foo.h bar.h
58 END
60 cat > sub/foo.y << 'END'
62 int yylex () {return 0;}
63 void yyerror (char *s) {}
65 %token TOKEN
67 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
68 END
70 cp sub/foo.y sub/bar.y
72 cat >sub/main.c <<'EOF'
73 #ifdef FOO
74 # include "foo.h"
75 #else
76 # include "bar.h"
77 #endif
79 int
80 main()
82 return 0;
84 EOF
86 $ACLOCAL
87 $AUTOCONF
88 $AUTOMAKE -a
89 test -f aux1/ylwrap
90 test ! -f ylwrap
91 test ! -f sub/ylwrap
92 $FGREP '(top_srcdir)/aux1/ylwrap' sub/Makefile.in
93 ./configure
94 $MAKE
95 grep '#.*line.*foo.y' sub/foo.c
96 grep '#.*line.*bar.y' sub/bar.c
98 $sleep
99 : > z
100 $sleep
101 touch sub/bar.y
102 $MAKE
103 $MAKE test-time-unchanged
104 $sleep
105 sed s/TOKEN/TEKON/g sub/bar.y >sub/bar.yt
106 mv -f sub/bar.yt sub/bar.y
107 $MAKE
108 $MAKE test-time-changed