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 2> /dev/null`" != "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 2> /dev/null`" != "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# 143RUN_TEST = ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff 144 145check_install: check 146check: 147 -@echo "Running check examples to verify correct installation" 148 -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 149 @if [ "${PETSC_WITH_BATCH}" != "" ]; then \ 150 echo "Running with batch filesystem, cannot run make check"; \ 151 elif [ "${MPIEXEC}" = "/bin/false" ]; then \ 152 echo "*mpiexec not found*. cannot run make check"; \ 153 else \ 154 ${RM} -f check_error;\ 155 ${RUN_TEST} PETSC_OPTIONS="${PETSC_OPTIONS} ${PETSC_TEST_OPTIONS}" PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" check_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/check.log; \ 156 if [ -f check_error ]; then \ 157 echo "Error while running make check"; \ 158 ${RM} -f check_error;\ 159 exit 1; \ 160 fi; \ 161 ${RM} -f check_error;\ 162 fi; 163 164check_build: 165 +@cd src/snes/tutorials >/dev/null; ${RUN_TEST} clean-legacy 166 +@cd src/snes/tutorials >/dev/null; ${RUN_TEST} testex19 167 +@if [ ! "${MPI_IS_MPIUNI}" ]; then cd src/snes/tutorials >/dev/null; ${RUN_TEST} testex19_mpi; fi 168 +@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_SCALAR}" = "real" ]; then \ 169 if [ "${CUDA_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_cuda; \ 170 elif [ "${HIP_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_hip; \ 171 else HYPRE_TEST=runex19_hypre; fi; \ 172 cd src/snes/tutorials >/dev/null; ${RUN_TEST} $${HYPRE_TEST}; \ 173 fi; 174 +@if [ "${CUDA_LIB}" != "" ]; then \ 175 cd src/snes/tutorials >/dev/null; ${RUN_TEST} runex19_cuda; \ 176 fi; 177 +@if [ "${MPI_IS_MPIUNI}" = "" ]; then \ 178 cd src/snes/tutorials >/dev/null; \ 179 if [ "${KOKKOS_KERNELS_LIB}" != "" ] && [ "${PETSC_SCALAR}" = "real" ] && [ "${PETSC_PRECISION}" = "double" ]; then \ 180 ${RUN_TEST} runex3k_kokkos; \ 181 fi;\ 182 if [ "${MUMPS_LIB}" != "" ]; then \ 183 ${RUN_TEST} runex19_fieldsplit_mumps; \ 184 fi;\ 185 if [ "${SUITESPARSE_LIB}" != "" ]; then \ 186 ${RUN_TEST} runex19_suitesparse; \ 187 fi;\ 188 if [ "${SUPERLU_DIST_LIB}" != "" ]; then \ 189 ${RUN_TEST} runex19_superlu_dist; \ 190 fi;\ 191 if ( [ "${ML_LIB}" != "" ] || [ "${TRILINOS_LIB}" != "" ] ); then \ 192 ${RUN_TEST} runex19_ml; \ 193 fi; \ 194 ${RUN_TEST} clean-legacy; \ 195 cd - > /dev/null; \ 196 if [ "${AMREX_LIB}" != "" ]; then \ 197 echo "Running amrex test example to verify correct installation";\ 198 echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}";\ 199 cd src/ksp/ksp/tutorials/amrex >/dev/null;\ 200 ${RUN_TEST} clean-legacy; \ 201 ${RUN_TEST} testamrex; \ 202 ${RUN_TEST} clean-legacy; \ 203 cd - > /dev/null; \ 204 fi;\ 205 fi; 206 +@if [ "${HDF5_LIB}" != "" ]; then \ 207 cd src/vec/vec/tests >/dev/null;\ 208 ${RUN_TEST} clean-legacy; \ 209 ${RUN_TEST} runex47; \ 210 ${RUN_TEST} clean-legacy; \ 211 fi; 212 +@if [ "${MPI4PY}" = "yes" ]; then \ 213 cd src/sys/tests >/dev/null; \ 214 ${RUN_TEST} clean-legacy; \ 215 ${RUN_TEST} testex55; \ 216 ${RUN_TEST} clean-legacy; \ 217 fi; 218 +@if [ "${PETSC4PY}" = "yes" ]; then \ 219 cd src/ksp/ksp/tutorials >/dev/null; \ 220 ${RUN_TEST} clean-legacy; \ 221 ${RUN_TEST} testex100; \ 222 ${RUN_TEST} clean-legacy; \ 223 fi; 224 +@egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 225 if test -s .ftn.log; then \ 226 cd src/snes/tutorials >/dev/null; \ 227 ${RUN_TEST} clean-legacy; \ 228 ${RUN_TEST} testex5f; \ 229 ${RUN_TEST} clean-legacy; \ 230 fi; ${RM} .ftn.log; 231 +@egrep "^#define PETSC_HAVE_MATLAB_ENGINE 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 232 if test -s .ftn.log; then \ 233 cd src/vec/vec/tutorials >/dev/null; \ 234 ${RUN_TEST} clean-legacy; \ 235 ${RUN_TEST} testex31; \ 236 ${RUN_TEST} clean-legacy; \ 237 fi; ${RM} .ftn.log; 238 -@echo "Completed test examples" 239 240check_usermakefile: 241 -@echo "Testing compile with user makefile" 242 -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 243 @cd src/snes/tutorials; ${RUN_TEST} clean-legacy 244 @cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex19 245 @egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 246 if test -s .ftn.log; then \ 247 cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex5f; \ 248 fi; ${RM} .ftn.log; 249 @cd src/snes/tutorials; ${RUN_TEST} clean-legacy 250 -@echo "Completed compile with user makefile" 251 252checkgitclean: 253 @clean=`git status -s --untracked-files=no | wc -l`;\ 254 if [ $$clean != 0 ]; then \ 255 echo "The repository has uncommited files, cannot run checkclangformat" ;\ 256 git status -s --untracked-files=no ;\ 257 false;\ 258 fi; 259 260checkclangformatversion: 261 @version=`clang-format --version | cut -d" " -f3 | cut -d"." -f 1` ;\ 262 if [ "$$version" == "version" ]; then version=`clang-format --version | cut -d" " -f4 | cut -d"." -f 1`; fi;\ 263 if [ $$version -lt 14 ]; then echo "clang-format version is too old" ;false ; fi 264 265# Check that all the source code in the repository satisfies the .clang_format 266checkclangformat: checkclangformatversion checkgitclean clangformat 267 @clean=`git status -s --untracked-files=no | wc -l`;\ 268 if [ "$$clean" != "0" ]; then \ 269 git diff > ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.diff ;\ 270 echo "The current commit has source code formatting problems, check ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.diff" ;\ 271 git status -s --untracked-files=no ;\ 272 false;\ 273 fi; 274 275# Compare ABI/API of two versions of PETSc library with the old one defined by PETSC_{DIR,ARCH}_ABI_OLD 276abitest: 277 @if [ "${PETSC_DIR_ABI_OLD}" = "" ] || [ "${PETSC_ARCH_ABI_OLD}" = "" ]; \ 278 then printf "You must set environment variables PETSC_DIR_ABI_OLD and PETSC_ARCH_ABI_OLD to run abitest\n"; \ 279 exit 1; \ 280 fi; 281 -@echo "Comparing ABI/API of the following two PETSc versions (you must have already configured and built them using GCC and with -g):" 282 -@echo "=========================================================================================" 283 -@echo " Old: PETSC_DIR_ABI_OLD = ${PETSC_DIR_ABI_OLD}" 284 -@echo " PETSC_ARCH_ABI_OLD = ${PETSC_ARCH_ABI_OLD}" 285 -@pushd ${PETSC_DIR_ABI_OLD} >> /dev/null ; echo " Branch = "`git rev-parse --abbrev-ref HEAD` 286 -@echo " New: PETSC_DIR = ${PETSC_DIR}" 287 -@echo " PETSC_ARCH = ${PETSC_ARCH}" 288 -@echo " Branch = "`git rev-parse --abbrev-ref HEAD` 289 -@echo "=========================================================================================" 290 -@$(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 291 292# Compare ABI/API of current PETSC_ARCH/PETSC_DIR with a previous branch 293abitestcomplete: 294 -@if [[ -f "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log" ]]; then \ 295 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"` ;\ 296echo $${OPTIONS} ;\ 297 fi ; \ 298 if [[ "${PETSC_DIR_ABI_OLD}" != "" ]]; then \ 299 PETSC_DIR_OLD=${PETSC_DIR_ABI_OLD}; \ 300 else \ 301 PETSC_DIR_OLD=${PETSC_DIR}/../petsc-abi; \ 302 fi ; \ 303 echo "=================================================================================================" ;\ 304 echo "Doing ABI/API comparison between" ${branch} " and " `git rev-parse --abbrev-ref HEAD` "using " $${OPTIONS} ;\ 305 echo "=================================================================================================" ;\ 306 if [[ ! -d $${PETSC_DIR_OLD} ]]; then \ 307 git clone ${PETSC_DIR} $${PETSC_DIR_OLD} ; \ 308 else \ 309 cd $${PETSC_DIR_OLD} ; \ 310 git pull ; \ 311 fi ; \ 312 cd $${PETSC_DIR_OLD} ; \ 313 git checkout ${branch} ; \ 314 PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` ./configure $${OPTIONS} ; \ 315 PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` make all test ; \ 316 cd ${PETSC_DIR} ; \ 317 ./configure $${OPTIONS}; \ 318 make all test ; \ 319 PETSC_DIR_ABI_OLD=$${PETSC_DIR_OLD} PETSC_ARCH_ABI_OLD=arch-branch-`git rev-parse ${branch}` make abitest 320 321# Deletes PETSc libraries 322deletelibs: 323 -${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.* 324deletemods: 325 -${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod 326 327allclean: 328 -@${OMAKE} -f gmakefile clean 329 330clean:: allclean 331 332distclean: chk_petscdir 333 @if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then \ 334 echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***"; \ 335 mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/; fi 336 @echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***" 337 -${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/ 338 339 340# 341reconfigure: allclean 342 @unset MAKEFLAGS && ${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py 343# 344install: 345 @${PYTHON} ./config/install.py -destDir=${DESTDIR} 346 +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} petsc4py-install libmesh-install mfem-install slepc-install hpddm-install amrex-install bamg-install 347 348mpistreams: 349 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistreams 350 351mpistream: 352 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistream 353 354openmpstreams: 355 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstreams 356 357openmpstream: 358 +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstream 359 360# for legacy reasons 361stream: mpistream 362 363streams: mpistreams 364 365# ------------------------------------------------------------------ 366# 367# All remaining actions are intended for PETSc developers only. 368# PETSc users should not generally need to use these commands. 369# 370# See the users manual for how the tags files may be used from Emacs and Vi/Vim 371# 372alletags: 373 -@${PYTHON} lib/petsc/bin/maint/generateetags.py 374 -@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON 375 376# obtain gtags from https://www.gnu.org/software/global/ 377allgtags: 378 -@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 - 379 380allfortranstubs: 381 -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 382 @${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py ${BFORT} ${VERBOSE} 383 -@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py -merge ${VERBOSE} 384 -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 385deletefortranstubs: 386 -@find . -type d -name ftn-auto | xargs rm -rf 387 388# Build just manual pages + prerequisites 389# Also builds citations 390hloc=include/petsc/private 391allmanpages: chk_loc deletemanualpages 392 -sed -e 's?<T>?I?g' -e 's?<t>?i?g' -e 's?<Type>?PetscInt?g' ${hloc}/hashset.txt > ${hloc}/generated_hashset.txt 393 -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 394 -${RM} ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 395 -${OMAKE_SELF} ACTION=manualpages tree_src LOC=${LOC} 396 -@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap 397 -@cat ${PETSC_DIR}/doc/classic/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap 398 cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 399 a=`cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err | wc -l`; test ! $$a -gt 0 400 401# Build just manual examples + prerequisites 402allmanexamples: chk_loc allmanpages 403 -${OMAKE_SELF} ACTION=manexamples tree_basic LOC=${LOC} 404 405# Build all classic docs except html sources 406alldoc1: chk_loc allmanpages allmanexamples 407 -${OMAKE_SELF} manimplementations LOC=${LOC} 408 -${PYTHON} lib/petsc/bin/maint/wwwindex.py ${PETSC_DIR} ${LOC} 409 410# Builds .html versions of the source 411# html overwrites some stuff - hence this is done later. 412alldoc2: chk_loc allmanpages 413 -${OMAKE_SELF} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC} 414 415# A version which presumes allmanpages has already been run 416alldoc_post: chk_loc 417 -${OMAKE_SELF} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC} 418 419alldocclean: deletemanualpages allcleanhtml 420 421# Deletes man pages (.md version) 422deletemanualpages: chk_loc 423 -@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \ 424 find ${LOC}/docs/manualpages -type f -name "*.md" -exec ${RM} {} \; ;\ 425 ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\ 426 fi 427 428allcleanhtml: 429 -${OMAKE_SELF} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree 430 431# Builds simple html versions of the source without links into the $PETSC_ARCH/obj directory, used by make mergegcov 432srchtml: 433 -${OMAKE_SELF} ACTION=simplehtml PETSC_DIR=${PETSC_DIR} alltree_src 434 435########################################################### 436# targets to build distribution and update docs 437########################################################### 438 439# Creates ${HOME}/petsc.tar.gz [and petsc-with-docs.tar.gz] 440dist: 441 ${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} main 442 443########################################################### 444# 445# See script for details 446# 447gcov: 448 @$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py --run_gcov --petsc_arch ${PETSC_ARCH} 449 450mergegcov: 451 @$(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` 452 453# 454# ------------------------------------------------------------------------------- 455# 456# Some macros to check if the fortran interface is up-to-date. 457# 458countfortranfunctions: 459 -@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \ 460 cut -d'(' -f1 | tr -s ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \ 461 sed "s/_$$//" | sort > /tmp/countfortranfunctions 462 463countcfunctions: 464 -@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h | grep "(" | tr -s ' ' | \ 465 cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' | \ 466 tr 'A-Z' 'a-z' | sort | uniq > /tmp/countcfunctions 467 468difffortranfunctions: countfortranfunctions countcfunctions 469 -@echo -------------- Functions missing in the fortran interface --------------------- 470 -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 471 -@echo ----------------- Functions missing in the C interface ------------------------ 472 -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 473 -@${RM} /tmp/countcfunctions /tmp/countfortranfunctions 474 475checkbadfortranstubs: 476 -@echo "=========================================" 477 -@echo "Functions with MPI_Comm as an Argument" 478 -@echo "=========================================" 479 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \ 480 tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 481 -@echo "=========================================" 482 -@echo "Functions with a String as an Argument" 483 -@echo "=========================================" 484 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \ 485 tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 486 -@echo "=========================================" 487 -@echo "Functions with Pointers to PETSc Objects as Argument" 488 -@echo "=========================================" 489 -@cd ${PETSC_DIR}/src/fortran/auto; \ 490 _p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \ 491 cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \ 492 sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ 493 for OBJ in $$_p_OBJ; do \ 494 grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \ 495 cut -d'(' -f1 | cut -d' ' -f1,3; \ 496 done 497 498checkpackagetests: 499 -@echo "Missing package tests" 500 -@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 501 -@echo "Missing download package tests" 502 -@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 503 504.PHONY: info info_h all deletelibs allclean update \ 505 alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanpages \ 506 allcleanhtml countfortranfunctions \ 507 start_configure configure_petsc configure_clean matlabbin install 508