<div dir="ltr"><div>Thank you for your responses. The CXXPPFLAGS as mentioned by Satish makes it work.</div><div><br></div><div>Sincerely,</div><div>Swarnava<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 16, 2021 at 1:07 PM Satish Balay via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</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">BTW: Here is a simple makefile for multiple sources.<br>
<br>
>>>><br>
balay@sb /home/balay/tmp/prj/src<br>
$ ls<br>
main.cxx makefile sub.cxx<br>
balay@sb /home/balay/tmp/prj/src<br>
$ ls ../inc/<br>
mainc.h<br>
balay@sb /home/balay/tmp/prj/src<br>
$ cat makefile <br>
all: main<br>
<br>
CXXPPFLAGS = -I../inc<br>
LDLIBS = -lmv<br>
<br>
include ${PETSC_DIR}/lib/petsc/conf/variables<br>
include ${PETSC_DIR}/lib/petsc/conf/rules<br>
include ${PETSC_DIR}/lib/petsc/conf/test<br>
<br>
main: sub.o<br>
<<<<<<br>
<br>
We don't have a simple makefile for the use case where src, obj, binaries are in different locations.<br>
<br>
gmakefile.test has some code for it [this requires replacing 'lib/petsc/conf/test' with custom compile targets - as in gmakefile.test].<br>
<br>
[and what you have appears to work for this usecase.]<br>
<br>
Satish<br>
<br>
On Tue, 16 Feb 2021, Satish Balay via petsc-users wrote:<br>
<br>
> for CXX - its CXXPPFLAGS<br>
> <br>
> > >> > CPPFLAGS = -I ./inc -I ${MKLROOT}/include -L ${MKLROOT}/lib/<br>
> > >> -llapack-addons -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread<br>
> <br>
> The link options shouldn't go into preprocessor flags.<br>
> <br>
> Also duplicate blas with petsc might cause grief. Best to build petsc with mkl.<br>
> <br>
> <br>
> Satish<br>
> <br>
> On Tue, 16 Feb 2021, Matthew Knepley wrote:<br>
> <br>
> > On Tue, Feb 16, 2021 at 9:39 AM Jacob Faibussowitsch <<a href="mailto:jacob.fai@gmail.com" target="_blank">jacob.fai@gmail.com</a>><br>
> > wrote:<br>
> > <br>
> > > Swarnava,<br>
> > ><br>
> > > Perhaps try CXXFLAGS instead of CPPFLAGS. Alternatively, you may<br>
> > > explicitly declare a %.o: %.cc target and force it to include your CPPFLAGS.<br>
> > ><br>
> > <br>
> > No, do not do either of these things. We just need to figure out why it is<br>
> > not working for you. I will make a small example as soon as possible.<br>
> > <br>
> > Thanks,<br>
> > <br>
> > Matt<br>
> > <br>
> > <br>
> > > Best regards,<br>
> > ><br>
> > > Jacob Faibussowitsch<br>
> > > (Jacob Fai - booss - oh - vitch)<br>
> > > Cell: (312) 694-3391<br>
> > ><br>
> > > On Feb 16, 2021, at 08:42, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
> > ><br>
> > > On Mon, Feb 15, 2021 at 10:50 PM Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>> wrote:<br>
> > ><br>
> > >> Swarnava,<br>
> > >><br>
> > >> sddft.h is not a PETSc include file, nor is it used by PETSc so I think<br>
> > >> the issue is not directly to PETSc it is related to where sddft is on the<br>
> > >> machine and how it is found by your makefile.<br>
> > >><br>
> > ><br>
> > > Barry,<br>
> > ><br>
> > > His problem is that he is trying to put extra include flags on the compile<br>
> > > line, but it is not working. I am wondering if his make is malfunctioning.<br>
> > ><br>
> > > Thanks,<br>
> > ><br>
> > > Matt<br>
> > ><br>
> > ><br>
> > >> Barry<br>
> > >><br>
> > >><br>
> > >><br>
> > >> > On Feb 15, 2021, at 7:47 PM, Swarnava Ghosh <<a href="mailto:swarnava89@gmail.com" target="_blank">swarnava89@gmail.com</a>><br>
> > >> wrote:<br>
> > >> ><br>
> > >> > Dear Petsc developers and users,<br>
> > >> ><br>
> > >> > I am having some issue with building my code with the following<br>
> > >> makefile. I was earlier able to build this with the same makefile on a<br>
> > >> different machine. Would you please help me out on this issue?<br>
> > >> ><br>
> > >> > Contents of makefile:<br>
> > >> > ==============================================<br>
> > >> > all:sparc<br>
> > >> ><br>
> > >> > CPPFLAGS = -I ./inc -I ${MKLROOT}/include -L ${MKLROOT}/lib/<br>
> > >> -llapack-addons -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread<br>
> > >> ><br>
> > >> > SOURCECPP = ./src/main.cc ./src/initObjs.cc ./src/readfiles.cc ./src/<br>
> > >> energy.cc ./src/ExchangeCorrelation.cc ./src/occupation.cc ./src/<br>
> > >> poisson.cc ./src/chebyshev.cc ./src/scf.cc ./src/mixing.cc ./src/<br>
> > >> forces.cc ./src/relaxatoms.cc ./src/multipole.cc ./src/electrostatics.cc<br>
> > >> ./src/tools.cc<br>
> > >> ><br>
> > >> > SOURCEH = ./inc/sddft.h ./inc/isddft.h<br>
> > >> ><br>
> > >> > OBJSC = ./src/main.o ./src/initObjs.o ./src/readfiles.o ./src/energy.o<br>
> > >> ./src/ExchangeCorrelation.o ./src/occupation.o ./src/poisson.o<br>
> > >> ./src/chebyshev.o ./src/scf.o ./src/mixing.o ./src/forces.o<br>
> > >> ./src/relaxatoms.o ./src/multipole.o ./src/electrostatics.o ./src/tools.o<br>
> > >> ><br>
> > >> > LIBBASE = ./lib/sparc<br>
> > >> ><br>
> > >> > CLEANFILES = ./lib/sparc<br>
> > >> ><br>
> > >> > include ${PETSC_DIR}/lib/petsc/conf/variables<br>
> > >> > include ${PETSC_DIR}/lib/petsc/conf/rules<br>
> > >> ><br>
> > >> > sparc: ${OBJSC} chkopts<br>
> > >> > ${CLINKER} -Wall -o ${LIBBASE} ${OBJSC} ${PETSC_LIB}<br>
> > >> > ${RM} $(SOURCECPP:%.cc=%.o)<br>
> > >> ><br>
> > >> > ===========================================<br>
> > >> > Error:<br>
> > >> > /home/swarnava/petsc/linux-gnu-intel/bin/mpicxx -o src/main.o -c -g<br>
> > >> -I/home/swarnava/petsc/include<br>
> > >> -I/home/swarnava/petsc/linux-gnu-intel/include `pwd`/src/main.cc<br>
> > >> > /home/swarnava/Research/Codes/SPARC/src/main.cc(24): catastrophic<br>
> > >> error: cannot open source file "sddft.h"<br>
> > >> > #include "sddft.h"<br>
> > >> > ^<br>
> > >> > ====================================================<br>
> > >> ><br>
> > >> > It's not able to see the header file though I have -I ./inc in<br>
> > >> CPPFLAGS. The directory containing makefile has the directory "inc" with<br>
> > >> the headers and "src" with the .cc files.<br>
> > >> ><br>
> > >> > Thank you,<br>
> > >> > Swarnava<br>
> > >> ><br>
> > >> ><br>
> > >><br>
> > >><br>
> > ><br>
> > > --<br>
> > > What most experimenters take for granted before they begin their<br>
> > > experiments is infinitely more interesting than any results to which their<br>
> > > experiments lead.<br>
> > > -- Norbert Wiener<br>
> > ><br>
> > > <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
> > > <<a href="http://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">http://www.cse.buffalo.edu/~knepley/</a>><br>
> > ><br>
> > ><br>
> > ><br>
> > <br>
> > <br>
> <br>
<br>
</blockquote></div>