<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div>  Alex,<div class=""><br class=""><div>   Since you are explicitly defining your rules you might as well just do it completely, so use something like</div><div><br class=""></div><div><blockquote type="cite" class=""><blockquote type="cite" class="">objects/%.o: src/%.c $(DEP)<br class="">               ${PCC} -c $< -o $@ <span style="font-family: Menlo; font-size: 14px;" class="">${PCC_FLAGS} ${PFLAGS} ${CCPPFLAGS}</span></blockquote></blockquote><div><br class=""></div>The P indicates either C and C flags or C++ compiler and its  flags if configure was run with --with-clanguage=c++ (not recommended).</div><div><br class=""></div><div>So if your code is C you can use </div><div><br class=""></div><div><br class=""><div><blockquote type="cite" class=""><blockquote type="cite" class="">${CC} -c $< -o $@ <span style="font-family: Menlo; font-size: 14px;" class="">${CC_FLAGS} ${CPP_FLAGS}</span></blockquote></blockquote><div><br class=""></div>if C++ use</div><div><br class=""></div><div><div><div><blockquote type="cite" class=""><blockquote type="cite" class="">${CXX} -c $< -o $@ <span style="font-family: Menlo; font-size: 14px;" class="">${</span><span style="font-family: Menlo; font-size: 14px;" class="">CXXPP_FLAGS</span><span style="font-family: Menlo; font-size: 14px;" class="">} ${</span><span style="font-family: Menlo; font-size: 14px;" class="">CXX_FLAGS</span><span style="font-family: Menlo; font-size: 14px;" class="">}</span></blockquote></blockquote><div class=""><blockquote type="cite" class=""><span style="font-family: Menlo; font-size: 14px;" class=""><br class=""></span></blockquote></div></div></div><br class=""></div><div>With this you don't need the COMPILE macros that are really internal for PETSc's use.</div><div><br class=""></div><div><br class=""></div>  Barry</div><div><br class=""></div><div>  We have not been completely successful at getting share/petsc/Makefile.user to be bullet proof yet, but if you can get it to work in your case great.</div><div><br class=""></div><div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class="">On Dec 15, 2020, at 11:46 AM, Alex Koshkarov <<a href="mailto:okoshkarov@tae.com" class="">okoshkarov@tae.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Thank you! <br class=""><br class="">It makes sense to use share/petsc/Makefile.user - I will try to understand it. However, can you please tell me what is the meaning of "_SINGLE" in "PETSC_COMPILE_SINGLE"? Does it mean compile only one source file?<br class=""><br class="">Best regards,<br class="">Alex Koshkarov.<br class=""><br class="">On 12/15/20, 9:25 AM, "Satish Balay" <<a href="mailto:balay@mcs.anl.gov" class="">balay@mcs.anl.gov</a>> wrote:<br class=""><br class="">    On Tue, 15 Dec 2020, Alex Koshkarov wrote:<br class=""><br class=""><blockquote type="cite" class="">Hi All,<br class=""><br class="">I have been using trivial makefile (see below) for the code which uses petsc. The makefile relies on variable PETSC_COMPILE which disappeared in new petsc version (absent in 3.14.2, but present in 3.13.4). What would be the right way to fix the makefile? (should I use something like PETSC_COMPILE_SINGLE ?).<br class=""></blockquote><br class="">    Yes - this change was a bugfix.<br class=""><br class=""><blockquote type="cite" class="">Is it a very bad practice to use such makefile?<br class=""></blockquote><br class="">    For most use cases the default targets work. However this usage [where sources and obj files are in different dirs] is not covered by them.<br class=""><br class="">    So - I think using such targets is appropriate.<br class=""><br class="">    There is also share/petsc/Makefile.user - which attempts to provide a portable way to create user makefiles [that don't rely on internals like PETSC_COMPILE_SINGLE] - but requires gnumake and pkgconfig<br class=""><br class="">    Satish<br class=""><br class=""><br class=""><blockquote type="cite" class=""><br class="">p.s. sorry if this is a duplicate message, I believe I sent the first one to the wrong address.<br class=""><br class="">Thank you very much,<br class="">Alex Koshkarov.<br class=""><br class=""><br class="">Example of makefile, it assumes sources in “src” and creats objects in “objects”:<br class=""><br class="">CPP := $(wildcard src/*.c)<br class="">DEP := $(wildcard src/*.h)<br class="">OBJ := $(addprefix objects/,$(notdir $(CPP:.c=.o)))<br class=""><br class="">include ${PETSC_DIR}/lib/petsc/conf/variables<br class="">include ${PETSC_DIR}/lib/petsc/conf/rules<br class=""><br class="">driver: $(OBJ)<br class="">                -${CLINKER} -o $@ $^ ${PETSC_LIB} ${EXTRALIBS} ${CFLAGS}<br class=""><br class="">objects/%.o: src/%.c $(DEP)<br class="">                ${PETSC_COMPILE} -c $< -o $@<br class=""><br class=""><br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></body></html>