Download your favorite Linux distribution at LQ ISO.
Go Back > Blogs > astrogeek
User Name


Rate this Entry

Makefile: For building Flex/Bison template

Posted 08-19-2017 at 04:16 AM by astrogeek

Flex / Bison Project Template, project Makefile.

Save this make source to a file named Makefile in the same directory with lexer and parser source files. The build targets are described in the template project README file.

To build a working parser simply run make in the project directory.

To generate a graph of the parser and display it in an X11 window, run make dotx11.

#A simple makefile for building Flex / Bison template

fbproject: fbproject.y fbproject.l lex.yy.c
        gcc -g -Wall -o fbproject lex.yy.c -lfl

lex.yy.c: fbproject.l
        flex fbproject.l fbproject.y
        bison -vd fbproject.y

#The dot target creates graphviz graph
#To generate PNG run dot -Tpng
dotx11: dot
        dot -Tx11 &
dotpng: dot
        dot -Tpng >fbproject.png
dot: fbproject.y
        bison -vd fbproject.y --graph

        rm -f fbproject fbproject.lex.h* fbproject.png lex.yy.c fbproject.output
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 06:31 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration