admin wrote:The following should work
- Code: Select all
GF = gfortran
FCOPTIM = -O3
FCFLAGS = $(FCOPTIM)
CCFLAGS = -O3 -m64
LIBDIR =/home/hu/zhaoran/lap_test
LIBS =-L$(LIBDIR) -llapack -lrefblas
OBJECTS1 = main.o
Main : $(OBJECTS1)
$(GF) $(CCFLAGS) -o Main $(OBJECTS1) $(LIBS)
clean :
rm *.o
.SUFFIXES: .f90 .o
.f90.o:
$(GF) $(FCFLAGS) -c $< -o $@
Thank you ,Thank you very much!
but I also have another question. If there many files in the project ,but Iuse the lapack just in the file gmres.f90
how to edit the makefile?
the following is my makefile
--------------------------------------------------------------
FC = ifort
GF = gfortran
FCOPTIM =
FCFLAGS = $(FCOPTIM)
CCFLAGS = -O3 -m64
OBJECTS1 = module.o BDP.o cg.o coedge.o gas.o\
gmres.o gmres_sai.o intepol.o juhe_peizhi.o main.o \
mesh.o mlfma.o mm_ll.o \
pre.o precon.o sai.o sub.o \
translation.o vvv.o zmn.o
Main : $(OBJECTS1)
$(GF) -o MLFMA1 $(OBJECTS1) $(CCFLAGS)
clean :
rm *.o
module.o : module.f90
$(GF) -c $(CCFLAGS) module.f90
BDP.o : BDP.f90
$(GF) -c $(CCFLAGS) BDP.f90
cg.o : cg.f90
$(GF) -c $(CCFLAGS) cg.f90
coedge.o : coedge.f90
$(GF) -c $(CCFLAGS) coedge.f90
gas.o : gas.f90
$(GF) -c $(CCFLAGS) gas.f90
gmres.o : gmres.f90
$(GF) -c $(CCFLAGS) gmres.f90
gmres_sai.o : gmres_sai.f90
$(GF) -c $(CCFLAGS) gmres_sai.f90
intepol.o : intepol.f90
$(GF) -c $(CCFLAGS) intepol.f90
juhe_peizhi.o : juhe_peizhi.f90
$(GF) -c $(CCFLAGS) juhe_peizhi.f90
main.o : main.f90
$(GF) -c $(CCFLAGS) main.f90
mesh.o : mesh.f90
$(GF) -c $(CCFLAGS) mesh.f90
mlfma.o : mlfma.f90
$(GF) -c $(CCFLAGS) mlfma.f90
mm_ll.o : mm_ll.f90
$(GF) -c $(CCFLAGS) mm_ll.f90
pre.o : pre.f90
$(GF) -c $(CCFLAGS) pre.f90
precon.o : precon.f90
$(GF) -c $(CCFLAGS) precon.f90
sai.o : sai.f90
$(GF) -c $(CCFLAGS) sai.f90
sub.o : sub.f90
$(GF) -c $(CCFLAGS) sub.f90
translation.o : translation.f90
$(GF) -c $(CCFLAGS) translation.f90
vvv.o : vvv.f90
$(GF) -c $(CCFLAGS) vvv.f90
zmn.o : zmn.f90
$(GF) -c $(CCFLAGS) zmn.f90