automake
[Top][All Lists]
Advanced

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

Re: LEX & YACC support


From: Eric Siegerman
Subject: Re: LEX & YACC support
Date: Tue, 12 Nov 2002 16:23:46 -0500
User-agent: Mutt/1.2.5i

On Sat, Nov 09, 2002 at 01:39:16PM +0200, Alexandros Karypidis wrote:
> Hi all,
> 
> [W]henever I change my bison file to add a %token, I have to run make TWICE 
> to 
> get a correct build.  This is because the header file with token declarations 
> which is generated when yacc is run, also affects the lexical scanner -- 
> therfore it needs to be rebuilt as well. However, this is only detected after 
> the fist "make" command.

Can't you simply add this to Makefile.am?
        scanner.o: parser.h

Without explicitly giving the actions, that is; leave those to
Automake.  All that's really missing is that one edge of the
dependency graph, so that's all you should (need to) provide
yourself.

This isn't completely "smart", if that's defined as "avoiding all
literal Makefile content that Automake would pass through
unchanged".  I'd question that definition though; I think it's
excessive.

I agree with you, though, that the completely-spelled-out version
you gave as a worst case isn't smart at all :-), so you're
absolutely right to want to avoid it!

> Now, I was reading in the automake manual (section 9.7 Yacc and Lex support):
> 
>       "You should never explicitly mention the intermediate (`C' or `C++')
>       file in any `SOURCES' variable; only list the source file."

Sure, but parser.h *isn't* an intermediate.  For a .y.o rule, the
only intermediate is foo.c (leaving aside the even-more-transient
y.tab. silliness); foo.o and foo.h are both legitimate final
products of the rule.

--

|  | /\
|-_|/  >   Eric Siegerman, Toronto, Ont.        address@hidden
|  |  /
Just Say No to the "faceless cannonfodder" stereotype.
        - http://www.ainurin.net/ (an Orc site)




reply via email to

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