<div dir="ltr">This is too verbose for what I have in mind. And it just points to Jacob's solution. And your hint was very (too) useful.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 13, 2022 at 9:49 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><br></div><a href="https://petsc.org/release/docs/manual/getting_started/?highlight=user%20makefile" target="_blank">https://petsc.org/release/docs/manual/getting_started/?highlight=user%20makefile</a><div><br></div><div>Search for <span style="font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">Writing Application Codes with PETSc</span></div><div><font face="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica Neue, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol"><br></font></div><div><font face="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica Neue, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol">Perhaps this needs to clearer or have links to it from the FAQ.</font></div><div><font face="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica Neue, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol"><br></font><div><br></div><div><br><blockquote type="cite"><div>On Jan 13, 2022, at 9:38 PM, Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:</div><br><div><div dir="ltr">I am finding it pretty hard to find an example of a makefile target to build an app with PETSc. <div><br></div><div>I can not find it on the docs page.</div><div><br></div><div>With Google:<br><div><br></div><div>Victor has a little example that looks fine ($PETSC_LIB). (sort of, see below)<div><br></div><div>Another one is bigger and has this at the end:</div><div><br></div><div> -${CLINKER} $< -o bin.x $(OBJ_FILES) ${PETSC_KSP_LIB} -I$(PETSC_DIR)/include<br></div><div><br></div><div>I recall using PETSC_KSP_LIB the last time I wrote a makefile 20 years ago.</div></div></div><div><br></div><div>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):</div><div><br></div><div><i>PETSc linking<br><br>The easiest way to link PETSc to your code is to have this line in your makefile:<br><br>include ${PETSC_DIR}/conf/base<br><br>This will automatically give you the compilation rules. For linking you then do:<br><br>${CLINKER} -o ex1 ex1.o ${PETSC_LIB}<br><br>(or FLINKER for fortran)<br><br>You can also use this include line:<br><br>include ${PETSC_DIR}/conf/variables<br><br>and then you have to give the compile rules yourself. In this case, do<br>something like<br><br>${CC} -c ex1.c ${PETSC_INCLUDE}<br><br>to compile. (This is for petsc version 3, for version 2 use<br><br>include ${PETSC_DIR}/bmake/common/base<br><br>and replace base by variables to omit petsc’s make rules.)<br><br>If you insist on having all the libraries and includes explicitly, use<br><br>make getlinklibs<br>make getincludedirs<br></i></div><div><i><br></i></div><div><br></div></div>
</div></blockquote></div><br></div></div></blockquote></div>