Makefile for compiling multiple source files
Satish Balay
balay at mcs.anl.gov
Mon May 14 11:10:10 CDT 2007
Looks like this is a problem with your mpif77.
What do you have for:
mpif77 -show
Did PETSc configure fine with it? Are you able to run PETSc examples?
cd src/ksp/ksp/examples/tutorials
make ex2
make ex2f
Satish
On Mon, 14 May 2007, Vijay M wrote:
> Satish,
>
> Thanks for the reply. I modified your makefile (which is quite close
> to what i had to start with) and when i run it, I get an error message
> to the effect
>
> mpif77 -c -fPIC -Wall -g -I/home/vijay/work/petsc
> -I/home/vijay/work/petsc/bmake/linux-gnu-c-debug
> -I/home/vijay/work/petsc/include -I/usr/include -o C.o C.F90
> g77: C.F90: linker input file unused because linking not done
>
> mpif77 -c -fPIC -Wall -g -o A.o A.f90
> g77: A.f90: linker input file unused because linking not done
>
> This is repeated for all source files. Hence when the linker command
> is issued, there are no object files created in my local directory. I
> observed this message previously and hence went through the manual cpp
> route. Do i have to set some environment or configuration variable to
> get this working ?
>
> Vijay
>
>
> On 5/14/07, Satish Balay <balay at mcs.anl.gov> wrote:
> >
> > On Mon, 14 May 2007, Vijay M wrote:
> >
> > > Hi,
> > >
> > > I've been trying to use PETSc for one of my projects lately and I was
> > > wondering how to create the makefile to compile multiple source files
> > > with and without PETSc calls in fortran efficiently. I am sure it is a
> > > newbie question but I could not find much information about this
> > > anywhere.
> > >
> > > For example, you could take 4 files. A.f90, B.f90 without petsc calls
> > > and C.f90 and D.f90 with petsc calls. If I were to compile them I have
> > > to use
> >
> > If C, D are PETSc sources, then they should be C.F90, D.F90 [not .f90
> > sufix]
> >
> > >
> > > f90 -c A.f90 -o A.o
> > > f90 -c B.f90 -o B.o
> > > cpp C.f90 -I<include dir> > Ctemp.f90
> > > f90 -c Ctemp.f90 -o C.o
> > > cpp D.f90 -I<include dir> > Dtemp.f90
> > > f90 -c Dtemp.f90 -o D.o
> > >
> > > g77 <PETSC options> A.o B.o C.o D.o -o out.exe
> >
> > this assumes A.o has the main subroutine - if not - you should list
> > the corresponding .o file first.
> >
> > >
> > > PETSc is configured to use g77 as the linker in my server but since I
> > > am compiling each file separately, I cannot quite use the linker
> > > directly (It treats the source as a linker script). Is there a
> > > simplified way to do this or have I missed something vital ?!
> >
> >
> > I'm attaching a suitable PETSc makefile for your config.
> >
> > Satish
> >
> > > I would appreciate any kind of help you can provide. If you need more
> > > information, let me know. Thanks.
> > >
> > > vijay
> > >
> > >
> >
>
>
More information about the petsc-users
mailing list