makefiles

This is a discussion on makefiles within the C Programming forums, part of the General Programming Boards category; I'm trying to figure out how this makefile works. Can anyone help me? We've been given a makefile that works ...

  1. #1
    Registered User hankspears's Avatar
    Join Date
    Mar 2002
    Posts
    14

    makefiles

    I'm trying to figure out how this makefile works. Can anyone help me? We've been given a makefile that works with gcc and I'm trying to get it to work with borland cc. I guess I need to change 'gcc' to 'bcc32' and adjust options as necessary, and also to change .o to .obj, but I've no idea what this does:

    tree: lib myTree.o
    gcc myTree.o -L. -R. -ltree -o tree

    lib: tree.o
    ld -h libtree.so -dy -G -o libtree.so tree.o

    what do lib and ld do? and what is an .so file?
    And what do I do with this line:

    clean:
    rm -rf *.o tree libtree.so

    something like del *.obj.....?

    sorry about all the wordage, but I guess you need as much info as possible.

  2. #2
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    If you're really handy with a batch file you can more or less reproduce a makefile. How large of a program are you trying to compile?
    The world is waiting. I must leave you now.

  3. #3
    Unregistered
    Guest
    The world is waiting. I must leave you now.

    Shadow, that's nice. Where is it from?

  4. #4
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    What kind of a question is that?
    The world is waiting. I must leave you now.

  5. #5
    Unregistered
    Guest
    Shadow,
    I assumed it was a quote. Did you write it?

  6. #6
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    It is a quote. I didn't write it.
    The world is waiting. I must leave you now.

  7. #7
    Unregistered
    Guest
    It sounds kind of magical. I searched for it, but couldn't find anything. Is it from a movie or something?

  8. #8
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    You searched for a quote that someone uses in their signature?
    The world is waiting. I must leave you now.

  9. #9
    Unregistered
    Guest
    Yeah, I think I'll use it in my posts, as well. Thanks!

    __________________
    The world is waiting. I must leave you now.

  10. #10
    Registered User stautze's Avatar
    Join Date
    Apr 2002
    Posts
    195
    >Yeah, I think I'll use it in my posts, as well.

    Ever see single white female...

  11. #11
    Registered User hankspears's Avatar
    Join Date
    Mar 2002
    Posts
    14
    Wow, 9 replies, I thought, must be something useful there......never mind.

    Er, to go back to your original question shadow, it's not a very big program - 4 main files, about 350 lines total.
    I used to be able to do a thing or two with batch files, many years ago. What do you suggest?

  12. #12
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    I have never used borland, so I don't know how much help I can be. I do know that with gcc you could do:

    Code:
    REM batch file code
    gcc -c -g file1.c
    gcc -c -g file2.c
    gcc -c -g file3.c
    gcc -o Program file1.o file2.o file3.o
    The world is waiting. I must leave you now.

  13. #13
    Registered User stautze's Avatar
    Join Date
    Apr 2002
    Posts
    195
    Do you need to know how a gcc makefile works, or do you already know that and you just want a makefile that will work with borland.

    I can explain the gcc makefile, but I am not familiar with borland.

  14. #14
    Registered User hankspears's Avatar
    Join Date
    Mar 2002
    Posts
    14
    I just wondered what those lines of code in my first post actually did - particularly the bit about 'lib'. I also don't know where the libtree.so file came from. I should be able to make up a batch file once I know what each part does.
    Do you need any more information?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefiles, GCC's -ggdb option, and Valgrind
    By Jesdisciple in forum C Programming
    Replies: 5
    Last Post: 03-14-2009, 04:25 PM
  2. Makefiles
    By TriKri in forum Windows Programming
    Replies: 3
    Last Post: 03-30-2008, 06:57 AM
  3. Benefits of makefiles
    By Ganoosh in forum C++ Programming
    Replies: 2
    Last Post: 06-27-2005, 09:42 PM
  4. programming linux with gcc, emacs, and makefiles
    By Captain Penguin in forum Linux Programming
    Replies: 1
    Last Post: 11-02-2002, 11:04 AM
  5. Help with Makefiles
    By WebmasterMattD in forum Linux Programming
    Replies: 3
    Last Post: 05-24-2002, 08:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21