<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"><title></title><meta name="GENERATOR" content="OpenOffice.org 2.0-pre  (Linux)"><meta name="CREATED" content="20060724;16294600"><meta name="CHANGED" content="20060724;16314000">

        
        
        
        
        <style>
        &lt;!--
                @page { size: 21cm 29.7cm; margin: 2cm }
                P { margin-bottom: 0.21cm }
        --&gt;
        </style>

<p style="margin-bottom: 0cm;">Barry and Satish,</p>

<p style="margin-bottom: 0cm;">Than you very much for your useful answers. I finally can compile the code using both types of
makefiles.</p>

<p style="margin-bottom: 0cm;">Best regards,</p>

<p style="margin-bottom: 0cm;">Jordi Poblet<br>
</p>
<br><br><div><span class="gmail_quote">On 7/21/06, <b class="gmail_sendername">Barry Smith</b> &lt;<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>&nbsp;&nbsp; Jordi,<br><br>&nbsp;&nbsp;&nbsp;&nbsp; If you want to provide the rules to compile your code you<br>can instead just include bmake/common/variables this sets the variables<br>like ${PETSC_KSP_LIB} but you provide the rules for compiling.
<br><br>&nbsp;&nbsp; Satish,<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Do we have written down somewhere on the website for the two<br>ways of using PETSc makefiles? There should be the directions (that only<br>you know :-). Maybe in the FAQ?<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Barry<br>
<br><br>On Fri, 21 Jul 2006, jordi poblet wrote:<br><br>&gt; Satish,<br>&gt;<br>&gt; Thank you very much for your fast response. It has solved the problem with<br>&gt; including files and I can generate the object file for my class (
myclass.o).<br>&gt; However, I suppose that with<br>&gt;<br>&gt; ex1: myclass.o chkopts<br>&gt;<br>&gt; -${CLINKER} -o ex1 myclass.o&nbsp;&nbsp;${MY_LIB} ${PETSC_KSP_LIB}<br>&gt;&nbsp;&nbsp;${RM} myclass.o<br>&gt; the makefile is trying to link a self executable program (ex1) and I
<br>&gt; obtain the following error message:<br>&gt;<br>&gt; : undefined reference to `main'<br>&gt; (in myclass.cpp there is no main block, the class is used by main.cpp).<br>&gt;<br>&gt; I would like,<br>&gt;<br>&gt; 1-compile the class and obtain the file 
myclass.o (now I can do it with the<br>&gt; error shown above, but the file is at least generated) taking into account<br>&gt; the correct includes (from PETSc and from other libraries). I do not need<br>&gt; the libraries in this step
<br>&gt; 2-compile all the other classes not using PETSc and obtain the other files<br>&gt; *.o<br>&gt; 3-link all the files *.o and myclass.o taking into account all the libraries<br>&gt;<br>&gt;<br>&gt; Thank you very much. Best regards,
<br>&gt;<br>&gt;<br>&gt; Jordi Poblet<br>&gt;<br>&gt;<br>&gt; On 7/21/06, Satish Balay &lt;<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; The basic form of a PETSc makefile is as follows:
<br>&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; CFLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =<br>&gt;&gt; FFLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =<br>&gt;&gt; CPPFLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =<br>&gt;&gt; FPPFLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =<br>&gt;&gt; CLEANFILES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =<br>&gt;&gt;<br>&gt;&gt; include ${PETSC_DIR}/bmake/common/base
<br>&gt;&gt;<br>&gt;&gt; ex1: ex1.o&nbsp;&nbsp;chkopts<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -${CLINKER} -o ex1 ex1.o&nbsp;&nbsp;${PETSC_KSP_LIB}<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ${RM} ex1.o<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; If you wish to specify additonal libraries - you can do it as:
<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt; MY_INC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= -I/my/include<br>&gt;&gt; MY_LIB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= -L/my/lib -lmy<br>&gt;&gt;<br>&gt;&gt; CFLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =<br>&gt;&gt; FFLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
<br>&gt;&gt; CPPFLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = ${MY_INC}<br>&gt;&gt; FPPFLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =<br>&gt;&gt; CLEANFILES&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =<br>&gt;&gt;<br>&gt;&gt; include ${PETSC_DIR}/bmake/common/base<br>&gt;&gt;<br>&gt;&gt; ex1: ex1.o&nbsp;&nbsp;chkopts<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -${CLINKER} -o ex1 
ex1.o&nbsp;&nbsp;${MY_LIB} ${PETSC_KSP_LIB}<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ${RM} ex1.o<br>&gt;&gt; &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; Also - you should make sure this library is compiled with the same<br>&gt;&gt; compilers as PETSc is compiled with.
<br>&gt;&gt;<br>&gt;&gt; Satish<br>&gt;&gt;<br>&gt;&gt; On Fri, 21 Jul 2006, jordi poblet wrote:<br>&gt;&gt;<br>&gt;&gt; &gt; Dear all,<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; I would like to use PETSc within a finite element program (the main part
<br>&gt;&gt; is<br>&gt;&gt; &gt; written in C++). Some classes should use PETSc routines and routines<br>&gt;&gt; from<br>&gt;&gt; &gt; other libraries. When compiling these classes, I have to include not<br>&gt;&gt; only
<br>&gt;&gt; &gt; the header files from PETSc (which in the examples of a single C or C++<br>&gt;&gt; &gt; files are included automatically with the sample makefiles provided in<br>&gt;&gt; the<br>&gt;&gt; &gt; manual) but also header files from the other used libraries. Finally, I
<br>&gt;&gt; &gt; would have also to link PETSc with other libraries at the same time.<br>&gt;&gt; &gt; I have tried to construct a makefile including 'by hand' the PETSc<br>&gt;&gt; headers<br>&gt;&gt; &gt; but I have always problems. Could someone help me? Have you got makefile
<br>&gt;&gt; &gt; examples for this situation (or similar)?<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; The compilation options for the PETSc library that I have employed are:<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; ./config/configure.py --with-mpi=0 --with-clanguage=c++
<br>&gt;&gt; &gt; --with-scalar-type=complex<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; tests and examples are passed correctly.<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; I am running PETSc in linux machines.<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; Thank you in advance,<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; Jordi Poblet<br>&gt;&gt; &gt;<br>&gt;&gt;<br>&gt;&gt;<br>&gt;<br><br></blockquote></div><br>