Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fortran 77 code

Status
Not open for further replies.

milenko76

Technical User
Mar 26, 2010
100
PT
I a writing a program,exept main there will be 8 soubrutines.How to make a directory with main program and soubrutines?Should I write a makefile?Any links regarding this.
 
Hi maybe the following Makefile help you:


# -------------------------------------
INCLUDE=
FC=gfortran

FFLAG= -g -O3
LFLAG=

LIB_ALL=
#=====================================================================

#******************************
#******* O B J E C T S ********
#******************************
EXEC=yourExecutable

SCR_OBJECTS=\
object1.o\
object2.o\
.
.
.
object8.o



#******************************

%.o: %.f77
$(FC) $(FFLAG) -c $<

%.o: %.f
$(FC) $(FFLAG) -c $<

all: $(EXEC)

clean:
rm $(EXEC) $(SCR_OBJECTS) *.mod

$(EXEC): $(SCR_OBJECTS)
$(FC) $(LFLAG) -o $(EXEC) $(SCR_OBJECTS) $(LIB_ALL)
 
Archimedes80,thanks a lot.But there is another issue,I am using two data files for input,where to put them?I mean that they don't go to this directory.
 
Still have problem:
#
F77= f77
FLAGS= -O3

# Executable
SURFACE: SURFCE.O PHASE.O D2AS6INC.F
$(F77) $(FLAGS) -O SURFACE SURFCE.O PHASE.O

# Object files
SURFCE.O: SURFCE.F PHASE.F D2AS6INC.F
$(F77) $(FLAGS) -C SURFCE.F -O SURFCE.O
PHASE.O: PHASE.F
$(F77) $(FLAGS) -C PHASE.F -O PHASE.O

This is what I get:
f77 -O3 -C SURFCE.F -O SURFCE.O
surfce:
gcc: SURFCE.O: No such file or directory
f77 -O3 -C PHASE.F -O PHASE.O
phase:
gcc: PHASE.O: No such file or directory
f77 -O3 -O SURFACE SURFCE.O PHASE.O
gcc: SURFACE: No such file or directory
gcc: SURFCE.O: No such file or directory
gcc: PHASE.O: No such file or directory
 
At a guess these things are case sensitive and the output file needs to be -o instead of -O. -O is normally for optimization.

Similarly, the object file would normally be a .o instead of a .O
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top