Results 1 to 5 of 5

Thread: Need help creating a makefile(unix)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    112

    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 Attached Files
    Last edited by celtik; Dec 6th, 2010 at 05:30 PM.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    112

    Re: Need help creating a makefile(unix)

    Anyone?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    112

    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.

  4. #4
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    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
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    112

    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
  •  



Click Here to Expand Forum to Full Width