Skip to content
Browse files

build: split cxx [legacy] build target via SOURCECXX

  • Loading branch information...
1 parent cf583c3 commit f989d74195959015b6a8ca559f9cc7cf8db6f233 @balay balay committed Feb 18, 2014
View
2 conf/gmakegen.py
@@ -9,7 +9,7 @@
from cmakegen import defaultdict # collections.defaultdict, with fallback for python-2.4
PKGS = 'sys vec mat dm ksp snes ts tao'.split()
-LANGS = dict(c='C', cxx='C', cu='CU', F='F')
+LANGS = dict(c='C', cxx='CXX', cu='CU', F='F')
try:
all([True, True])
View
22 conf/rules
@@ -120,6 +120,8 @@ lib: ${SOURCE}
${OMAKE} PETSC_ARCH=${PETSC_ARCH} libcu; fi ; \
if [ "${SOURCEC}" != "" ] ; then \
${OMAKE} PETSC_ARCH=${PETSC_ARCH} libc; fi ; \
+ if [ "${SOURCECXX}" != "" ] ; then \
+ ${OMAKE} PETSC_ARCH=${PETSC_ARCH} libcxx; fi ; \
if [ "${SOURCEF}" != "" ] ; then \
${OMAKE} PETSC_ARCH=${PETSC_ARCH} libf; fi ; \
if [ "${OBJS}" != " " ] ; then \
@@ -150,6 +152,11 @@ libfastcompile:
${AR} ${FAST_AR_FLAGS} ${LIBNAME} ${OBJSC}; \
${RM} ${OBJSC} ${OBJSC:.o=.lo}; \
fi; \
+ if [ "${SOURCECXX}" != "" ]; then \
+ ${PETSC_CXXCOMPILE}; \
+ ${AR} ${FAST_AR_FLAGS} ${LIBNAME} ${OBJSCXX}; \
+ ${RM} ${OBJSCXX} ${OBJSCXX:.o=.lo}; \
+ fi; \
if [ "${SOURCEF}" != "" ]; then \
${PETSC_FCOMPILE}; \
${AR} ${FAST_AR_FLAGS} ${LIBNAME} ${OBJSF}; \
@@ -389,7 +396,7 @@ getautoconfargs:
fi; \
fi
-.c.o .cpp.o .cxx.o .cc.o .C.o .ad.o:
+.c.o .ad.o:
@if [ "${PETSCPORTABLE}" != "" ]; then \
${PYTHON} ${PETSC_DIR}/bin/portabilitycheck.py $< ${SOURCEH};\
fi
@@ -402,6 +409,19 @@ getautoconfargs:
${PYTHON} ${PETSC_DIR}/bin/portabilitycheck.py $*.o ; \
fi
+.cpp.o .cxx.o .cc.o .C.o:
+ @if [ "${PETSCPORTABLE}" != "" ]; then \
+ ${PYTHON} ${PETSC_DIR}/bin/portabilitycheck.py $< ${SOURCEH};\
+ fi
+ -@mypwd=`pwd`; newpwd=`echo $${mypwd} | sed "s+/examples/tutorials+DUMMY+g"`;\
+ if [ $${mypwd} != $${newpwd} ]; then \
+ ${OMAKE} PETSC_ARCH=${PETSC_ARCH} chk_petscdir;\
+ fi
+ ${PETSC_CXXCOMPILE_SINGLE} `pwd`/$<
+ @if [ "${PETSCPORTABLE}" != "" ]; then \
+ ${PYTHON} ${PETSC_DIR}/bin/portabilitycheck.py $*.o ; \
+ fi
+
#
# Compiles CUDA code
.cu.o:
View
41 conf/variables
@@ -31,23 +31,26 @@ F_SH_LIB_PATH = ${PETSC_F_SH_LIB_PATH}
# The following variables define PETSc compile procedures
#
PSOURCEC = $(SOURCEC:%=`pwd`/%)
+PSOURCECXX= $(SOURCECXX:%=`pwd`/%)
PSOURCECU = $(SOURCECU:%=`pwd`/%)
-PETSC_COMPILE = ${PCC} -c ${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS} ${PSOURCEC}
-PETSC_COMPILE_SINGLE = ${PCC} -o $*.o -c ${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}
-PETSC_FCOMPILE = ${FC} -c ${FC_FLAGS} ${FFLAGS} ${FCPPFLAGS} ${SOURCEF}
-PETSC_CUCOMPILE = ${CUDAC} ${CUDAC_FLAGS} -c --compiler-options="${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}" ${PSOURCECU}
-PETSC_CUCOMPILE_SINGLE= ${CUDAC} -o $*.o ${CUDAC_FLAGS} -c --compiler-options="${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}"
-#
-# define OBJSC and OBJSF OBJSCU
-OBJSC_TMP1 = $(SOURCEC:.c=.o)
-OBJSC_TMP2 = $(OBJSC_TMP1:.C=.o)
-OBJSC_TMP3 = $(OBJSC_TMP2:.cxx=.o)
-OBJSC = $(OBJSC_TMP3:.cpp=.o)
-OBJSF_TMP1 = $(SOURCEF:.F=.o)
-OBJSF_TMP2 = $(OBJSF_TMP1:.F90=.o)
-OBJSF_TMP3 = $(OBJSF_TMP2:.F95=.o)
-OBJSF = $(OBJSF_TMP3:.f=.o)
-OBJSCU = $(SOURCECU:.cu=.o)
+PETSC_COMPILE = ${PCC} -c ${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS} ${PSOURCEC}
+PETSC_CXXCOMPILE = ${CXX} -c ${CXX_FLAGS} ${CXXFLAGS} ${CCPPFLAGS} ${PSOURCECXX}
+PETSC_COMPILE_SINGLE = ${PCC} -o $*.o -c ${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}
+PETSC_CXXCOMPILE_SINGLE = ${CXX} -o $*.o -c ${CXX_FLAGS} ${CXXFLAGS} ${CCPPFLAGS}
+PETSC_FCOMPILE = ${FC} -c ${FC_FLAGS} ${FFLAGS} ${FCPPFLAGS} ${SOURCEF}
+PETSC_CUCOMPILE = ${CUDAC} ${CUDAC_FLAGS} -c --compiler-options="${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}" ${PSOURCECU}
+PETSC_CUCOMPILE_SINGLE = ${CUDAC} -o $*.o ${CUDAC_FLAGS} -c --compiler-options="${PCC_FLAGS} ${CFLAGS} ${CCPPFLAGS}"
+#
+# define OBJSC OBJSCXX and OBJSF OBJSCU
+OBJSC = $(SOURCEC:.c=.o)
+OBJSCXX_TMP1 = $(SOURCECXX:.C=.o)
+OBJSCXX_TMP2 = $(OBJSCXX_TMP1:.cxx=.o)
+OBJSCXX = $(OBJSCXX_TMP2:.cpp=.o)
+OBJSF_TMP1 = $(SOURCEF:.F=.o)
+OBJSF_TMP2 = $(OBJSF_TMP1:.F90=.o)
+OBJSF_TMP3 = $(OBJSF_TMP2:.F95=.o)
+OBJSF = $(OBJSF_TMP3:.f=.o)
+OBJSCU = $(SOURCECU:.cu=.o)
#
# The following additional variables are used by PETSc targets and should not be redefined
#
@@ -58,10 +61,10 @@ OBJSCU = $(SOURCECU:.cu=.o)
# SOURCED - sources/includes [but not fortran - for doc parsing?]
#
LIBNAME = ${INSTALL_LIB_DIR}/${LIBBASE}.${AR_LIB_SUFFIX}
-SOURCE = ${SOURCECU} ${SOURCEC} ${SOURCEF}
+SOURCE = ${SOURCECU} ${SOURCEC} ${SOURCECXX} ${SOURCEF}
OBJS = ${OBJSCU} ${OBJSC} ${OBJSF}
-SOURCEALL = ${SOURCECU} ${SOURCEC} ${SOURCEF} ${SOURCEH}
-SOURCED = ${SOURCECU} ${SOURCEC} ${SOURCEH}
+SOURCEALL = ${SOURCECU} ${SOURCEC} ${SOURCECXX} ${SOURCEF} ${SOURCEH}
+SOURCED = ${SOURCECU} ${SOURCEC} ${SOURCECXX} ${SOURCEH}
CLINKER = ${PCC_LINKER} ${PCC_LINKER_FLAGS} ${CFLAGS}
FLINKER = ${FC_LINKER} ${FC_LINKER_FLAGS} ${FFLAGS}
View
2 config/BuildSystem/config/packages/make.py
@@ -111,9 +111,11 @@ def configureCheckGNUMake(self):
# Check to see if make allows rules which look inside archives
if self.haveGNUMake:
self.addMakeRule('libc','${LIBNAME}(${OBJSC})')
+ self.addMakeRule('libcxx','${LIBNAME}(${OBJSCXX})')
self.addMakeRule('libcu','${LIBNAME}(${OBJSCU})')
else:
self.addMakeRule('libc','${OBJSC}','-${AR} ${AR_FLAGS} ${LIBNAME} ${OBJSC}')
+ self.addMakeRule('libcxx','${OBJSCXX}','-${AR} ${AR_FLAGS} ${LIBNAME} ${OBJSCXX}')
self.addMakeRule('libcu','${OBJSCU}','-${AR} ${AR_FLAGS} ${LIBNAME} ${OBJSCU}')
self.addMakeRule('libf','${OBJSF}','-${AR} ${AR_FLAGS} ${LIBNAME} ${OBJSF}')
return
View
5 config/cmakegen.py
@@ -170,9 +170,10 @@ def relpath(filename):
return os.path.join(root,filename)
sourcecu = makevars.get('SOURCECU','').split()
sourcec = makevars.get('SOURCEC','').split()
+ sourcecxx = makevars.get('SOURCECXX','').split()
sourcef = makevars.get('SOURCEF','').split()
- mistakes.compareSourceLists(root,sourcec+sourcef+sourcecu, files) # Diagnostic output about unused source files
- sources[repr(sorted(conditions))].extend(relpath(f) for f in sourcec + sourcef + sourcecu)
+ mistakes.compareSourceLists(root,sourcec+sourcecxx+sourcef+sourcecu, files) # Diagnostic output about unused source files
+ sources[repr(sorted(conditions))].extend(relpath(f) for f in sourcec + sourcecxx + sourcef + sourcecu)
allconditions[root] = conditions
return sources
View
2 src/dm/impls/moab/makefile
@@ -6,7 +6,7 @@ ALL: lib
CFLAGS =
FFLAGS =
-SOURCEC = dmmoab.cxx
+SOURCECXX= dmmoab.cxx
SOURCEF =
SOURCEH =
DIRS = examples
View
2 src/mat/impls/aij/mpi/clique/makefile
@@ -5,7 +5,7 @@ ALL: lib
CFLAGS =
FFLAGS =
-SOURCEC = clique.cxx
+SOURCECXX= clique.cxx
SOURCEF =
SOURCEH = matcliqueimpl.h
LIBBASE = libpetscmat
View
2 src/mat/impls/aij/mpi/mpiviennacl/makefile
@@ -3,7 +3,7 @@ ALL: lib
CFLAGS =
FFLAGS =
-SOURCEC = mpiaijviennacl.cxx
+SOURCECXX= mpiaijviennacl.cxx
SOURCEF =
SOURCEH =
LIBBASE = libpetscmat
View
2 src/mat/impls/aij/seq/seqviennacl/makefile
@@ -4,7 +4,7 @@ ALL: lib
CFLAGS =
FFLAGS =
-SOURCEC = aijviennacl.cxx
+SOURCECXX = aijviennacl.cxx
SOURCEF =
SOURCEH = viennaclmatimpl.h
LIBBASE = libpetscmat
View
2 src/mat/impls/elemental/makefile
@@ -3,7 +3,7 @@
ALL: lib
FFLAGS =
-SOURCEC = matelem.cxx
+SOURCECXX= matelem.cxx
SOURCEF =
SOURCEH = matelemimpl.h
LIBBASE = libpetscmat
View
2 src/vec/vec/impls/mpi/mpiviennacl/makefile
@@ -4,7 +4,7 @@ ALL: lib
CFLAGS = ${PNETCDF_INCLUDE}
FFLAGS =
-SOURCEC = mpiviennacl.cxx
+SOURCECXX= mpiviennacl.cxx
SOURCEF =
SOURCEH =
LIBBASE = libpetscvec
View
2 src/vec/vec/impls/seq/seqviennacl/makefile
@@ -4,7 +4,7 @@ ALL: lib
CFLAGS =
FFLAGS =
-SOURCEC = vecviennacl.cxx
+SOURCECXX= vecviennacl.cxx
SOURCEF =
SOURCEH = viennaclvecimpl.h
LIBBASE = libpetscvec

0 comments on commit f989d74

Please sign in to comment.
Something went wrong with that request. Please try again.