LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > astrogeek
User Name
Password

Notices


Rate this Entry

Makefile: For building Flex/Bison template

Posted 08-19-2017 at 03: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.

Code:
#A simple makefile for building Flex / Bison template

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

lex.yy.c: fbproject.l fbproject.tab.h
        flex fbproject.l

fbproject.tab.h: fbproject.y
        bison -vd fbproject.y

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

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

Comments

 

  



All times are GMT -5. The time now is 08:53 PM.

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