Find the answer to your Linux question:
Results 1 to 4 of 4
Hi I am totally new to linux or makefile and what not. I have looked around for info about how to create a makefile to biuld a samll program and ...
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    3

    Makefile problem

    Hi

    I am totally new to linux or makefile and what not. I have looked around for info about how to create a makefile to biuld a samll program and here is what i produced:

    all: lunar.o graphics.o
    gcc -o lunar.o graphics.o

    graphics.o: graphics.c graphics.h
    gcc -o -c graphics.c

    lunar.o: lunar.c graphics.h
    gcc -o -c lunar.c

    clean:
    rm -f lunar.o graphics.o


    lunar is the main.c program which calls upon graphics.h which calles upon graphics.c

    I get Make ***(lunar.o) error 2 in the 'clean' function. Any ideas what's wrong with this makefile? Any help would be greatly appreciated.

    Thanks

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568
    Quote Originally Posted by sicga View Post


    clean:
    rm -f lunar.o graphics.o

    I get Make ***(lunar.o) error 2 in the 'clean' function. Any ideas what's wrong with this makefile? Any help would be greatly appreciated.

    Thanks
    Just guessing here try this
    clean:
    rm -f *.o
    or this

    clean:
    rm lunar.o graphics.o
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  3. #3
    Just Joined!
    Join Date
    Mar 2009
    Posts
    3
    Hi

    Thanks for that advice, neither of those two things worked. I'm using eclipse as the debugger and what not and even when I remove the clean command it still highlights that area with the same error although lunar.o has been removed from there. I'm thinking that maybe it's not refreshing the makefile so I'll look into the eclipse editor and see what i can find. The advice was appreciated, if I can get the makefile to refresh possibly either of those two things will work. However if anyone has any more advice it would be gratefully received.

    Thanks

  4. #4
    Just Joined!
    Join Date
    Mar 2009
    Posts
    3
    Hi

    I managed to check that eclipse was refreshing and updating the makefile so it's not an eclipse problem. This being the case if anyone has any more suggestions about the makefile or if I should provide any more info to help resolve the problem please let me know.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...