Dec 6th, 2010, 05:27 PM
#1
Thread Starter
Lively Member
Need help creating a makefile(unix)
Basically this is what I want the makefile to do:
# Compile cpp2html.c to produce cpp2html.o.
# Run the command
flex cppscanner.l
to produce the file lex.yy.c from the language description in cppscanner.l.
# Compile lex.yy.c to produce lex.yy.o. (This often produces a warning message about extra tokens. Ignore it.)
# Link the the .o files to produce an executable program named cpp2html
Here is the current makefile I have and I was told the commands are not correct:
CC=gcc
cpp2html: cpp2html.o lex.yy.c lex.yy.o
$(CC) -o cpp2html cpp2html.o lex.yy.c lex.yy.o
cpp2html.o : cpp2html.c
$(CC) -c cpp2html.c
lex.yy.c: cppscanner.l
flex cppscanner.l
lex.yy.o : lex.yy.c
$(CC) -c lex.yy.c
I've also attached a text file with the error I receive.
Attached Files
Last edited by celtik; Dec 6th, 2010 at 05:30 PM .
Dec 7th, 2010, 09:21 AM
#2
Thread Starter
Lively Member
Re: Need help creating a makefile(unix)
Dec 8th, 2010, 10:05 PM
#3
Thread Starter
Lively Member
Re: Need help creating a makefile(unix)
Sorry to keep bumping, but I'm looking for this asap. I'm sure it's an easy fix for some people here.
Dec 9th, 2010, 05:51 PM
#4
Re: Need help creating a makefile(unix)
NB: I don't know much about makefiles.
I would suggest reading the examples/tutorials on these pages and see if they help.
http://mrbook.org/tutorials/make/
http://flex.sourceforge.net/manual/M...-and-Flex.html
More documentation on the GNU website, probably not as easy to understand:
http://www.gnu.org/software/make/manual/make.html
Dec 11th, 2010, 08:48 PM
#5
Thread Starter
Lively Member
Re: Need help creating a makefile(unix)
Code:
CC=gcc
LEX=flex
cpp2html: cpp2html.o lex.yy.c lex.yy.o
$(CC) -o cpp2html cpp2html.o lex.yy.c lex.yy.o
cpp2html.o : cpp2html.c
$(CC) -c cpp2html.c
lex.yy.o: lex.yy.c
$(CC) -c lex.yy.c
lex.yy.c: cppscanner.l
$(LEX) cppscanner.l
Updated..Still not working. Any help? Thanks
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width