autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: flex/bison rebuilding issue


From: Philip Herron
Subject: Re: flex/bison rebuilding issue
Date: Fri, 10 Sep 2010 04:29:22 +0100

On 10 September 2010 03:46, Reuben Hawkins <address@hidden> wrote:
> Attached is my Makefile.am.  My problem is editing scanner.l or
> grammar.y doesn't trigger a rebuild of my whole project when *I think*
> it should...  How do I set dependencies such that editing scanner.l or
> grammar.y will rebuild my whole parser?
>

Hey there

I use flex and bison alot with automake and yeah this isn't the right
forum to be asking about this since Makefile.am's are handled by
automake. But anyways if you edit your lexer, why do you need to
rebuild your whole thing? Its just like editing any .c file within a
project just rebuild it and then link it all together.

Looking at your Makefile i don't understand why your doing alot of
stuff there, for what your doing there all you need is:

bin_PROGRAMS = fixc
noinst_LTLIBRARIES = libparser.la

AM_YFLAGS = -d --verbose

fixc_SOURCES = \
        inc_parser.h \
        main.c

fixc_LDADD = \
        libparser.la

libparser_la_SOURCES = \
        grammar.y \
        parser.h \
        pure.h \
        scanner.l

Having those extra hooks should be un-nessecary since ylwrap should
handle the outputs fine, and it should know if changed to re-generate
fine. I don't think making your parser as a shared library like that
is the right idea, for what your doing there what i would do is:

bin_PROGRAMS = fixc
noinst_LIBRARIES = libparser.a

AM_YFLAGS = -d --verbose

fixc_SOURCES = \
        inc_parser.h \
        main.c

fixc_LDADD = libparser.a

libparser_a_CFLAGS =  -DPARSER
libparser_a_SOURCES = parser.y lexer.l

I've found when dealing with lexer's and parsers in a large program
making those components into a static library is useful.

--Phil



reply via email to

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