[petsc-users] Beginner : question about fortran modules and makefile

Satish Balay balay at mcs.anl.gov
Wed Jun 14 10:45:43 CDT 2017


attaching fixed files.

$ make test
mpif90 -c -fPIC -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g    -I/home/balay/tmp/petsc/include -I/home/balay/tmp/petsc/arch-linux2-c-debug/include    -o my_module.o my_module.F90
mpif90 -c -fPIC -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g    -I/home/balay/tmp/petsc/include -I/home/balay/tmp/petsc/arch-linux2-c-debug/include    -o test.o test.F90
mpif90 -fPIC -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g   -o test test.o my_module.o -Wl,-rpath,/home/balay/tmp/petsc/arch-linux2-c-debug/lib -L/home/balay/tmp/petsc/arch-linux2-c-debug/lib -Wl,-rpath,/home/balay/soft/mpich-3.3a2/lib -L/home/balay/soft/mpich-3.3a2/lib -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/7 -L/usr/lib/gcc/x86_64-redhat-linux/7 -lpetsc -llapack -lblas -lX11 -lpthread -lm -lmpifort -lgfortran -lm -lgfortran -lm -lquadmath -lmpicxx -lstdc++ -lm -Wl,-rpath,/home/balay/soft/mpich-3.3a2/lib -L/home/balay/soft/mpich-3.3a2/lib -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/7 -L/usr/lib/gcc/x86_64-redhat-linux/7 -ldl -Wl,-rpath,/home/balay/soft/mpich-3.3a2/lib -lmpi -lgcc_s -ldl 
$

Satish

On Wed, 14 Jun 2017, Fabien Tholin wrote:

> Hello,
> 
> I am a beginner with Petsc and i'm trying
> 
> to compile a very simple fortran program "test" with
> 
> a calling program in "test.F90" and a module "my_module.F90".
> 
> Unfortunately, i do not know how to write properly the makefile
> 
> to be able to compile the module with "#include petsc" statements inside:
> 
> I can not find any example on how to do it.
> 
> here is my non-working makefile:
> 
> 
> CFLAGS         =
> FFLAGS         =
> PETSC_DIR=/home/fab/Program/PETSC/petsc-3.7.6
> PETSC_ARCH=arch-linux2-c-debug
> FLINKER=mpif90
> CLINKER=mpicc
> 
> include ${PETSC_DIR}/lib/petsc/conf/variables
> include ${PETSC_DIR}/lib/petsc/conf/rules
> 
> list=my_module.o
> 
> test: test.o $(list) chkopts
>     -${FLINKER} -o test test.o  $(list)
> 
> my_module.o my_module.mod: my_module.F90
>     -${FLINKER} -c my_module.F90
> 
> 
> Thank you very much for helping me.
> 
> Regards,
> 
> Fabien THOLIN
> 
-------------- next part --------------
CFLAGS		 =
FFLAGS		 =

include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules

list = test.o my_module.o
test.o:my_module.o

test: ${list} chkopts
	-${FLINKER} -o test ${list} ${PETSC_LIB}
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: my_module.F90
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170614/5df7f0b2/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.F90
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170614/5df7f0b2/attachment-0001.ksh>


More information about the petsc-users mailing list