How can I fix my Fortran makefile to properly calculate travel times on nodes?

  • Fortran
  • Thread starter Milentije
  • Start date
  • Tags
    Fortran
In summary, the speaker has created a program that is not performing well due to problems with the findfiff2d.o file, which calculates travel-times on nodes. The issue may be that findfiff2d calls six other subroutines: expand, sort, pass, stensilcs2d, fnode, and fside. The speaker is seeking advice on how to instruct the program to look for these six subroutines. They also mention their makefile, which contains rules for converting C files to .o files but may need to be modified for Fortran files. The speaker is unsure of the exact issue and is seeking clarification or suggestions for changes to improve the program's performance.
  • #1
Milentije
48
0
I have made and compiled a programme,but the calculations are not good,because it has somehow problems with findfiff2d.o file(calulates travel-times on nodes).May be the problem is that findiff2d calls 6 other subroutines.So main=>findiff2d=>expand,sort,pass,stensilcs2d,fnod e,fside.So how to tell them to look for these 6 subroutines?
My makefile:
FC= ifort
LD = ifort
FCFLAGS = -O2 -g
LDFLAGS = $(FCFLAGS)
# Executables
main: main.o model.o findiff2d.o findnode.o timenearsrc.o readsrc.o fnode.o expand.o fside.o sort.o pass.o stencils2d.o find.o timeinterp.o timeinterp2d.o timelinear.o time1d.o timeb2d.o timec2d.o blkdat.o fd.par fd.com
$(FC) $(FCLAGS) -o main main.o model.o findiff2d.o findnode.o timenearsrc.o readsrc.o fnode.o expand.o fside.o sort.o pass.o stencils2d.o find.o timeinterp.o timeinterp2d.o timelinear.o time1d.o timeb2d.o timec2d.o blkdat.o

What should I change?
 
Technology news on Phys.org
  • #2
Is there a built-in rule for converting fortran source files to .o files? You may need to add one. It's been a long time...ah here, for .c files:

%.o : %.c
$(CC) $(CFLAGS) $(INCLUDE) $<

Or else you can make explicit dependencies something like:

main.o: main.cOr maybe that wasn't actually your question. If it all links and doesn't run correctly perhaps your code is wrong? I guess I need clarification...
 

What is a Fortran makefile?

A Fortran makefile is a file that contains a set of instructions for the computer to compile and link a Fortran program. It specifies the dependencies and commands needed to create an executable file from source code.

Why am I getting a makefile error when compiling my Fortran code?

There could be several reasons for a makefile error, such as incorrect syntax, missing dependencies, or incorrect file paths. Make sure to carefully check your makefile for any mistakes and make sure all necessary files are included.

How do I create a makefile for my Fortran program?

To create a makefile, you can use a text editor to write the necessary commands and dependencies. Alternatively, you can use a build automation tool such as CMake to generate the makefile for you.

Can I use the same makefile for different Fortran programs?

Yes, you can use the same makefile for different Fortran programs as long as they have similar dependencies and commands. However, it is recommended to have a separate makefile for each program to avoid any potential conflicts.

What are some common troubleshooting steps for makefile problems?

Some common troubleshooting steps for makefile problems include checking for typos, ensuring all necessary files are included, and making sure the makefile is compatible with your version of Fortran. You can also try cleaning and rebuilding your project or using a different build automation tool.

Similar threads

  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
2
Views
17K
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
4
Views
38K
Back
Top