1# 2# This is the makefile for compiling PETSc. See 3# http://www.mcs.anl.gov/petsc/documentation/installation.html for directions on installing PETSc. 4# See also conf for additional commands. 5# 6ALL: all 7LOCDIR = ./ 8DIRS = src include tutorials interfaces share/petsc/matlab 9 10# next line defines PETSC_DIR and PETSC_ARCH if they are not set 11include ././${PETSC_ARCH}/lib/petsc/conf/petscvariables 12include ${PETSC_DIR}/lib/petsc/conf/variables 13include ${PETSC_DIR}/lib/petsc/conf/rules 14include ${PETSC_DIR}/lib/petsc/conf/test.common 15 16# This makefile contains a lot of PHONY targets with improperly specified prerequisites 17# where correct execution instead depends on the targets being processed in the correct 18# order. This is gross, but this makefile doesn't really do any work. Sub-makes still 19# benefit from parallelism. 20.NOTPARALLEL: 21 22OMAKE_SELF = $(OMAKE) -f makefile 23OMAKE_SELF_PRINTDIR = $(OMAKE_PRINTDIR) -f makefile 24 25# 26# Basic targets to build PETSc libraries. 27# 28all: 29 +@${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} chk_petscdir chk_upgrade | tee ${PETSC_ARCH}/lib/petsc/conf/make.log 30 @ln -sf ${PETSC_ARCH}/lib/petsc/conf/make.log make.log 31 +@(${OMAKE_SELF_PRINTDIR} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-local; echo "$$?" > ${PETSC_ARCH}/lib/petsc/conf/error.log) 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log 32 +@if [ `cat ${PETSC_ARCH}/lib/petsc/conf/error.log` != 0 ]; then \ 33 egrep '(out of memory allocating.*after a total of|gfortran: fatal error: Killed signal terminated program f951|f95: fatal error: Killed signal terminated program f951)' ${PETSC_ARCH}/lib/petsc/conf/make.log | tee ${PETSC_ARCH}/lib/petsc/conf/memoryerror.log > /dev/null; \ 34 if test -s ${PETSC_ARCH}/lib/petsc/conf/memoryerror.log; then \ 35 printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 36 echo " Error during compile, you need to increase the memory allocated to the VM and rerun " 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 37 printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 38 else \ 39 printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 40 echo " Error during compile, check ${PETSC_ARCH}/lib/petsc/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 41 echo " Send it and ${PETSC_ARCH}/lib/petsc/conf/configure.log to petsc-maint@mcs.anl.gov" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 42 printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 43 fi \ 44 else \ 45 ${OMAKE_SELF} print_mesg_after_build PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log ;\ 46 fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below 47 @echo "Finishing make run at `date +'%a, %d %b %Y %H:%M:%S %z'`" >> ${PETSC_ARCH}/lib/petsc/conf/make.log 48 @if [ `cat ${PETSC_ARCH}/lib/petsc/conf/error.log` != 0 ]; then exit 1; fi 49 50all-local: info libs matlabbin petsc4py-build libmesh-build mfem-build slepc-build hpddm-build amrex-build bamg-build 51 52# 53# Prints information about the system and version of PETSc being compiled 54# 55info: 56 -@echo "==========================================" 57 -@echo " " 58 -@echo "See documentation/faq.html and documentation/bugreporting.html" 59 -@echo "for help with installation problems. Please send EVERYTHING" 60 -@echo "printed out below when reporting problems. Please check the" 61 -@echo "mailing list archives and consider subscribing." 62 -@echo " " 63 -@echo " https://petsc.org/release/community/mailing/" 64 -@echo " " 65 -@echo "==========================================" 66 -@echo Starting make run on `hostname` at `date +'%a, %d %b %Y %H:%M:%S %z'` 67 -@echo Machine characteristics: `uname -a` 68 -@echo "-----------------------------------------" 69 -@echo "Using PETSc directory: ${PETSC_DIR}" 70 -@echo "Using PETSc arch: ${PETSC_ARCH}" 71 -@echo "-----------------------------------------" 72 -@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//" 73 -@echo "-----------------------------------------" 74 -@echo "Using configure Options: ${CONFIGURE_OPTIONS}" 75 -@echo "Using configuration flags:" 76 -@grep "\#define " ${PETSCCONF_H} 77 -@echo "-----------------------------------------" 78 -@echo "Using C compile: ${PETSC_CCOMPILE_SINGLE}" 79 -@if [ "${MPICC_SHOW}" != "" ]; then \ 80 printf "mpicc -show: %b\n" "${MPICC_SHOW}";\ 81 fi; \ 82 printf "C compiler version: %b\n" "${C_VERSION}"; \ 83 if [ "${CXX}" != "" ]; then \ 84 echo "Using C++ compile: ${PETSC_CXXCOMPILE_SINGLE}";\ 85 if [ "${MPICXX_SHOW}" != "" ]; then \ 86 printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \ 87 fi;\ 88 printf "C++ compiler version: %b\n" "${Cxx_VERSION}"; \ 89 fi 90 -@if [ "${FC}" != "" ]; then \ 91 echo "Using Fortran compile: ${PETSC_FCOMPILE_SINGLE}";\ 92 if [ "${MPIFC_SHOW}" != "" ]; then \ 93 printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \ 94 fi; \ 95 printf "Fortran compiler version: %b\n" "${FC_VERSION}"; \ 96 fi 97 -@if [ "${CUDAC}" != "" ]; then \ 98 echo "Using CUDA compile: ${PETSC_CUCOMPILE_SINGLE}";\ 99 fi 100 -@if [ "${CLANGUAGE}" = "CXX" ]; then \ 101 echo "Using C++ compiler to compile PETSc";\ 102 fi 103 -@echo "-----------------------------------------" 104 -@echo "Using C/C++ linker: ${PCC_LINKER}" 105 -@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}" 106 -@if [ "${FC}" != "" ]; then \ 107 echo "Using Fortran linker: ${FC_LINKER}";\ 108 echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\ 109 fi 110 -@echo "-----------------------------------------" 111 -@echo "Using system modules: ${LOADEDMODULES}" 112 -@if [ "${MPI_IS_MPIUNI}" = "1" ]; then \ 113 echo Using mpi.h: mpiuni; \ 114 else \ 115 TESTDIR=`mktemp -q -d -t petscmpi-XXXXXXXX` && \ 116 echo '#include <mpi.h>' > $${TESTDIR}/mpitest.c && \ 117 BUF=`${CPP} ${PETSC_CPPFLAGS} ${PETSC_CC_INCLUDES} $${TESTDIR}/mpitest.c |grep 'mpi\.h' | ( head -1 ; cat > /dev/null )` && \ 118 echo Using mpi.h: $${BUF}; ${RM} -rf $${TESTDIR}; \ 119 fi 120 -@echo "-----------------------------------------" 121 -@echo "Using libraries: ${PETSC_LIB}" 122 -@echo "------------------------------------------" 123 -@echo "Using mpiexec: ${MPIEXEC}" 124 -@echo "------------------------------------------" 125 -@echo "Using MAKE: $(MAKE)" 126 -@echo "Using MAKEFLAGS: -j$(MAKE_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)" 127 -@echo "==========================================" 128 129# 130# Build MatLab binaries 131# 132matlabbin: 133 -@if [ "${MATLAB_MEX}" != "" -a "${MATLAB_SOCKET}" != "" -a "${PETSC_SCALAR}" = "real" -a "${PETSC_PRECISION}" = "double" ]; then \ 134 echo "BEGINNING TO COMPILE MATLAB INTERFACE"; \ 135 if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc; fi; \ 136 if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab; fi; \ 137 cd src/sys/classes/viewer/impls/socket/matlab && ${OMAKE_SELF} matlabcodes PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR}; \ 138 echo "========================================="; \ 139 fi 140# 141# Builds PETSc check examples for a given architecture 142# 143check_install: check 144check: 145 -+@${OMAKE_SELF} PETSC_OPTIONS="${PETSC_OPTIONS} ${PETSC_TEST_OPTIONS}" PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} check_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/check.log 146checkx: 147 -@${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} checkx_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/checkx.log 148check_build: 149 -@echo "Running check examples to verify correct installation" 150 -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 151 +@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy 152 +@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex19 153 +@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ] && [ "${PETSC_SCALAR}" = "real" ]; then \ 154 if [ "${CUDA_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_cuda; \ 155 elif [ "${HIP_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_hip; \ 156 else HYPRE_TEST=runex19_hypre; \ 157 fi; \ 158 cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff $${HYPRE_TEST}; \ 159 fi; 160 +@if [ "${CUDA_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 161 cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_cuda; \ 162 fi; 163 +@if [ "${KOKKOS_KERNELS_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ] && [ "${PETSC_SCALAR}" = "real" ] && [ "${PETSC_PRECISION}" = "double" ] && [ "${MPI_IS_MPIUNI}" = "" ]; then \ 164 cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex3k_kokkos; \ 165 fi; 166 +@if [ "${MUMPS_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 167 cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_fieldsplit_mumps; \ 168 fi; 169 +@if [ "${SUPERLU_DIST_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 170 cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_superlu_dist; \ 171 fi; 172 +@if [ "${HDF5_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 173 cd src/vec/vec/tests >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex47; \ 174 fi; 175 +@if [ "${AMREX_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 176 echo "Running testamres examples to verify correct installation";\ 177 echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}";\ 178 cd src/ksp/ksp/tutorials/amrex >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy;\ 179 ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testamrex;\ 180 fi; 181 +@if ( [ "${ML_LIB}" != "" ] || [ "${TRILINOS_LIB}" != "" ] ) && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 182 cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_ml; \ 183 fi; 184 +@if [ "${SUITESPARSE_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 185 cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_suitesparse; \ 186 fi; 187 +@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex19.rm 188 +@if [ "${MPI4PY}" = "yes" ]; then \ 189 cd src/sys/tests >/dev/null; \ 190 ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex55; \ 191 fi; 192 +@if [ "${PETSC4PY}" = "yes" ]; then \ 193 cd src/ksp/ksp/tutorials >/dev/null; \ 194 ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy; \ 195 ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex100; \ 196 ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy; \ 197 fi; 198 +@egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 199 if test -s .ftn.log; then \ 200 cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex5f; \ 201 fi; ${RM} .ftn.log; 202 +@egrep "^#define PETSC_HAVE_MATLAB_ENGINE 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 203 if test -s .ftn.log; then \ 204 cd src/vec/vec/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex31; \ 205 fi; ${RM} .ftn.log; 206 +@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy 207 -@echo "Completed test examples" 208checkx_build: 209 -@echo "Running graphics check example to verify correct X11 installation" 210 -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 211 @cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy 212 @cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testxex19 213 @cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy 214 -@echo "Completed graphics check example" 215check_usermakefile: 216 -@echo "Testing compile with user makefile" 217 -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 218 @cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex19 219 @egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 220 if test -s .ftn.log; then \ 221 cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex5f; \ 222 fi; ${RM} .ftn.log; 223 @cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy 224 -@echo "Completed compile with user makefile" 225 226# Compare ABI/API of two versions of PETSc library with the old one defined by PETSC_{DIR,ARCH}_ABI_OLD 227abitest: 228 @if [ "${PETSC_DIR_ABI_OLD}" = "" ] || [ "${PETSC_ARCH_ABI_OLD}" = "" ]; \ 229 then printf "You must set environment variables PETSC_DIR_ABI_OLD and PETSC_ARCH_ABI_OLD to run abitest\n"; \ 230 exit 1; \ 231 fi; 232 -@echo "Comparing ABI/API of the following two PETSc versions (you must have already configured and built them using GCC and with -g):" 233 -@echo "=========================================================================================" 234 -@echo " Old: PETSC_DIR_ABI_OLD = ${PETSC_DIR_ABI_OLD}" 235 -@echo " PETSC_ARCH_ABI_OLD = ${PETSC_ARCH_ABI_OLD}" 236 -@pushd ${PETSC_DIR_ABI_OLD} >> /dev/null ; echo " Branch = "`git rev-parse --abbrev-ref HEAD` 237 -@echo " New: PETSC_DIR = ${PETSC_DIR}" 238 -@echo " PETSC_ARCH = ${PETSC_ARCH}" 239 -@echo " Branch = "`git rev-parse --abbrev-ref HEAD` 240 -@echo "=========================================================================================" 241 -@$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/abicheck.py -old_dir ${PETSC_DIR_ABI_OLD} -old_arch ${PETSC_ARCH_ABI_OLD} -new_dir ${PETSC_DIR} -new_arch ${PETSC_ARCH} -report_format html 242 243# Compare ABI/API of current PETSC_ARCH/PETSC_DIR with a previous branch 244abitestcomplete: 245 -@if [[ -f "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log" ]]; then \ 246 OPTIONS=`grep -h -m 1 "Configure Options: " ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log | sed "s!Configure Options: --configModules=PETSc.Configure --optionsModule=config.compilerOptions!!g"` ;\ 247echo $${OPTIONS} ;\ 248 fi ; \ 249 if [[ "${PETSC_DIR_ABI_OLD}" != "" ]]; then \ 250 PETSC_DIR_OLD=${PETSC_DIR_ABI_OLD}; \ 251 else \ 252 PETSC_DIR_OLD=${PETSC_DIR}/../petsc-abi; \ 253 fi ; \ 254 echo "=================================================================================================" ;\ 255 echo "Doing ABI/API comparison between" ${branch} " and " `git rev-parse --abbrev-ref HEAD` "using " $${OPTIONS} ;\ 256 echo "=================================================================================================" ;\ 257 if [[ ! -d $${PETSC_DIR_OLD} ]]; then \ 258 git clone ${PETSC_DIR} $${PETSC_DIR_OLD} ; \ 259 else \ 260 cd $${PETSC_DIR_OLD} ; \ 261 git pull ; \ 262 fi ; \ 263 cd $${PETSC_DIR_OLD} ; \ 264 git checkout ${branch} ; \ 265 PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` ./configure $${OPTIONS} ; \ 266 PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` make all test ; \ 267 cd ${PETSC_DIR} ; \ 268 ./configure $${OPTIONS}; \ 269 make all test ; \ 270 PETSC_DIR_ABI_OLD=$${PETSC_DIR_OLD} PETSC_ARCH_ABI_OLD=arch-branch-`git rev-parse ${branch}` make abitest 271 272# Deletes PETSc libraries 273deletelibs: 274 -${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.* 275deletemods: 276 -${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod 277 278allclean: 279 -@${OMAKE} -f gmakefile clean 280 281clean:: allclean 282 283distclean: chk_petscdir 284 @if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then \ 285 echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***"; \ 286 mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/; fi 287 @echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***" 288 -${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/ 289 290 291# 292reconfigure: allclean 293 @unset MAKEFLAGS && ${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py 294# 295install: 296 @${PYTHON} ./config/install.py -destDir=${DESTDIR} 297 +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} petsc4py-install libmesh-install mfem-install slepc-install hpddm-install amrex-install bamg-install 298 299mpistreams: 300 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistreams 301 302mpistream: 303 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistream 304 305openmpstreams: 306 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstreams 307 308openmpstream: 309 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstream 310 311# for legacy reasons 312stream: mpistream 313 314streams: mpistreams 315 316# ------------------------------------------------------------------ 317# 318# All remaining actions are intended for PETSc developers only. 319# PETSc users should not generally need to use these commands. 320# 321# See the users manual for how the tags files may be used from Emacs and Vi/Vim 322# 323alletags: 324 -@${PYTHON} lib/petsc/bin/maint/generateetags.py 325 -@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON 326 327# obtain gtags from https://www.gnu.org/software/global/ 328allgtags: 329 -@find ${PETSC_DIR}/include ${PETSC_DIR}/src -regex '\(.*makefile\|.*\.\(cc\|hh\|cpp\|cxx\|C\|hpp\|c\|h\|cu\|m\)$$\)' | grep -v ftn-auto | gtags -f - 330 331allfortranstubs: 332 -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 333 @${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py ${BFORT} ${VERBOSE} 334 -@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py -merge ${VERBOSE} 335 -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 336deletefortranstubs: 337 -@find . -type d -name ftn-auto | xargs rm -rf 338 339# Build just manual pages + prerequisites 340# Also builds citations 341hloc=include/petsc/private 342allmanpages: chk_loc deletemanualpages 343 -sed -e 's?<T>?I?g' -e 's?<t>?i?g' -e 's?<Type>?PetscInt?g' ${hloc}/hashset.txt > ${hloc}/generated_hashset.txt 344 -sed -e 's?<T>?IJ?g' -e 's?<t>?ij?g' -e 's?<Type>?struct {PetscInt i,j;}?g' ${hloc}/hashset.txt >> ${hloc}/generated_hashset.txt 345 -${RM} ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 346 -${OMAKE_SELF} ACTION=manualpages tree_basic LOC=${LOC} 347 -@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap 348 -@cat ${PETSC_DIR}/doc/classic/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap 349 cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 350 -a=`cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err | wc -l`; test ! $$a -gt 0 351 352# Build just manual examples + prerequisites 353allmanexamples: chk_loc allmanpages 354 -${OMAKE_SELF} ACTION=manexamples tree_basic LOC=${LOC} 355 356# Build all classic docs except html sources 357alldoc1: chk_loc allmanpages allmanexamples 358 -${OMAKE_SELF} manimplementations LOC=${LOC} 359 -${PYTHON} lib/petsc/bin/maint/wwwindex.py ${PETSC_DIR} ${LOC} 360 361# Builds .html versions of the source 362# html overwrites some stuff - hence this is done later. 363alldoc2: chk_loc allmanpages 364 -${OMAKE_SELF} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC} 365 366# A version which presumes allmanpages has already been run 367alldoc_post: chk_loc 368 -${OMAKE_SELF} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC} 369 370alldocclean: deletemanualpages allcleanhtml 371 372# Deletes man pages (.md version) 373deletemanualpages: chk_loc 374 -@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \ 375 find ${LOC}/docs/manualpages -type f -name "*.md" -exec ${RM} {} \; ;\ 376 ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\ 377 fi 378 379allcleanhtml: 380 -${OMAKE_SELF} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree 381 382# Builds simple html versions of the source without links into the $PETSC_ARCH/obj directory, used by make mergegcov 383srchtml: 384 -${OMAKE_SELF} ACTION=simplehtml PETSC_DIR=${PETSC_DIR} alltree_src 385 386########################################################### 387# targets to build distribution and update docs 388########################################################### 389 390# Creates ${HOME}/petsc.tar.gz [and petsc-with-docs.tar.gz] 391dist: 392 ${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} main 393 394########################################################### 395# 396# See script for details 397# 398gcov: 399 @$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py --run_gcov --petsc_arch ${PETSC_ARCH} 400 401mergegcov: 402 @$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py --merge_gcov --petsc_arch ${PETSC_ARCH} --merge_branch `lib/petsc/bin/maint/check-merge-branch.sh` 403 404# 405# ------------------------------------------------------------------------------- 406# 407# Some macros to check if the fortran interface is up-to-date. 408# 409countfortranfunctions: 410 -@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \ 411 cut -d'(' -f1 | tr -s ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \ 412 sed "s/_$$//" | sort > /tmp/countfortranfunctions 413 414countcfunctions: 415 -@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h | grep "(" | tr -s ' ' | \ 416 cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' | \ 417 tr 'A-Z' 'a-z' | sort | uniq > /tmp/countcfunctions 418 419difffortranfunctions: countfortranfunctions countcfunctions 420 -@echo -------------- Functions missing in the fortran interface --------------------- 421 -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 422 -@echo ----------------- Functions missing in the C interface ------------------------ 423 -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 424 -@${RM} /tmp/countcfunctions /tmp/countfortranfunctions 425 426checkbadfortranstubs: 427 -@echo "=========================================" 428 -@echo "Functions with MPI_Comm as an Argument" 429 -@echo "=========================================" 430 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \ 431 tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 432 -@echo "=========================================" 433 -@echo "Functions with a String as an Argument" 434 -@echo "=========================================" 435 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \ 436 tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 437 -@echo "=========================================" 438 -@echo "Functions with Pointers to PETSc Objects as Argument" 439 -@echo "=========================================" 440 -@cd ${PETSC_DIR}/src/fortran/auto; \ 441 _p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \ 442 cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \ 443 sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ 444 for OBJ in $$_p_OBJ; do \ 445 grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \ 446 cut -d'(' -f1 | cut -d' ' -f1,3; \ 447 done 448 449checkpackagetests: 450 -@echo "Missing package tests" 451 -@cat config/examples/*.py > configexamples; pushd config/BuildSystem/config/packages/; packages=`ls *.py | sed "s/\\.py//g"`;popd; for i in $${packages}; do j=`echo $${i} | tr '[:upper:]' '[:lower:]'`; printf $${j} ; egrep "(with-$${j}|download-$${j})" configexamples | grep -v "=0" | wc -l ; done 452 -@echo "Missing download package tests" 453 -@cat config/examples/*.py > configexamples; pushd config/BuildSystem/config/packages/; packages=`grep -l "download " *.py | sed "s/\\.py//g"`;popd; for i in $${packages}; do j=`echo $${i} | tr '[:upper:]' '[:lower:]'`; printf $${j} ; egrep "(download-$${j})" configexamples | grep -v "=0" | wc -l ; done 454 455.PHONY: info info_h all deletelibs allclean update \ 456 alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \ 457 allhtml allcleanhtml countfortranfunctions \ 458 start_configure configure_petsc configure_clean matlabbin install 459