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