help-bison
[Top][All Lists]
Advanced

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

Correct makefile for a bison/flex compilation


From: Joe Garvey
Subject: Correct makefile for a bison/flex compilation
Date: Mon, 16 Mar 2009 14:07:42 -0700 (PDT)

I presently have a compiler to write with Flex and Bison.
I have a lex.l file, and a parse.y in which there are no conflicts.
I also have a symtable.h included.

I have a makefile as follows...
============================================================
project: parse.tab.o lex.yy.o
        echo ---> compiling and linking project program
        cc -DYYDEBUG=1 -o project parse.tab.o lex.yy.o -ly -ll -lm    

lex.yy.o:   lex.yy.c parse.tab.h # the dependencies of lex.yy.o the lexer
object
        echo ---> determining dependency for lex.yy.o

lex.yy.o parse.tab.o: symtable.h #just declares that symtable.h is a
dependency to both
        echo ---> determining symtable.h dependency for lex.yy.o parse.tab.o

parse.tab.c parse.tab.h:  parse.y       # THE PARSE C AND H FILES MADE...  OK to
here
        echo --->  making parse.tab.c and parse.tab.h
        bison -d parse.y

lex.yy.c : lex.l                        # THE LEX C FILE MADE
        echo ---> making lexfile
        flex lex.l

============================================================
When I run it, I get the following output.  The line numbers don't actually
correspond. Could you advise as to how the makefile should be written to not
have any error?
============================================================
address@hidden:/usr/local/project/chk$ make
makefile:9: warning: overriding commands for target `lex.yy.o'
makefile:6: warning: ignoring old commands for target `lex.yy.o'
echo ---> determining symtable.h dependency for lex.yy.o parse.tab.o
echo ---> making lexfile
flex lex.l
echo --->  making parse.tab.c and parse.tab.h
bison -d parse.y
echo ---> determining symtable.h dependency for lex.yy.o parse.tab.o
echo ---> compiling and linking project program
cc -DYYDEBUG=1 -o project parse.tab.o lex.yy.o -ly -ll -lm    
cc: parse.tab.o: No such file or directory
cc: lex.yy.o: No such file or directory
make: *** [´╗┐project] Error 1
address@hidden:/usr/local/project/chk$ 
============================================================
-- 
View this message in context: 
http://www.nabble.com/Correct-makefile--for-a-bison-flex-compilation-tp22547478p22547478.html
Sent from the Gnu - Bison - Help mailing list archive at Nabble.com.





reply via email to

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