[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 =
 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


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

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.

Instead of 

  my_SOURCES = ... parser.y ...

Use something like

  my_SOURCES = ... parser.c ...
  EXTRA_DIST = parser.y
  parser.c: parser.y
          $(YACC) ...


Finally there have been a thread about C++ scanners lately
(no idea if it's your case)

 Alan> I define AM_PROG_LEX and AC_PROG_YACC in
 Alan> 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  (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]