[petsc-users] PETSc + SLEPc makefile

jordi poblet jordi.poblet at gmail.com
Mon Sep 6 09:13:38 CDT 2010


Dear Matt,

Thank you for your answer. My problem was that I needed help with the
makefiles because I was not having success when compiling a program with
multiple C++ files using PETSc and SLEPc.
In addition, I was trying to write a makefile distinguishing between
compilation and linking (not to write everything in the same makefile
sentence).To do it, I was trying to "guess" the correct variables  to be
used for the case of PETSc + SLEPc in order to specify: compilation options,
include folders locations and library locations (${PETSC_INCLUDE},
${SLEPC_LIB},${SLEPC_INCLUDE} ...). And which of them should be used when
compiling and which others to be used when linking. I do not really
understand what a PETSc or SLEPc makefile is doing and so often I am lost
when I wish to modify something.

Dear Jose,

Thank you very much for your email and makefile example. Now I can compile
the code.

Best regards,

Jordi Poblet-Puig



On Mon, Sep 6, 2010 at 1:29 PM, Jose E. Roman <jroman at dsic.upv.es> wrote:

>
> El 06/09/2010, a las 13:01, jordi poblet escribió:
>
> > Dear all,
> >
> > I am trying to use PETSc and SLEPc but I have problems with the
> makefiles. Could someone provide me an example of makefiles that compiles
> multiple C++ files and include external libraries different than PETSc and
> SLEPc?
> >
> > In the makefile that I am trying to use (attached):
> >
> > -main.cpp: is the main file where some tests are done
> > -UsePETSc.cpp: A class that uses PETSc
> > -UseSLEPc.cpp: A class that uses SLEPc
> >
> > I have no problem when using UsePETSc.cpp without SLEPc or when compiling
> single examples that call SLEPc functions (with the makefiles provided in
> the SLEPc examples).
> > Sorry if this is not a purelly PETSc question but I have supposed that
> there is someone else here using also SLEPc.
> >
> > Thank you very much in advance,
> >
> > Jordi Poblet-Puig
> >
>
> Probably you need to add ${PETSC_INCLUDE} also to the UseSLEPc.o target.
> Anyway, your makefile does not seem to be well formed. Try the following:
>
> CFLAGS     = -I../MyIncludefiles -Wno-deprecated
> MYLIB      = -L../MyLibraries -lMyLibrary
> MYOBJS     = main.o UseSLEPc.o UsePETSc.o
> EXE        = MyExecutableFile
>
> all: ${EXE}
>
> include ${SLEPC_DIR}/conf/slepc_common
>
> ${EXE}: ${MYOBJS} chkopts
>        -${CLINKER} -o ${EXE} ${MYOBJS} ${MYLIB} ${SLEPC_LIB}
>        ${RM} ${MYOBJS}
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100906/3270023c/attachment.htm>


More information about the petsc-users mailing list