Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / yacc8.test
blob89eb3b73aa8fe6a3e7e0e480cc2ec0dabbb33cb8
1 #! /bin/sh
2 # Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
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 3, or (at your option)
7 # any later version.
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.
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/>.
17 # Test for subdir parsers.
19 required="gcc bison"
21 . ./defs || Exit 1
23 set -e
25 cat > configure.in << 'END'
26 AC_INIT([yacc8], [1.0])
27 AC_CONFIG_AUX_DIR([.])
28 AM_INIT_AUTOMAKE
29 AC_CONFIG_FILES([Makefile])
30 AC_PROG_CC
31 AM_PROG_CC_C_O
32 AC_PROG_YACC
33 AC_OUTPUT
34 END
36 cat > Makefile.am << 'END'
37 AUTOMAKE_OPTIONS = subdir-objects
38 bin_PROGRAMS = foo/foo
39 foo_foo_SOURCES = foo/parse.y
40 AM_YFLAGS = -d
42 obj: foo/parse.$(OBJEXT)
44 test1: obj
45 test -f foo/parse.c
46 test -f foo/parse.$(OBJEXT)
48 test2: obj
49 test -f foo/parse.c
50 test -f foo/parse.$(OBJEXT)
51 END
53 mkdir foo
55 cat > foo/parse.y << 'END'
57 int yylex () {return 0;}
58 void yyerror (char *s) {}
61 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
62 END
64 $ACLOCAL
65 $AUTOCONF
66 $AUTOMAKE -a
68 mkdir sub
69 cd sub
71 ../configure
72 $MAKE test1
74 # Aside of the rest of this test, let's see if we can recover from
75 # parse.h removal
76 test -f foo/parse.h
77 rm -f foo/parse.h
78 $MAKE foo/parse.h
79 test -f foo/parse.h
81 # Make sure foo/parse.h is not updated, unless when needed.
82 $sleep
83 : > z
84 $sleep
85 touch ../foo/parse.y
86 $MAKE obj
87 test `ls -1t foo/parse.h z | sed 1q` = z
88 $sleep
89 sed 's/%%/%token TOKEN\n%%/g' ../foo/parse.y >../foo/parse.yt
90 mv -f ../foo/parse.yt ../foo/parse.y
91 $MAKE obj
92 test `ls -1t foo/parse.h z | sed 1q` = foo/parse.h
94 # Now, adds another parser to test ylwrap.
96 cd ..
98 # Sleep some to make sure timestamp of Makefile.am will change.
99 $sleep
101 cp foo/parse.y foo/parse2.y
102 cat >> Makefile.am << 'END'
103 EXTRA_foo_foo_SOURCES = foo/parse2.y
106 $AUTOMAKE -a
107 test -f ./ylwrap || Exit 1
109 cd sub
110 # Regenerate Makefile (automatic in GNU Make, but not in other Makes)
111 ./config.status
112 $MAKE test2