[Top][All Lists]

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

LEX & YACC support

From: Alexandros Karypidis
Subject: LEX & YACC support
Date: Sat, 9 Nov 2002 13:39:16 +0200
User-agent: KMail/1.4.7

Hi all,

I am unsatisfied with the "" I have built, due to the fact that 
whenever 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.

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."

So I created a such as:

=== CUT HERE ===
INCLUDES =  $(all_includes)
bin_PROGRAMS =  mysh
mysh_SOURCES = mysh.h mysh.c parser.y scanner.l
=== CUT HERE ===

when I change "%token" declarations in "parser.y" and run "make", the 
generated file "parser.h" is altered. But ONLY parser.c is rebuilt. I have to 
run "make" one more time in order for scanner.c to be rebuilt.

I am looking for a set of declarations which would generate some 
kind of Makefile such as:

all: wfssh
wfssh: wfssh.c parser.o scanner.o
        gcc wfssh.c parser.o scanner.o -o wfssh -lfl
parser.h: parser.y
        bison -d parser.y
        mv parser.h
        mv parser.c
parser.o: parser.h parser.c
        gcc parser.c -o parser.o
scanner.o: scanner.l parser.h
        flex scanner.l
        gcc scanner.c -o scanner.o

Alexandros Karypidis
University of Thessaly
Computer & Communications Engineering dept.

reply via email to

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