[petsc-dev] user makefile

Mark Adams mfadams at lbl.gov
Fri Jan 14 07:14:06 CST 2022


Bingo.

On Thu, Jan 13, 2022 at 10:48 PM Matthew Knepley <knepley at gmail.com> wrote:

> foo: foo .o
>       ${CLINKER} -o $@ $^ ${PETSC_LIB}
>
>    Matt
>
> On Thu, Jan 13, 2022 at 9:54 PM Jacob Faibussowitsch <jacob.fai at gmail.com>
> wrote:
>
>> Is share/petsc/Makefile.user what you are looking for?
>>
>> Best regards,
>>
>> Jacob Faibussowitsch
>> (Jacob Fai - booss - oh - vitch)
>>
>> On Jan 13, 2022, at 21:49, Barry Smith <bsmith at petsc.dev> wrote:
>>
>>
>>
>> https://petsc.org/release/docs/manual/getting_started/?highlight=user%20makefile
>>
>> Search for Writing Application Codes with PETSc
>>
>> Perhaps this needs to clearer or have links to it from the FAQ.
>>
>>
>>
>> On Jan 13, 2022, at 9:38 PM, Mark Adams <mfadams at lbl.gov> wrote:
>>
>> I am finding it pretty hard to find an example of a makefile target to
>> build an app with PETSc.
>>
>> I can not find it on the docs page.
>>
>> With Google:
>>
>> Victor has a little example that looks fine ($PETSC_LIB). (sort of, see
>> below)
>>
>> Another one is bigger and has this at the end:
>>
>>     -${CLINKER} $< -o bin.x $(OBJ_FILES) ${PETSC_KSP_LIB}
>> -I$(PETSC_DIR)/include
>>
>> I recall using PETSC_KSP_LIB the last time I wrote a makefile 20 years
>> ago.
>>
>> Maybe there should be a FAQ that a search would find like "Example of
>> user makefile" with something like Victor's (dropping v2 and updating it,
>> this looks wrong):
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *PETSc linkingThe easiest way to link PETSc to your code is to have this
>> line in your makefile:include ${PETSC_DIR}/conf/baseThis will automatically
>> give you the compilation rules. For linking you then do:${CLINKER} -o ex1
>> ex1.o ${PETSC_LIB}(or FLINKER for fortran)You can also use this include
>> line:include ${PETSC_DIR}/conf/variablesand then you have to give the
>> compile rules yourself. In this case, dosomething like${CC} -c ex1.c
>> ${PETSC_INCLUDE}to compile. (This is for petsc version 3, for version 2
>> useinclude ${PETSC_DIR}/bmake/common/baseand replace base by variables to
>> omit petsc’s make rules.)If you insist on having all the libraries and
>> includes explicitly, usemake getlinklibsmake getincludedirs*
>>
>>
>>
>>
>>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20220114/4d3fd3c2/attachment-0001.html>


More information about the petsc-dev mailing list