10.1.9. Compiling and Linking Fortran Programs

Up: Contents Next: Routines with Different Fortran Interfaces Previous: Setting Routines

Figure 21 shows a sample makefile that can be used for PETSc programs. In this makefile, one can compile and run a debugging version of the Fortran program ex3.F with the actions make BOPT=g ex3 and make runex3, respectively. The compilation command is restated below:

   ex3: ex3.o  
           -${FLINKER} -o ex3 ex3.o  ${PETSC_FORTRAN_LIB} ${PETSC_LIB} 
           ${RM} ex3.o 
Note that the PETSc Fortran interface library, given by ${}PETSC_FORTRAN_LIB, must precede the base PETSc libraries, given by ${}PETSC_LIB, on the link line.


Up: Contents Next: Routines with Different Fortran Interfaces Previous: Setting Routines