Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Makefile in Unix environment: help!

  1. May 21, 2006 #1

    nrqed

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    NEVER MIND! I finally found a good reference explaining all of this. Sorry for the wasted bandwidth!

    Patrick



    I have this makefile I am trying to understand.

    It goes like this:

    COMP = ifort
    FLAGS = -autodouble etc...
    GLOBALS = a bunch of .o files....


    glue: gluon_operators.o
    $(COMP) $(FLAGS) -o main_program *.o

    gluon_operators.o: gluon_operators.f90 loop_functions.o $(GLOBALS)
    $(COMP) $(FLAGS) -c gluon_operators.f90


    and so on...

    I understand that this is compiling stuff using the Fortran compiler with some flags.

    What I am confused about are the lines with a ":", for example

    glue: gluon_operators.o

    I have no idea what this line does.
    Also, the line


    gluon_operators.o: gluon_operators.f90 loop_functions.o $(GLOBALS)


    is a mystery to me. What does the ":" do?

    Also, I don't understand the line with main_program. It seems to me that the -o says to output the result of the compilation to main_program, but there does not seem to be anything compiled in the first place ?! I would have expected $(COMP) $(FLAGS) program.f90 -o main_program or something similar.

    Also, what does the "*.o" mean at the end of that same line? It says something about all files ending with .o but I don't quite understand the whole line. Maybe it says that anything that will be compiled next must
    put together in the file main_program??


    I would really appreciate help!

    Patrick
     
    Last edited: May 21, 2006
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: Makefile in Unix environment: help!
  1. Unix question (Replies: 9)

  2. Printers on UNIX (Replies: 2)

  3. Running UNIX (Replies: 4)

Loading...