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