[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LEX/YACC definitions header
From: |
Alexandre Duret-Lutz |
Subject: |
Re: LEX/YACC definitions header |
Date: |
Sat, 26 Apr 2003 00:05:37 +0200 |
User-agent: |
Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux) |
Hi Alan,
>>> "Alan" == Alan Larkin <address@hidden> writes:
[...]
Alan> AM_CPPFLAGS = -I"C:/Program Files/Java/j2sdk1.4.1_01/include"
-I"C:/Program Files/Java/j2sdk1.4.1_01/include/win32"
Alan> AM_YFLAGS = --defines=$(@:.c++=.hpp) -y
Alan> lib_LTLIBRARIES = libforrest.la
Alan> libforrest_la_SOURCES = \
Alan> ...
Alan> ForrestLexer.l \
Alan> ForrestParser.y++ \
[...]
Alan> ForrestParser.hpp: ForrestParser.y++ # ???
Automake should output this dependency for you. (But it won't
be called ForrestParser.hpp -- see below).
[...]
Alan> ForrestLexer.l:7:29: ForrestParser.hpp: No such file or directory
Alan> [... copious quantities of errors from ForrestLexer.c]
Alan> How do I write my .am so that ForrestParser.hpp is
Alan> generated?
Using the Automake rules to build parsers you can't. However,
what you can do is to use
AM_YFLAGS = -d
which should produce ForresParser.c++ and ForrestParser.h (not .hpp).
Note that Automake recognizes -d but not --define (the latter
isn't portable anyway). There is a discussion about using
`AM_YFLAGS = -d' in the manual, don't miss the note about
BUILT_SOURCES.
AFAICT should not need `-y', since this is already added to YACC
by AC_PROG_YACC when needed.
If naming the parser ForrestParser.h instead ForrestParser.hpp
is unacceptable, you can always write your own rule to build it.
I.e.,
Instead of
my_SOURCES = ... parser.y ...
Use something like
my_SOURCES = ... parser.c ...
EXTRA_DIST = parser.y
parser.c: parser.y
$(YACC) ...
etc.
Finally there have been a thread about C++ scanners lately
(no idea if it's your case)
http://sources.redhat.com/ml/automake/2003-02/msg00014.html
Alan> I define AM_PROG_LEX and AC_PROG_YACC in
Alan> configure.in. Thats all I need there in order to make the
Alan> parser right?
Yep. Generally you should expect Automake to complain when a
macro is missing from configure.ac. (If you find out it didn't
complain for something, please do complain to address@hidden
If automake find out that you didn't complain because it didn't
complain, it won't complain either -- please don't complain for this.)
Alan> Also, while I have you, whats the correct way to get rid
Alan> of that hard coded inclusion of the Java include
Alan> directory?
You could write a configure check that will fill CPPFLAGS (for
instance using a --with-jave-include option), or let your users
fill CPPFLAGS themselves when they run ./configure.
--
Alexandre Duret-Lutz