1 Attachment(s)
Need help creating a makefile(unix)
Basically this is what I want the makefile to do:
Quote:
# 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:
Quote:
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.
Re: Need help creating a makefile(unix)
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.
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
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