Results 1 to 6 of 6

Thread: How to Build with Makefile in gfortran?

  1. #1
    Join Date
    Dec 2009
    Posts
    192

    How to Build with Makefile in gfortran?

    Hi,
    I want to build something in any con gfortran f90 with such program called test.f90:
    Code:
      test program
        implicit none
        write (*,*) 'test'
        end
    Do I need a Makefile?
    If (without a Makefile), I:
    Code:
        $ make test
    As I do for a code f77,
    Code:
        make: *** No rule to make target "test". Off.
    For cons, they write a Makefile:
    Code:
        # Makefile
        FC = gfortran
        test: test.o
        $ (FC)-o test test.o
        test.o: test.f90
        $ (FC)-c test.f90
    Here, it works. Does someone could explain what I'm doing wrong? I know it's a stupid question and that it poses problems themselves. Thank you very much,
    Last edited by Remedy; 13-01-2010 at 12:24 PM.

  2. #2
    Join Date
    Apr 2008
    Posts
    3,522

    Re: How to Build with Makefile in gfortran?

    Hello,
    make: *** No rule to make target "test". Off.
    It means that mean there is no rule therefore makefile with commands to execute (like your example makefile) to make target test. If you make a makefile called makefile you make is just slap AC works but anyway if you want to use the make command to do a makefile. Hope this will help you.

  3. #3
    Join Date
    Dec 2009
    Posts
    192

    Re: How to Build with Makefile in gfortran?

    Hello,
    Thank you, but I do not know. For example, if the same thing is written in f77 and not f90 (ie if I add space at the beginning of each line, as was done in f77) and called it rather test.f test.f90, the command "make $ test" enough to compile even if I do not have a Makefile. Thank you anyway.

  4. #4
    Join Date
    Apr 2008
    Posts
    3,522

    Re: How to Build with Makefile in gfortran?

    Hello,
    So I not really understand, make to me is a utility that allows for separate compilation in telling him what to do. The impression that I make is a Fortran compiler. I use to make C and C + + or even Java so I'm inside a makefile with all orders need to compile my program by calling the compiler gcc, g + + and javac. If you just do not make a makefile and AC is that it compiles a FORTRAN compiler and then I understand.

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: How to Build with Makefile in gfortran?

    Hello,
    If you're gfortran. You can open a terminal shows you the directory where you have written your program gedit for example test.90. You can also write in the terminal gedit will open a text document you your my program and after you gfortran-o "test" test.f90. "test" is the Executive apes you pat on the terminal. / test. You can save data and get results a remark in the directory where you create your program you find a black icon in the shape of a diamond is it and Excutive Order. / test in the terminal that can handle.

  6. #6
    Join Date
    Dec 2009
    Posts
    213

    Re: How to Build with Makefile in gfortran?

    Hello,
    Even I have a similar type of problem. I compile and I debug in gortran then I look how to create a makefile I used the example test as described above but my terminal displays this error
    Makefile: 6: *** missing separator. Off.
    I tried not to skip lines in the makefile then it displays the error
    makefile: 4: *** missing separator. Off.
    this line is causing the problem $ (FC)-o test test.o
    Can someone help me overcome this problem. Thank you

Similar Threads

  1. Replies: 2
    Last Post: 14-05-2012, 10:56 AM
  2. Linux Makefile
    By Xiomar in forum Operating Systems
    Replies: 2
    Last Post: 29-12-2010, 07:33 AM
  3. Makefile to separate files in C
    By Lauren Ambrose in forum Software Development
    Replies: 4
    Last Post: 05-04-2010, 12:11 PM
  4. Execution of a makefile in C
    By Brake Fail in forum Software Development
    Replies: 4
    Last Post: 17-04-2009, 06:46 PM
  5. Command line tool to convert VC project files to Makefile
    By Harman in forum Software Development
    Replies: 3
    Last Post: 25-10-2008, 05:19 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,979,835.57566 seconds with 16 queries