69217717 发表于 2008-5-15 16:03

求助makefile的编写

我的程序是用fortran编写的,中间有一个子程序用了petsc中的函数,编译的时候要单独对这个子函数进行编译,对于这样的问题,makefile要怎么写啊?
对于我们的程序:makefile如下
OBJ = femxr.o process.o elefun.omatconst.o \
      mindlinmxr3.o std.o matrop.o ioput.o elematrix.o compeigen.o \
      factor.o backsub.o skmult.o useful.o \
$ ALIBS = $(HOME)/mindlin/libarpack_linux.a $(HOME)/mindlin1/lapack_linux.a $(HOME)/mindlin1/blas_linux.a

femxr: $(OBJ)
f77$(OBJ) $(ALIBS) -o femxr
femxr.o: femxr.f eleblock labelblock metablock eigenblock printblock
process.o: process.f eigenblock
elefun.o: elefun.f
matconst.o: matconst.f
mindlinmxr3.o: mindlinmxr3.f eleblock labelblock eigenblock printblock
std.o: std.f
matrop.o: matrop.f eleblock labelblock metablock eigenblock
useful.o: useful.f
ioput.o: ioput.f labelblock printblock
elematrix.o: elematrix.f
compeigen.o: compeigen.f eigenblock
factor.o: factor.f
backsub.o: backsub.f
skmult.o:skmult.f

对于petsc,编译时makefile如下:


CFLAGS         =
FFLAGS          =
CPPFLAGS      =
FPPFLAGS      =
LOCDIR          = src/ksp/pc/examples/tests/
EXAMPLESC       = ex1.c ex2.c ex3.c ex4.c ex5.c ex6.c ex7.c
EXAMPLESF       = ex8f.F
MANSEC          = PC
include ${PETSC_DIR}/bmake/common/base
ex1: ex1.o   chkopts
-${CLINKER} -o ex1 ex1.o ${PETSC_KSP_LIB}
${RM} ex1.o
#------------------------------------------------------------------
runex1:
-@${MPIEXEC} -np 1 ./ex1 > ex1_1.tmp 2>&1;   \
    if (${DIFF} output/ex1_1.out ex1_1.tmp) then true; \
    else echo "Possible problem with ex1_1, diffs above"; fi; \
    ${RM} -f ex1_1.tmp
TESTEXAMPLES_C    = ex1.PETSc runex1 ex1.rm
TESTEXAMPLES_C_X11_MPIUNI = ex1.PETSc runex1 ex1.rm
include ${PETSC_DIR}/bmake/common/test

对于我的程序要怎么办啊,急急急~~~
页: [1]
查看完整版本: 求助makefile的编写