Hi Xiaoyin,

I'm not sure what I do is the most elegant, but it works well for me.
First, I use a program called makedepf90, which you can find here:

http://personal.inet.fi/private/erikedelmann/makedepf90/

This program was designed for f90 and modules and it creates the
dependency list you need to compile f90 programs. It puts this
in a .depend file.

Then, my makefile is simple:


==============================================================================
# Include the dependency-list created by makedepf90 below

include .depend


CFLAGS         =
FFLAGS         =
CPPFLAGS         =
FPPFLAGS         =

include ${PETSC_DIR}/conf/base

csemfwd: ${FOBJ}  chkopts
        -${FLINKER} -o csemfwd ${FOBJ} ${PETSC_FORTRAN_LIB} ${PETSC_KSP_LIB}


depend .depend:
        makedepf90 -o DO_NOT_COMPILE *.f *.F > .depend

==============================================================================


Of course, you can modify this to suit your own needs.


Good luck,

Randy M.


xiaoyin ji wrote:
> Hi,
> 
> I've got a .F90 code using PETSc ksp solver working, and now I'm
> trying to separate the module (which contains parameter define and
> PETSc include files) and main program into two .F90 files. I have
> trouble with the makefile now because I cannot find the example
> makefile for such purpose, it seems all PETSc example makefiles are
> for single code only.
> 
> Thank you very much!
> 
> Best,
> 
> Xiaoyin Ji
> 
> ----------------------------------------------
> 
> Xiaoyin Ji
> Graduate Student
> Department of Materials Science and Engineering
> North Carolina State University

Reply via email to