Thread: makefile

  1. #1
    Registered User
    Join Date
    Jan 2009


    I have some problems with makefiles and I would appreciate any help
    I try to write a basic makefile which looks like

    read_init: read_initCon.c
    <tab>gcc -o read_init read_initCon.c -lm

    but the result is not the compilation of my program but the second line is printed to the shell and thats it... if I delete -lm at the end, the compilation is working, but I need the link, so the compilation is not successful. Where is my mistake?

    second: I have some Makefiles in a folder and they are named like galaxy.Makefile, cluster.Makefile etc. Does anybody know how I can execute this makefiles?
    thanks for any help
    best regards

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    Without knowing exactly what error you get, I can't really say what is going wrong in your simple makefile - it looks fine as posted.

    If you want make to use a file not called Makefile or makefile, then
    make -f somefilename
    will do the job of using "somefilename" as the input file.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jan 2009


    thanks for the answer. I solved the problem with the makefile... just stupidity...:-)
    best regards

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefile Problem: None rule to make target
    By chris24300 in forum Linux Programming
    Replies: 25
    Last Post: 06-17-2009, 09:45 AM
  2. Building a project using a Makefile
    By starcatcher in forum Windows Programming
    Replies: 2
    Last Post: 11-23-2008, 11:50 PM
  3. unix makefile won't work but works in Dev C++
    By jk1998 in forum C++ Programming
    Replies: 1
    Last Post: 06-09-2007, 03:54 PM
  4. makefile blues....
    By WaterNut in forum C Programming
    Replies: 6
    Last Post: 05-30-2005, 08:22 PM
  5. Need help with Makefile
    By xshapirox in forum C++ Programming
    Replies: 14
    Last Post: 09-28-2004, 03:32 PM