1753a1a87SJed Brown# 24c512586SBarry Smith# See https://petsc.org/release/install/ for instructions on installing PETSc 3753a1a87SJed Brown# 44c512586SBarry Smith# This is the top level makefile for compiling PETSc. 54c512586SBarry Smith# * make help - useful messages on functionality 6a2dd8f59SBarry Smith# * make all - compile the PETSc libraries and utilities, run after ./configure 74c512586SBarry Smith# * make check - runs a quick test that the libraries are built correctly and PETSc applications can run 84c512586SBarry Smith# 94c512586SBarry Smith# * make install - for use with ./configure is run with the --prefix=directory option 104c512586SBarry Smith# * make test - runs a comprehensive test suite (requires gnumake) 114c512586SBarry Smith# * make docs - build the entire PETSc website of documentation (locally) 124c512586SBarry Smith# * a variety of rules that print library properties useful for building applications (use make help) 134c512586SBarry Smith# * a variety of rules for PETSc developers 144c512586SBarry Smith# 154c512586SBarry Smith# gmakefile - manages the compiling PETSc in parallel 164c512586SBarry Smith# gmakefile.test - manages running the comprehensive test suite 174c512586SBarry Smith# 184c512586SBarry Smith# This makefile does not require GNUmake 19753a1a87SJed BrownALL: all 20753a1a87SJed Brown 21753a1a87SJed Brown# next line defines PETSC_DIR and PETSC_ARCH if they are not set 22af0996ceSBarry Smithinclude ././${PETSC_ARCH}/lib/petsc/conf/petscvariables 23ed5129f1SBarry Smithinclude ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscrules 24cb5db241SBarry Smithinclude ${PETSC_DIR}/lib/petsc/conf/rules_doc.mk 25cb5db241SBarry Smithinclude ${PETSC_DIR}/lib/petsc/conf/rules_util.mk 26753a1a87SJed Brown 27fa2665b1SJed Brown# This makefile contains a lot of PHONY targets with improperly specified prerequisites 28fa2665b1SJed Brown# where correct execution instead depends on the targets being processed in the correct 294c512586SBarry Smith# order. 30fa2665b1SJed Brown.NOTPARALLEL: 31fa2665b1SJed Brown 320e03b746SBarry SmithOMAKE_SELF = $(OMAKE) -f makefile 330e03b746SBarry SmithOMAKE_SELF_PRINTDIR = $(OMAKE_PRINTDIR) -f makefile 3490096519SBarry SmithPETSCCONF_H = ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h 350e03b746SBarry Smith 364c512586SBarry Smith#********* Rules for make all ********************************************************************************************************************************** 374c512586SBarry Smith 38dd8585cdSJed Brownall: 3908147ea0SBarry Smith +@${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} chk_upgrade | tee ${PETSC_ARCH}/lib/petsc/conf/make.log 40af0996ceSBarry Smith @ln -sf ${PETSC_ARCH}/lib/petsc/conf/make.log make.log 410093410fSSatish Balay +@(${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 422b38c152SPierre Jolivet +@if [ "`cat ${PETSC_ARCH}/lib/petsc/conf/error.log 2> /dev/null`" != "0" ]; then\ 43f53b81b6SPierre Jolivet grep -E '(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;\ 440093410fSSatish Balay if test -s ${PETSC_ARCH}/lib/petsc/conf/memoryerror.log; then\ 4571488455SBarry Smith printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 4671488455SBarry Smith 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;\ 4771488455SBarry Smith printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 480093410fSSatish Balay else\ 49af0996ceSBarry Smith printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 50af0996ceSBarry Smith echo " Error during compile, check ${PETSC_ARCH}/lib/petsc/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 51af0996ceSBarry Smith 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;\ 527e4ff156SBarry Smith if [ "X${CONDA_ACTIVE}" != "X" ]; then\ 537e4ff156SBarry Smith echo " Having Conda in your shell may have caused this problem, consider turning off Conda." 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 547e4ff156SBarry Smith fi ;\ 55af0996ceSBarry Smith printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 560093410fSSatish Balay fi\ 57753a1a87SJed Brown else\ 580e03b746SBarry Smith ${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 ;\ 59753a1a87SJed Brown fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below 604dcdf380SSatish Balay @echo "Finishing make run at `date +'%a, %d %b %Y %H:%M:%S %z'`" >> ${PETSC_ARCH}/lib/petsc/conf/make.log 612b38c152SPierre Jolivet @if [ "`cat ${PETSC_ARCH}/lib/petsc/conf/error.log 2> /dev/null`" != "0" ]; then exit 1; fi 62753a1a87SJed Brown 63a2dd8f59SBarry Smithall-local: info libs matlabbin ${PETSC_POST_BUILDS} 64fa2665b1SJed Brown 659e423941SBarry Smith${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/files: 669e423941SBarry Smith @touch -t 197102020000 ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/files 679e423941SBarry Smith 689e423941SBarry Smith${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles: 699e423941SBarry Smith @${MKDIR} -p ${PETSC_DIR}/${PETSC_ARCH}/tests && touch -t 197102020000 ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles 709e423941SBarry Smith 714c512586SBarry Smithchk_upgrade: 724c512586SBarry Smith -@PETSC_DIR=${PETSC_DIR} ${PYTHON} ${PETSC_DIR}/lib/petsc/bin/petscnagupgrade.py 73753a1a87SJed Brown 74d2b3add8SSatish Balaymatlabbin: 754242cbabSBarry Smith -@if [ "${MATLAB_MEX}" != "" -a "${MATLAB_SOCKET}" != "" -a "${PETSC_SCALAR}" = "real" -a "${PETSC_PRECISION}" = "double" ]; then\ 7601e1867fSPierre Jolivet echo "Compiling MATLAB interface";\ 77d2b3add8SSatish Balay if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc; fi;\ 78d2b3add8SSatish Balay if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab; fi;\ 79b75c6efcSBarry Smith cd src/sys/classes/viewer/impls/socket/mex-scripts && ${OMAKE_SELF} mex-scripts PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR};\ 80d2b3add8SSatish Balay echo "=========================================";\ 81d2b3add8SSatish Balay fi 824c512586SBarry Smith 83ce78bad3SBarry Smithfortranbindings: deletefortranbindings 844cc8716dSJose E. Roman @${PYTHON} lib/petsc/bin/generatefortranbindings.py --petsc-dir=${PETSC_DIR} --petsc-arch=${PETSC_ARCH} 85e0b6f24eSSatish Balay 864c512586SBarry Smithdeleteshared: 874c512586SBarry Smith @for LIBNAME in ${SHLIBS};\ 884c512586SBarry Smith do\ 898143cb67SSatish Balay if [ -d ${INSTALL_LIB_DIR}/$${LIBNAME}$${LIB_NAME_SUFFIX}.dylib.dSYM ]; then\ 908143cb67SSatish Balay echo ${RM} -rf ${INSTALL_LIB_DIR}/$${LIBNAME}$${LIB_NAME_SUFFIX}.dylib.dSYM;\ 918143cb67SSatish Balay ${RM} -rf ${INSTALL_LIB_DIR}/$${LIBNAME}$${LIB_NAME_SUFFIX}.dylib.dSYM;\ 924c512586SBarry Smith fi;\ 938143cb67SSatish Balay echo ${RM} ${INSTALL_LIB_DIR}/$${LIBNAME}$${LIB_NAME_SUFFIX}.${SL_LINKER_SUFFIX};\ 948143cb67SSatish Balay ${RM} ${INSTALL_LIB_DIR}/$${LIBNAME}$${LIB_NAME_SUFFIX}.${SL_LINKER_SUFFIX};\ 954c512586SBarry Smith done 964c512586SBarry Smith @if [ -f ${INSTALL_LIB_DIR}/so_locations ]; then\ 974c512586SBarry Smith echo ${RM} ${INSTALL_LIB_DIR}/so_locations;\ 984c512586SBarry Smith ${RM} ${INSTALL_LIB_DIR}/so_locations;\ 994c512586SBarry Smith fi 1004c512586SBarry Smith 101ce78bad3SBarry Smithdeletefortranbindings: 10266e78cabSBarry Smith -@find src -type d -name ftn-auto* | xargs rm -rf 103a7a36ba3SJacob Faibussowitsch -@if [ -n "${PETSC_ARCH}" ] && [ -d ${PETSC_ARCH} ] && [ -d ${PETSC_ARCH}/src ]; then\ 10466e78cabSBarry Smith find ${PETSC_ARCH}/src -type d -name ftn-auto* | xargs rm -rf ;\ 10566e78cabSBarry Smith fi 1064c512586SBarry Smith 1074c512586SBarry Smithreconfigure: allclean 1084c512586SBarry Smith @unset MAKEFLAGS && ${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py 1094c512586SBarry Smith 1104c512586SBarry Smithchkopts: 1114c512586SBarry Smith -@echo "Warning: chkopts target is deprecated and can be removed from user makefiles" 1124c512586SBarry Smith 1134c512586SBarry Smithgnumake: 1144c512586SBarry Smith +@echo "make gnumake is deprecated, use make libs" 1154c512586SBarry Smith +@make libs 1164c512586SBarry Smith 1174c512586SBarry Smith# ******** Rules for make check **************************************************************************************************************************** 1184c512586SBarry Smith 11927cb8d94SBarry SmithRUN_TEST = ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff 12027cb8d94SBarry Smith 121a2dd8f59SBarry Smithcheck: check_body ${PETSC_POST_CHECKS} 122a2dd8f59SBarry Smith 1230e03b746SBarry Smithcheck_install: check 124a2dd8f59SBarry Smith 125a2dd8f59SBarry Smithcheck_body: 126275c7060SPierre Jolivet -@echo "Running PETSc check examples to verify correct installation" 127753a1a87SJed Brown -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 12827cb8d94SBarry Smith @if [ "${PETSC_WITH_BATCH}" != "" ]; then\ 12927cb8d94SBarry Smith echo "Running with batch filesystem, cannot run make check";\ 13027cb8d94SBarry Smith elif [ "${MPIEXEC}" = "/bin/false" ]; then\ 13127cb8d94SBarry Smith echo "*mpiexec not found*. cannot run make check";\ 13227cb8d94SBarry Smith else\ 13327cb8d94SBarry Smith ${RM} -f check_error;\ 1348940f7fdSBarry Smith ${RUN_TEST} OMP_NUM_THREADS=1 PETSC_OPTIONS="${EXTRA_OPTIONS} ${PETSC_TEST_OPTIONS}" PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" check_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/check.log;\ 13527cb8d94SBarry Smith if [ -f check_error ]; then\ 13627cb8d94SBarry Smith echo "Error while running make check";\ 13727cb8d94SBarry Smith ${RM} -f check_error;\ 13827cb8d94SBarry Smith exit 1;\ 13927cb8d94SBarry Smith fi;\ 14027cb8d94SBarry Smith ${RM} -f check_error;\ 14127cb8d94SBarry Smith fi; 14227cb8d94SBarry Smith 14327cb8d94SBarry Smithcheck_build: 14427cb8d94SBarry Smith +@cd src/snes/tutorials >/dev/null; ${RUN_TEST} clean-legacy 14527cb8d94SBarry Smith +@cd src/snes/tutorials >/dev/null; ${RUN_TEST} testex19 14627cb8d94SBarry Smith +@if [ ! "${MPI_IS_MPIUNI}" ]; then cd src/snes/tutorials >/dev/null; ${RUN_TEST} testex19_mpi; fi 147eff735b1SBarry Smith +@if [ "`grep -E '^#define PETSC_HAVE_HYPRE 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_HYPRE 1" ] && [ "${PETSC_SCALAR}" = "real" ]; then\ 148eff735b1SBarry Smith if [ "`grep -E '^#define PETSC_HAVE_CUDA 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_CUDA 1" ]; then HYPRE_TEST=runex19_hypre_cuda;\ 149eff735b1SBarry Smith elif [ "`grep -E '^#define PETSC_HAVE_HIP 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_HIP 1" ]; then HYPRE_TEST=runex19_hypre_hip;\ 15027cb8d94SBarry Smith else HYPRE_TEST=runex19_hypre; fi;\ 15127cb8d94SBarry Smith cd src/snes/tutorials >/dev/null; ${RUN_TEST} $${HYPRE_TEST};\ 15227cb8d94SBarry Smith fi; 153eff735b1SBarry Smith +@if [ "`grep -E '^#define PETSC_HAVE_CUDA 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_CUDA 1" ]; then\ 15427cb8d94SBarry Smith cd src/snes/tutorials >/dev/null; ${RUN_TEST} runex19_cuda;\ 15527cb8d94SBarry Smith fi; 1563e0e9f3fSSatish Balay +@if [ "`grep -E '^#define PETSC_HAVE_HIP 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_HIP 1" ]; then\ 1573e0e9f3fSSatish Balay cd src/snes/tutorials >/dev/null; ${RUN_TEST} runex19_hip;\ 1583e0e9f3fSSatish Balay fi; 15927cb8d94SBarry Smith +@if [ "${MPI_IS_MPIUNI}" = "" ]; then\ 16027cb8d94SBarry Smith cd src/snes/tutorials >/dev/null;\ 161eff735b1SBarry Smith if [ "`grep -E '^#define PETSC_HAVE_KOKKOS_KERNELS 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_KOKKOS_KERNELS 1" ] && [ "${PETSC_SCALAR}" = "real" ] && [ "${PETSC_PRECISION}" = "double" ]; then\ 16227cb8d94SBarry Smith ${RUN_TEST} runex3k_kokkos;\ 163de5e753aSSatish Balay fi;\ 164eff735b1SBarry Smith if [ "`grep -E '^#define PETSC_HAVE_MUMPS 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_MUMPS 1" ]; then\ 16527cb8d94SBarry Smith ${RUN_TEST} runex19_fieldsplit_mumps;\ 16627cb8d94SBarry Smith fi;\ 167eff735b1SBarry Smith if [ "`grep -E '^#define PETSC_HAVE_SUITESPARSE 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_SUITESPARSE 1" ]; then\ 16827cb8d94SBarry Smith ${RUN_TEST} runex19_suitesparse;\ 16927cb8d94SBarry Smith fi;\ 170eff735b1SBarry Smith if [ "`grep -E '^#define PETSC_HAVE_SUPERLU_DIST 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_SUPERLU_DIST 1" ]; then\ 17127cb8d94SBarry Smith ${RUN_TEST} runex19_superlu_dist;\ 17227cb8d94SBarry Smith fi;\ 173eff735b1SBarry Smith if [ "`grep -E '^#define PETSC_HAVE_ML 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_ML 1" ] || [ "`grep -E '^#define PETSC_HAVE_TRILINOS 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_TRILINOS 1" ]; then\ 17427cb8d94SBarry Smith ${RUN_TEST} runex19_ml;\ 17527cb8d94SBarry Smith fi;\ 17627cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 17727cb8d94SBarry Smith cd - > /dev/null;\ 178eff735b1SBarry Smith if [ "`grep -E '^#define PETSC_HAVE_AMREX 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_AMREX 1" ] && [ "`grep -E '^#define PETSC_HAVE_CUDA 1' ${PETSCCONF_H}`" != "#define PETSC_HAVE_CUDA 1" ]; then\ 179bd579fedSSatish Balay echo "Running amrex test example to verify correct installation";\ 180bd579fedSSatish Balay echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}";\ 181bd579fedSSatish Balay cd src/ksp/ksp/tutorials/amrex >/dev/null;\ 18227cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 18327cb8d94SBarry Smith ${RUN_TEST} testamrex;\ 18427cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 18527cb8d94SBarry Smith cd - > /dev/null;\ 18627cb8d94SBarry Smith fi;\ 18727cb8d94SBarry Smith fi; 188eff735b1SBarry Smith +@if [ "`grep -E '^#define PETSC_HAVE_HDF5 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_HDF5 1" ]; then\ 18927cb8d94SBarry Smith cd src/vec/vec/tests >/dev/null;\ 19027cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 19127cb8d94SBarry Smith ${RUN_TEST} runex47;\ 19227cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 193bd579fedSSatish Balay fi; 194b6efb0a5SBarry Smith +@if [ "${MPI4PY}" = "yes" ]; then\ 195b6efb0a5SBarry Smith cd src/sys/tests >/dev/null;\ 19627cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 19727cb8d94SBarry Smith ${RUN_TEST} testex55;\ 19827cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 199b6efb0a5SBarry Smith fi; 200f9a62e05SPierre Jolivet +@if [ "`grep -E '^#define PETSC_HAVE_PETSC4PY 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_PETSC4PY 1" ]; then\ 201c4762a1bSJed Brown cd src/ksp/ksp/tutorials >/dev/null;\ 20227cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 20327cb8d94SBarry Smith ${RUN_TEST} testex100;\ 20427cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 2055061939cSBarry Smith fi; 206eff735b1SBarry Smith +@if [ "`grep -E '^#define PETSC_USE_FORTRAN_BINDINGS 1' ${PETSCCONF_H}`" = "#define PETSC_USE_FORTRAN_BINDINGS 1" ]; then\ 207bd579fedSSatish Balay cd src/snes/tutorials >/dev/null;\ 20827cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 20927cb8d94SBarry Smith ${RUN_TEST} testex5f;\ 21027cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 211eff735b1SBarry Smith fi; 212eff735b1SBarry Smith +@if [ "`grep -E '^#define PETSC_HAVE_MATLAB 1' ${PETSCCONF_H}`" = "#define PETSC_HAVE_MATLAB 1" ]; then\ 21366218dbdSBarry Smith cd src/vec/vec/tutorials >/dev/null;\ 21427cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 21527cb8d94SBarry Smith ${RUN_TEST} testex31;\ 21627cb8d94SBarry Smith ${RUN_TEST} clean-legacy;\ 217eff735b1SBarry Smith fi; 218275c7060SPierre Jolivet -@echo "Completed PETSc check examples" 21927cb8d94SBarry Smith 2204c512586SBarry Smith# ********* Rules for make install ******************************************************************************************************************* 2214c512586SBarry Smith 2224c512586SBarry Smithinstall: 2234c512586SBarry Smith @${PYTHON} ./config/install.py -destDir=${DESTDIR} 2244c512586SBarry Smith +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=$@ install-builtafterpetsc 2254c512586SBarry Smith 2264c512586SBarry Smith# A smaller install with fewer extras 2274c512586SBarry Smithinstall-lib: 2284c512586SBarry Smith @${PYTHON} ./config/install.py -destDir=${DESTDIR} -no-examples 2294c512586SBarry Smith +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=$@ install-builtafterpetsc 2304c512586SBarry Smith 2314c512586SBarry Smithinstall-builtafterpetsc: 2323c07e67fSJose E. Roman @if [ "${PETSC_POST_INSTALLS}" != "" ]; then ${OMAKE_SELF} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=${PETSC_INSTALL} ${PETSC_POST_INSTALLS}; fi 233a2dd8f59SBarry Smith @echo "*** Install of PETSc (and any other packages) complete ***" 2344c512586SBarry Smith 2354c512586SBarry Smith# Creates ${HOME}/petsc.tar.gz [and petsc-with-docs.tar.gz] 2364c512586SBarry Smithdist: 2374c512586SBarry Smith ${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} main 2384c512586SBarry Smith 239088deb40SBarry Smith# ******** Rules for running the full test suite ******************************************************************************************************** 240088deb40SBarry Smith 241088deb40SBarry SmithTESTMODE = testexamples 242088deb40SBarry SmithALLTESTS_CHECK_FAILURES = no 243088deb40SBarry SmithALLTESTS_MAKEFILE = ${PETSC_DIR}/gmakefile.test 244088deb40SBarry SmithVALGRIND=0 245088deb40SBarry Smithalltests: chk_in_petscdir ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles 246088deb40SBarry Smith -@${RM} -rf ${PETSC_ARCH}/lib/petsc/conf/alltests.log alltests.log 247088deb40SBarry Smith +@if [ -f ${PETSC_DIR}/share/petsc/examples/gmakefile.test ] ; then\ 248088deb40SBarry Smith ALLTESTS_MAKEFILE=${PETSC_DIR}/share/petsc/examples/gmakefile.test ;\ 249088deb40SBarry Smith ALLTESTSLOG=alltests.log ;\ 250088deb40SBarry Smith else\ 251088deb40SBarry Smith ALLTESTS_MAKEFILE=${PETSC_DIR}/gmakefile.test;\ 252088deb40SBarry Smith ALLTESTSLOG=${PETSC_ARCH}/lib/petsc/conf/alltests.log ;\ 253088deb40SBarry Smith ln -s $${ALLTESTSLOG} alltests.log ;\ 254088deb40SBarry Smith fi;\ 255088deb40SBarry Smith ${OMAKE} allgtest ALLTESTS_MAKEFILE=$${ALLTESTS_MAKEFILE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} MPIEXEC="${MPIEXEC}" DATAFILESPATH=${DATAFILESPATH} VALGRIND=${VALGRIND} 2>&1 | tee $${ALLTESTSLOG};\ 256088deb40SBarry Smith if [ x${ALLTESTS_CHECK_FAILURES} = xyes -a ${PETSC_PRECISION} != single ]; then\ 257088deb40SBarry Smith cat $${ALLTESTSLOG} | grep -E '(^not ok|not remade because of errors|^# No tests run)' | wc -l | grep '^[ ]*0$$' > /dev/null;\ 258088deb40SBarry Smith fi; 259088deb40SBarry Smith 260088deb40SBarry Smithallgtests-tap: allgtest-tap 261088deb40SBarry Smith +@${OMAKE} -f ${ALLTESTS_MAKEFILE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} check-test-errors 262088deb40SBarry Smith 263088deb40SBarry Smithallgtest-tap: ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles 2644efe1d1dSSatish Balay +@MAKEFLAGS="-j$(MAKE_TEST_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)" ${OMAKE} ${MAKE_SHUFFLE_FLG} -f ${ALLTESTS_MAKEFILE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} test OUTPUT=1 265088deb40SBarry Smith 266088deb40SBarry Smithallgtest: ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles 267088deb40SBarry Smith +@MAKEFLAGS="-j$(MAKE_TEST_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)" ${OMAKE} -k -f ${ALLTESTS_MAKEFILE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} test V=0 2>&1 | grep -E -v '^(ok [^#]*(# SKIP|# TODO|$$)|[A-Za-z][A-Za-z0-9_]*\.(c|F|cxx|F90).$$)' 268088deb40SBarry Smith 269088deb40SBarry Smithtest: 270088deb40SBarry Smith +${OMAKE} -f ${ALLTESTS_MAKEFILE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} test 271088deb40SBarry Smithcleantest: 272088deb40SBarry Smith +${OMAKE} -f ${ALLTESTS_MAKEFILE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} cleantest 273088deb40SBarry Smith 2744c512586SBarry Smith#********* Rules for cleaning *************************************************************************************************************************** 2754c512586SBarry Smith 2764c512586SBarry Smithdeletelibs: 2774c512586SBarry Smith -${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.* 2784c512586SBarry Smithdeletemods: 2794c512586SBarry Smith -${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod 2804c512586SBarry Smith 2814c512586SBarry Smithallclean: 2824c512586SBarry Smith -@${OMAKE} -f gmakefile clean 2834c512586SBarry Smith 2844c512586SBarry Smithclean:: allclean 2854c512586SBarry Smith 28608147ea0SBarry Smithdistclean: 2874c512586SBarry Smith @if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then\ 2884c512586SBarry Smith echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***";\ 289ae137055SSatish Balay mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/;\ 290ae137055SSatish Balay echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***";\ 291ae137055SSatish Balay ${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/ ;\ 292ae137055SSatish Balay else\ 293ae137055SSatish Balay echo "*** Build files in PETSC_ARCH=${PETSC_ARCH} not found. Skipping delete! ***";\ 294ae137055SSatish Balay fi 2954c512586SBarry Smith 2964c512586SBarry Smithinfo: 2971621140dSSatish Balay +@${OMAKE} -f gmakefile gmakeinfo 2984c512586SBarry Smith 2990e03b746SBarry Smithcheck_usermakefile: 300b752486dSSatish Balay -@echo "Testing compile with user makefile" 301b752486dSSatish Balay -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 30227cb8d94SBarry Smith @cd src/snes/tutorials; ${RUN_TEST} clean-legacy 303c4762a1bSJed Brown @cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex19 304fbf9dbe5SBarry Smith @grep -E "^#define PETSC_USE_FORTRAN_BINDINGS 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null;\ 305b752486dSSatish Balay if test -s .ftn.log; then\ 306c4762a1bSJed Brown cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex5f;\ 307b752486dSSatish Balay fi; ${RM} .ftn.log; 30827cb8d94SBarry Smith @cd src/snes/tutorials; ${RUN_TEST} clean-legacy 309b752486dSSatish Balay -@echo "Completed compile with user makefile" 310753a1a87SJed Brown 3118c5add6aSPierre Jolivet#********* Rules for formatting Fortran source ********************************************************************************************** 31273817b78SBarry Smith 31373817b78SBarry Smith# pip install fprettify 31473817b78SBarry Smithfprettify: 31502c639afSMartin Diehl @git ls-files "*.[hF]90" | xargs fprettify --indent 2 --line-length 1000 --whitespace 2 --whitespace-type F --case 1 0 1 0 --enable-replacements --c-relations 31673817b78SBarry Smith 31773817b78SBarry Smith# git clone https://github.com/louoberto/fortify.git && cd fortify && export PATH=$PATH:$(pwd)/source 31873817b78SBarry Smithfortify: 31973817b78SBarry Smith @files=`git ls-files "*.[hF]90"`; for i in $${files}; do fortify --tab_length 2 --lowercasing F $${i}; done 32073817b78SBarry Smith 3214c512586SBarry Smith#********* Rules for running clangformat ************************************************************************************************************ 3224c512586SBarry Smith 323c45dcc3fSBarry Smithcheckgitclean: 3249a632cc8SPierre Jolivet @if ! git diff --quiet; then\ 325d5b43468SJose E. Roman echo "The repository has uncommitted files, cannot run checkclangformat" ;\ 326c45dcc3fSBarry Smith git status -s --untracked-files=no ;\ 327c45dcc3fSBarry Smith false;\ 328c45dcc3fSBarry Smith fi; 329c45dcc3fSBarry Smith 33073817b78SBarry Smith# Check that all the C/C++ source code in the repository satisfies the .clang_format 331c45dcc3fSBarry Smithcheckclangformat: checkclangformatversion checkgitclean clangformat 3329a632cc8SPierre Jolivet @if ! git diff --quiet; then\ 33373817b78SBarry Smith printf "The current commit has C/C++ source code formatting problems\n" ;\ 3349a632cc8SPierre Jolivet if [ -z "${CI_PIPELINE_ID}" ]; then\ 3359a632cc8SPierre Jolivet printf "Please run 'git diff' to check\n";\ 3369a632cc8SPierre Jolivet git diff --stat;\ 3379a632cc8SPierre Jolivet else\ 3389a632cc8SPierre Jolivet git diff --patch-with-stat > ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch;\ 3399a632cc8SPierre Jolivet git diff --patch-with-stat --color=always | head -1000;\ 3409a632cc8SPierre Jolivet if [ `wc -l < ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch` -gt 1000 ]; then\ 3419a632cc8SPierre Jolivet printf "The diff has been trimmed, check ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch (in CI artifacts) for all changes\n";\ 3429a632cc8SPierre Jolivet fi;\ 3439a632cc8SPierre Jolivet fi;\ 344c45dcc3fSBarry Smith false;\ 345c45dcc3fSBarry Smith fi; 346c45dcc3fSBarry Smith 34773817b78SBarry Smith# Check that all the Fortran source code in the repository satisfies the fprettify format 34873817b78SBarry Smithcheckfprettifyformat: checkgitclean fprettify 34973817b78SBarry Smith @if ! git diff --quiet; then\ 350e7a95102SMartin Diehl printf "The current commit has Fortran source code formatting problems\n" ;\ 35173817b78SBarry Smith if [ -z "${CI_PIPELINE_ID}" ]; then\ 35273817b78SBarry Smith printf "Please run 'git diff' to check\n";\ 35373817b78SBarry Smith git diff --stat;\ 35473817b78SBarry Smith else\ 35573817b78SBarry Smith git diff --patch-with-stat > ${PETSC_ARCH}/lib/petsc/conf/checkfprettifyformat.patch;\ 35673817b78SBarry Smith git diff --patch-with-stat --color=always | head -1000;\ 35773817b78SBarry Smith if [ `wc -l < ${PETSC_ARCH}/lib/petsc/conf/checkfprettifyformat.patch` -gt 1000 ]; then\ 35873817b78SBarry Smith printf "The diff has been trimmed, check ${PETSC_ARCH}/lib/petsc/conf/checkfprettifyformat.patch (in CI artifacts) for all changes\n";\ 35973817b78SBarry Smith fi;\ 36073817b78SBarry Smith fi;\ 36173817b78SBarry Smith false;\ 36273817b78SBarry Smith fi; 36373817b78SBarry Smith 364bcd4bb4aSBarry Smith# Check and fix the style/formatting of sh scripts 365bcd4bb4aSBarry Smithshellcheck: 366bcd4bb4aSBarry Smith @shellcheck --format=diff $$(git ls-files\*.sh) $$(file lib/petsc/bin/* lib/petsc/bin/maint/* | grep "/usr/bin/env sh" | cut -d: -f1) | patch -p1 367bcd4bb4aSBarry Smith 368bcd4bb4aSBarry Smith# Cannot use the following line since it encouters many problems we will likely not fix 369bcd4bb4aSBarry Smith# shellcheck --format=tty $$(git ls-files\*.sh) $$(file lib/petsc/bin/* lib/petsc/bin/maint/* | grep "/usr/bin/env sh" | cut -d: -f1) 370bcd4bb4aSBarry Smithcheckshellcheck: shellcheck 371bcd4bb4aSBarry Smith @if ! git diff --quiet; then\ 372bcd4bb4aSBarry Smith printf "The current commit has shellcheck problems\n" ;\ 373bcd4bb4aSBarry Smith if [ -z "${CI_PIPELINE_ID}" ]; then\ 374bcd4bb4aSBarry Smith printf "Please run 'git diff' to check\n";\ 375bcd4bb4aSBarry Smith git diff --stat;\ 376bcd4bb4aSBarry Smith else\ 377bcd4bb4aSBarry Smith git diff --patch-with-stat > ${PETSC_ARCH}/lib/petsc/conf/checkshellcheck.patch;\ 378bcd4bb4aSBarry Smith git diff --patch-with-stat --color=always | head -1000;\ 379bcd4bb4aSBarry Smith if [ `wc -l < ${PETSC_ARCH}/lib/petsc/conf/checkshellcheck.patch` -gt 1000 ]; then\ 380bcd4bb4aSBarry Smith printf "The diff has been trimmed, check ${PETSC_ARCH}/lib/petsc/conf/checkshellcheck.patch (in CI artifacts) for all changes\n";\ 381bcd4bb4aSBarry Smith fi;\ 382bcd4bb4aSBarry Smith fi;\ 383bcd4bb4aSBarry Smith false;\ 384bcd4bb4aSBarry Smith fi; 385bcd4bb4aSBarry Smith 3863d33ad60SJunchao Zhang# Compare ABI/API of two versions of PETSc library with the old one defined by PETSC_{DIR,ARCH}_ABI_OLD 3873d33ad60SJunchao Zhangabitest: 388cab5ea25SPierre Jolivet @if [ "${PETSC_DIR_ABI_OLD}" = "" ] || [ "${PETSC_ARCH_ABI_OLD}" = "" ];\ 3893d33ad60SJunchao Zhang then printf "You must set environment variables PETSC_DIR_ABI_OLD and PETSC_ARCH_ABI_OLD to run abitest\n";\ 3903d33ad60SJunchao Zhang exit 1;\ 3913d33ad60SJunchao Zhang fi; 3923d33ad60SJunchao Zhang -@echo "Comparing ABI/API of the following two PETSc versions (you must have already configured and built them using GCC and with -g):" 3933d33ad60SJunchao Zhang -@echo "=========================================================================================" 3943d33ad60SJunchao Zhang -@echo " Old: PETSC_DIR_ABI_OLD = ${PETSC_DIR_ABI_OLD}" 3953d33ad60SJunchao Zhang -@echo " PETSC_ARCH_ABI_OLD = ${PETSC_ARCH_ABI_OLD}" 3967b444a09SBarry Smith -@pushd ${PETSC_DIR_ABI_OLD} >> /dev/null ; echo " Branch = "`git rev-parse --abbrev-ref HEAD` 3973d33ad60SJunchao Zhang -@echo " New: PETSC_DIR = ${PETSC_DIR}" 3983d33ad60SJunchao Zhang -@echo " PETSC_ARCH = ${PETSC_ARCH}" 3997b444a09SBarry Smith -@echo " Branch = "`git rev-parse --abbrev-ref HEAD` 4003d33ad60SJunchao Zhang -@echo "=========================================================================================" 401454c5dfcSJunchao Zhang -@$(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 4023d33ad60SJunchao Zhang 403e42d24d9SBarry Smith# Run fortitude Fortran linter; pip install fortitude-lint; fortitude does not support using the preprocessor so it is of only limited utility 404e42d24d9SBarry Smithfortitude: 405e42d24d9SBarry Smith -@fortitude check --line-length 1000 --ignore C003,C121,S241 --verbose --fix --preview 406e42d24d9SBarry Smith 4077b444a09SBarry Smith# Compare ABI/API of current PETSC_ARCH/PETSC_DIR with a previous branch 4087b444a09SBarry Smithabitestcomplete: 4097b444a09SBarry Smith -@if [[ -f "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log" ]]; then\ 4107b444a09SBarry Smith 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"` ;\ 4117b444a09SBarry Smithecho $${OPTIONS} ;\ 4127b444a09SBarry Smith fi ;\ 4137b444a09SBarry Smith if [[ "${PETSC_DIR_ABI_OLD}" != "" ]]; then\ 4147b444a09SBarry Smith PETSC_DIR_OLD=${PETSC_DIR_ABI_OLD};\ 4157b444a09SBarry Smith else\ 4167b444a09SBarry Smith PETSC_DIR_OLD=${PETSC_DIR}/../petsc-abi;\ 4177b444a09SBarry Smith fi ;\ 4187b444a09SBarry Smith echo "=================================================================================================" ;\ 4197b444a09SBarry Smith echo "Doing ABI/API comparison between" ${branch} " and " `git rev-parse --abbrev-ref HEAD` "using " $${OPTIONS} ;\ 4207b444a09SBarry Smith echo "=================================================================================================" ;\ 4217b444a09SBarry Smith if [[ ! -d $${PETSC_DIR_OLD} ]]; then\ 4227b444a09SBarry Smith git clone ${PETSC_DIR} $${PETSC_DIR_OLD} ;\ 4237b444a09SBarry Smith else\ 4247b444a09SBarry Smith cd $${PETSC_DIR_OLD} ;\ 4257b444a09SBarry Smith git pull ;\ 4267b444a09SBarry Smith fi ;\ 4277b444a09SBarry Smith cd $${PETSC_DIR_OLD} ;\ 4287b444a09SBarry Smith git checkout ${branch} ;\ 4297b444a09SBarry Smith PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` ./configure $${OPTIONS} ;\ 4307b444a09SBarry Smith PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` make all test ;\ 4317b444a09SBarry Smith cd ${PETSC_DIR} ;\ 4327b444a09SBarry Smith ./configure $${OPTIONS};\ 4337b444a09SBarry Smith make all test ;\ 4347b444a09SBarry Smith PETSC_DIR_ABI_OLD=$${PETSC_DIR_OLD} PETSC_ARCH_ABI_OLD=arch-branch-`git rev-parse ${branch}` make abitest 4357b444a09SBarry Smith 4364c512586SBarry Smith# ******** Rules for running Streams benchmark **************************************************************************************************** 437753a1a87SJed Brown 4384198fb66SBarry Smithmpistreams: 4390e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistreams 4405fabf859SBarry Smith 4414198fb66SBarry Smithmpistream: 4420e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistream 4434198fb66SBarry Smith 4444198fb66SBarry Smithopenmpstreams: 4450e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstreams 4464198fb66SBarry Smith 4474198fb66SBarry Smithopenmpstream: 4480e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstream 4494198fb66SBarry Smith 4504198fb66SBarry Smithstream: mpistream 4514198fb66SBarry Smith 4524198fb66SBarry Smithstreams: mpistreams 453fc5166cbSSatish Balay 4544c512586SBarry Smith# ******** Rules for generating tag files for Emacs/VIM ******************************************************************************************* 4554c512586SBarry Smith 456343dd72aSBarry Smithalletags: etags 457343dd72aSBarry Smith 458343dd72aSBarry Smithetags: 459138d3dc6SBarry Smith -@${PYTHON} lib/petsc/bin/maint/generateetags.py && ${CP} TAGS ${PETSC_ARCH}/ 460753a1a87SJed Brown -@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON 461753a1a87SJed Brown 46237763f56SJed Brown# obtain gtags from https://www.gnu.org/software/global/ 463762ef373SBarry Smithallgtags: 46437763f56SJed Brown -@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 - 465762ef373SBarry Smith 466cb5db241SBarry Smith# ********* Rules for building "classic" documentation; uses rules also in lib/petsc/conf/rules_doc.mk ************************************************** 467753a1a87SJed Brown 4684c512586SBarry Smithdocs: 4697f019730SBarry Smith cd doc; ${OMAKE_SELF} docs 4709e423941SBarry Smith 4719e423941SBarry Smithchk_in_petscdir: 4729e423941SBarry Smith @if [ ! -f include/petscversion.h ]; then\ 4739e423941SBarry Smith printf ${PETSC_TEXT_HILIGHT}"*********************** ERROR **********************************************\n" ;\ 4749e423941SBarry Smith echo " This target should be invoked in top level PETSc source dir!";\ 4759e423941SBarry Smith printf "****************************************************************************"${PETSC_TEXT_NORMAL}"\n"; false; fi 4769e423941SBarry Smith 4779e423941SBarry Smithchk_loc: 4789e423941SBarry Smith @if [ ${LOC}foo = foo ] ; then\ 4799e423941SBarry Smith printf ${PETSC_TEXT_HILIGHT}"*********************** ERROR **********************************************\n";\ 4809e423941SBarry Smith echo " Please specify LOC variable for eg: make allmanpages LOC=/sandbox/petsc ";\ 4819e423941SBarry Smith printf "****************************************************************************"${PETSC_TEXT_NORMAL}"\n"; false; fi 4829e423941SBarry Smith @${MKDIR} ${LOC}/manualpages 4839e423941SBarry Smith 48472ece014SPatrick Sananalldocclean: deletemanualpages allcleanhtml 485753a1a87SJed Brown 486589e537fSPatrick Sanan# Deletes man pages (.md version) 487753a1a87SJed Browndeletemanualpages: chk_loc 48873fdd05bSBarry Smith -@if [ -d ${LOC} -a -d ${LOC}/manualpages ]; then\ 48973fdd05bSBarry Smith find ${LOC}/manualpages -type f -name "*.md" -exec ${RM} {}\; ;\ 49073fdd05bSBarry Smith ${RM} ${LOC}/manualpages/manualpages.cit ;\ 491753a1a87SJed Brown fi 492753a1a87SJed Brown 493753a1a87SJed Brownallcleanhtml: 4949e423941SBarry Smith -${OMAKE_SELF} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} tree 495753a1a87SJed Brown 4964c512586SBarry Smith# ********* Rules for checking code coverage ********************************************************************************************* 497753a1a87SJed Brown 498753a1a87SJed Browngcov: 49941baa1e4SJacob Faibussowitsch output_file_base_name=${PETSC_ARCH}-gcovr-report.json;\ 50020c90202SJacob Faibussowitsch petsc_arch_dir=${PETSC_DIR}/${PETSC_ARCH};\ 501ccfcae5eSJacob Faibussowitsch tar_file=$${petsc_arch_dir}/$${output_file_base_name}.tar.bz2;\ 502d32a9ad9SJacob Faibussowitsch cd $${petsc_arch_dir} &&\ 503137c82b9SSatish Balay gcovr --json --output $${petsc_arch_dir}/$${output_file_base_name} --exclude '.*/ftn-auto/.*' --exclude '.*/petscsys.h' --exclude-lines-by-pattern '^\s*SETERR.*' --exclude-throw-branches --exclude-unreachable-branches --gcov-ignore-parse-errors -j 8 --gcov-executable "${PETSC_COVERAGE_EXEC}" --root ${PETSC_DIR} ./obj ./tests ${PETSC_GCOV_OPTIONS} &&\ 504ccfcae5eSJacob Faibussowitsch ${RM} -f $${tar_file} &&\ 505ccfcae5eSJacob Faibussowitsch tar --bzip2 -cf $${tar_file} -C $${petsc_arch_dir} ./$${output_file_base_name} &&\ 506ccfcae5eSJacob Faibussowitsch ${RM} $${petsc_arch_dir}/$${output_file_base_name} 507753a1a87SJed Brown 508753a1a87SJed Brownmergegcov: 5097ce81a4bSJacob Faibussowitsch $(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py --merge-branch `lib/petsc/bin/maint/check-merge-branch.sh` --html --xml ${PETSC_GCOV_OPTIONS} 510b0e5478fSScott Kruger 511753a1a87SJed Browncountcfunctions: 512*1199fdcbSBarry Smith -@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h | grep "(" | tr -s ' ' | cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' | tr 'A-Z' 'a-z' | sort | uniq > /tmp/countcfunctions 513753a1a87SJed Brown 514a3269974SBarry Smithcheckpackagetests: 515a3269974SBarry Smith -@echo "Missing package tests" 516f53b81b6SPierre Jolivet -@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} ; grep -E "(with-$${j}|download-$${j})" configexamples | grep -v "=0" | wc -l ; done 517a3269974SBarry Smith -@echo "Missing download package tests" 518f53b81b6SPierre Jolivet -@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} ; grep -E "(download-$${j})" configexamples | grep -v "=0" | wc -l ; done 519a3269974SBarry Smith 5204c512586SBarry Smithcheck_petsc4py_rst: 5214c512586SBarry Smith @${RM} -f petsc4py_rst.log 5224c512586SBarry Smith @echo "Checking src/binding/petsc4py/DESCRIPTION.rst" 5234c512586SBarry Smith @rst2html src/binding/petsc4py/DESCRIPTION.rst > /dev/null 2> petsc4py_rst.log 5244c512586SBarry Smith @if test -s petsc4py_rst.log; then cat petsc4py_rst.log; exit 1; fi 5254c512586SBarry Smith 5264c512586SBarry Smith# TODO: checkTestCoverage: that makes sure every tutorial test has at least one test listed in the file, perhaps handled by gmakegentest.py 5274c512586SBarry Smith# TODO: check for PetscBeginFunctionUser in non-example source 5284c512586SBarry Smith# TODO: check for __ at start of #define or symbol 5294c512586SBarry Smith# TODO: checking for missing manual pages 5304c512586SBarry Smith# TODO: check for incorrect %d 5314c512586SBarry Smith# TODO: check for double blank lines 5324c512586SBarry Smith# TODO: check for ill-formed manual pages 5334c512586SBarry Smith# TODO: check for { on line after for 5344c512586SBarry Smith# TODO: check for } then else on following line 5354c512586SBarry Smith# TODO: check for } else { with SETERRQ on following line or if () { with SETERRQ on following line 5364c512586SBarry Smith 5374c512586SBarry SmithcheckbadSpelling: 5384c512586SBarry Smith -@x=`python3 ../bin/extract.py | aspell list | sort -u` ; 5394c512586SBarry Smith 5404c512586SBarry Smithupdatedatafiles: 54115a3ba28SSatish Balay -@if [ -d "${DATAFILESPATH}" ]; then\ 54215a3ba28SSatish Balay echo " ** Updating datafiles at ${DATAFILESPATH} **";\ 54315a3ba28SSatish Balay cd "${DATAFILESPATH}" && git pull -q; fi 5444c512586SBarry Smith 545dc0529c6SBarry Smith.PHONY: info info_h all deletelibs allclean update\ 546425fd74bSBarry Smith alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanpages\ 547ce78bad3SBarry Smith allcleanhtml\ 548416ff897SSatish Balay start_configure configure_petsc configure_clean matlabbin install 549