1753a1a87SJed Brown# 2753a1a87SJed Brown# This is the makefile for compiling PETSc. See 3753a1a87SJed Brown# http://www.mcs.anl.gov/petsc/documentation/installation.html for directions on installing PETSc. 4753a1a87SJed Brown# See also conf for additional commands. 5753a1a87SJed Brown# 6753a1a87SJed BrownALL: all 7*9e423941SBarry SmithDIRS = src include interfaces share/petsc/matlab 8753a1a87SJed Brown 9753a1a87SJed Brown# next line defines PETSC_DIR and PETSC_ARCH if they are not set 10af0996ceSBarry Smithinclude ././${PETSC_ARCH}/lib/petsc/conf/petscvariables 11*9e423941SBarry Smith#include ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscrules 12af0996ceSBarry Smithinclude ${PETSC_DIR}/lib/petsc/conf/variables 13*9e423941SBarry Smithinclude ${PETSC_DIR}/lib/petsc/conf/rules.doc 14e8666488SSatish Balayinclude ${PETSC_DIR}/lib/petsc/conf/test.common 15753a1a87SJed Brown 16fa2665b1SJed Brown# This makefile contains a lot of PHONY targets with improperly specified prerequisites 17fa2665b1SJed Brown# where correct execution instead depends on the targets being processed in the correct 18fa2665b1SJed Brown# order. This is gross, but this makefile doesn't really do any work. Sub-makes still 19fa2665b1SJed Brown# benefit from parallelism. 20fa2665b1SJed Brown.NOTPARALLEL: 21fa2665b1SJed Brown 220e03b746SBarry SmithOMAKE_SELF = $(OMAKE) -f makefile 230e03b746SBarry SmithOMAKE_SELF_PRINTDIR = $(OMAKE_PRINTDIR) -f makefile 240e03b746SBarry Smith 25753a1a87SJed Brown# 26753a1a87SJed Brown# Basic targets to build PETSc libraries. 27dc0529c6SBarry Smith# 28dd8585cdSJed Brownall: 290e03b746SBarry Smith +@${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} chk_petscdir chk_upgrade | tee ${PETSC_ARCH}/lib/petsc/conf/make.log 30af0996ceSBarry Smith @ln -sf ${PETSC_ARCH}/lib/petsc/conf/make.log make.log 310093410fSSatish 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 322b38c152SPierre Jolivet +@if [ "`cat ${PETSC_ARCH}/lib/petsc/conf/error.log 2> /dev/null`" != "0" ]; then \ 33f53b81b6SPierre 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; \ 340093410fSSatish Balay if test -s ${PETSC_ARCH}/lib/petsc/conf/memoryerror.log; then \ 3571488455SBarry Smith printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 3671488455SBarry 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; \ 3771488455SBarry Smith printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 380093410fSSatish Balay else \ 39af0996ceSBarry Smith printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 40af0996ceSBarry Smith echo " Error during compile, check ${PETSC_ARCH}/lib/petsc/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 41af0996ceSBarry 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;\ 42af0996ceSBarry Smith printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 430093410fSSatish Balay fi \ 44753a1a87SJed Brown else \ 450e03b746SBarry 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 ;\ 46753a1a87SJed Brown fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below 474dcdf380SSatish Balay @echo "Finishing make run at `date +'%a, %d %b %Y %H:%M:%S %z'`" >> ${PETSC_ARCH}/lib/petsc/conf/make.log 482b38c152SPierre Jolivet @if [ "`cat ${PETSC_ARCH}/lib/petsc/conf/error.log 2> /dev/null`" != "0" ]; then exit 1; fi 49753a1a87SJed Brown 50504e95faSBarry Smithall-local: info libs matlabbin petsc4py-build libmesh-build mfem-build slepc-build hpddm-build amrex-build bamg-build 51fa2665b1SJed Brown 52*9e423941SBarry Smith${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/files: 53*9e423941SBarry Smith @touch -t 197102020000 ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/files 54*9e423941SBarry Smith 55*9e423941SBarry Smith${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles: 56*9e423941SBarry Smith @${MKDIR} -p ${PETSC_DIR}/${PETSC_ARCH}/tests && touch -t 197102020000 ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles 57*9e423941SBarry Smith 58*9e423941SBarry Smithlibs: ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/files ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles 59*9e423941SBarry Smith +@r=`echo "${MAKEFLAGS}" | grep ' -j'`; \ 60*9e423941SBarry Smith if [ "$$?" = 0 ]; then make_j=""; else make_j="-j${MAKE_NP}"; fi; \ 61*9e423941SBarry Smith r=`echo "${MAKEFLAGS}" | grep ' -l'`; \ 62*9e423941SBarry Smith if [ "$$?" = 0 ]; then make_l=""; else make_l="-l${MAKE_LOAD}"; fi; \ 63*9e423941SBarry Smith cmd="${OMAKE_PRINTDIR} -f gmakefile $${make_j} $${make_l} ${MAKE_PAR_OUT_FLG} V=${V} libs"; \ 64*9e423941SBarry Smith cd ${PETSC_DIR} && echo $${cmd} && exec $${cmd} 65*9e423941SBarry Smith 66753a1a87SJed Brown# 67753a1a87SJed Brown# Prints information about the system and version of PETSc being compiled 68753a1a87SJed Brown# 69dd8585cdSJed Browninfo: 70753a1a87SJed Brown -@echo "==========================================" 71753a1a87SJed Brown -@echo " " 72753a1a87SJed Brown -@echo "See documentation/faq.html and documentation/bugreporting.html" 73753a1a87SJed Brown -@echo "for help with installation problems. Please send EVERYTHING" 74bc10b077SJed Brown -@echo "printed out below when reporting problems. Please check the" 75bc10b077SJed Brown -@echo "mailing list archives and consider subscribing." 76753a1a87SJed Brown -@echo " " 77a17b96a8SKyle Gerard Felker -@echo " https://petsc.org/release/community/mailing/" 78753a1a87SJed Brown -@echo " " 79753a1a87SJed Brown -@echo "==========================================" 804dcdf380SSatish Balay -@echo Starting make run on `hostname` at `date +'%a, %d %b %Y %H:%M:%S %z'` 81753a1a87SJed Brown -@echo Machine characteristics: `uname -a` 82753a1a87SJed Brown -@echo "-----------------------------------------" 83753a1a87SJed Brown -@echo "Using PETSc directory: ${PETSC_DIR}" 84753a1a87SJed Brown -@echo "Using PETSc arch: ${PETSC_ARCH}" 85753a1a87SJed Brown -@echo "-----------------------------------------" 862e5b05a0SPierre Jolivet -@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//" | head -n 7 87753a1a87SJed Brown -@echo "-----------------------------------------" 88753a1a87SJed Brown -@echo "Using configure Options: ${CONFIGURE_OPTIONS}" 89753a1a87SJed Brown -@echo "Using configuration flags:" 902e5b05a0SPierre Jolivet -@grep "\#define " ${PETSCCONF_H} | tail -n +2 91753a1a87SJed Brown -@echo "-----------------------------------------" 9236ad7b81SSatish Balay -@echo "Using C compile: ${PETSC_CCOMPILE_SINGLE}" 937c934407SBarry Smith -@if [ "${MPICC_SHOW}" != "" ]; then \ 94fd0cdb26SSatish Balay printf "mpicc -show: %b\n" "${MPICC_SHOW}";\ 957c934407SBarry Smith fi; \ 967c934407SBarry Smith printf "C compiler version: %b\n" "${C_VERSION}"; \ 9736ad7b81SSatish Balay if [ "${CXX}" != "" ]; then \ 9836ad7b81SSatish Balay echo "Using C++ compile: ${PETSC_CXXCOMPILE_SINGLE}";\ 997c934407SBarry Smith if [ "${MPICXX_SHOW}" != "" ]; then \ 100fd0cdb26SSatish Balay printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \ 1017c934407SBarry Smith fi;\ 1027c934407SBarry Smith printf "C++ compiler version: %b\n" "${Cxx_VERSION}"; \ 1037c934407SBarry Smith fi 104753a1a87SJed Brown -@if [ "${FC}" != "" ]; then \ 10536ad7b81SSatish Balay echo "Using Fortran compile: ${PETSC_FCOMPILE_SINGLE}";\ 106607e78e0SSatish Balay if [ "${MPIFC_SHOW}" != "" ]; then \ 107fd0cdb26SSatish Balay printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \ 108607e78e0SSatish Balay fi; \ 1097c934407SBarry Smith printf "Fortran compiler version: %b\n" "${FC_VERSION}"; \ 110da0b7683SSatish Balay fi 111da0b7683SSatish Balay -@if [ "${CUDAC}" != "" ]; then \ 11236ad7b81SSatish Balay echo "Using CUDA compile: ${PETSC_CUCOMPILE_SINGLE}";\ 113753a1a87SJed Brown fi 114cab5ea25SPierre Jolivet -@if [ "${CLANGUAGE}" = "CXX" ]; then \ 115f5718a65SBarry Smith echo "Using C++ compiler to compile PETSc";\ 116f5718a65SBarry Smith fi 117753a1a87SJed Brown -@echo "-----------------------------------------" 118753a1a87SJed Brown -@echo "Using C/C++ linker: ${PCC_LINKER}" 119753a1a87SJed Brown -@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}" 120753a1a87SJed Brown -@if [ "${FC}" != "" ]; then \ 121753a1a87SJed Brown echo "Using Fortran linker: ${FC_LINKER}";\ 122753a1a87SJed Brown echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\ 123753a1a87SJed Brown fi 124753a1a87SJed Brown -@echo "-----------------------------------------" 1251d2d58a3SSatish Balay -@echo "Using system modules: ${LOADEDMODULES}" 126d1f8d238SSatish Balay -@if [ "${MPI_IS_MPIUNI}" = "1" ]; then \ 127d1f8d238SSatish Balay echo Using mpi.h: mpiuni; \ 128d1f8d238SSatish Balay else \ 129d1f8d238SSatish Balay TESTDIR=`mktemp -q -d -t petscmpi-XXXXXXXX` && \ 13042a47be2SSatish Balay echo '#include <mpi.h>' > $${TESTDIR}/mpitest.c && \ 131f5718a65SBarry Smith BUF=`${CPP} ${PETSC_CPPFLAGS} ${PETSC_CC_INCLUDES} $${TESTDIR}/mpitest.c |grep 'mpi\.h' | ( head -1 ; cat > /dev/null )` && \ 132d1f8d238SSatish Balay echo Using mpi.h: $${BUF}; ${RM} -rf $${TESTDIR}; \ 133d1f8d238SSatish Balay fi 1341d2d58a3SSatish Balay -@echo "-----------------------------------------" 135753a1a87SJed Brown -@echo "Using libraries: ${PETSC_LIB}" 136753a1a87SJed Brown -@echo "------------------------------------------" 137753a1a87SJed Brown -@echo "Using mpiexec: ${MPIEXEC}" 1384e2e1449SJed Brown -@echo "------------------------------------------" 1395ef50a0fSSatish Balay -@echo "Using MAKE: ${MAKE}" 1405ef50a0fSSatish Balay -@echo "Default MAKEFLAGS: MAKE_NP:${MAKE_NP} MAKE_LOAD:${MAKE_LOAD} MAKEFLAGS:${MAKEFLAGS}" 141753a1a87SJed Brown -@echo "==========================================" 142753a1a87SJed Brown 143753a1a87SJed Brown# 144d2b3add8SSatish Balay# Build MatLab binaries 145d2b3add8SSatish Balay# 146d2b3add8SSatish Balaymatlabbin: 1474242cbabSBarry Smith -@if [ "${MATLAB_MEX}" != "" -a "${MATLAB_SOCKET}" != "" -a "${PETSC_SCALAR}" = "real" -a "${PETSC_PRECISION}" = "double" ]; then \ 148d2b3add8SSatish Balay echo "BEGINNING TO COMPILE MATLAB INTERFACE"; \ 149d2b3add8SSatish Balay if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc; fi; \ 150d2b3add8SSatish Balay if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab; fi; \ 151b75c6efcSBarry Smith cd src/sys/classes/viewer/impls/socket/mex-scripts && ${OMAKE_SELF} mex-scripts PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR}; \ 152d2b3add8SSatish Balay echo "========================================="; \ 153d2b3add8SSatish Balay fi 154753a1a87SJed Brown# 1550e03b746SBarry Smith# Builds PETSc check examples for a given architecture 156753a1a87SJed Brown# 15727cb8d94SBarry SmithRUN_TEST = ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff 15827cb8d94SBarry Smith 1590e03b746SBarry Smithcheck_install: check 1600e03b746SBarry Smithcheck: 1610e03b746SBarry Smith -@echo "Running check examples to verify correct installation" 162753a1a87SJed Brown -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 16327cb8d94SBarry Smith @if [ "${PETSC_WITH_BATCH}" != "" ]; then \ 16427cb8d94SBarry Smith echo "Running with batch filesystem, cannot run make check"; \ 16527cb8d94SBarry Smith elif [ "${MPIEXEC}" = "/bin/false" ]; then \ 16627cb8d94SBarry Smith echo "*mpiexec not found*. cannot run make check"; \ 16727cb8d94SBarry Smith else \ 16827cb8d94SBarry Smith ${RM} -f check_error;\ 16927cb8d94SBarry Smith ${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; \ 17027cb8d94SBarry Smith if [ -f check_error ]; then \ 17127cb8d94SBarry Smith echo "Error while running make check"; \ 17227cb8d94SBarry Smith ${RM} -f check_error;\ 17327cb8d94SBarry Smith exit 1; \ 17427cb8d94SBarry Smith fi; \ 17527cb8d94SBarry Smith ${RM} -f check_error;\ 17627cb8d94SBarry Smith fi; 17727cb8d94SBarry Smith 17827cb8d94SBarry Smithcheck_build: 17927cb8d94SBarry Smith +@cd src/snes/tutorials >/dev/null; ${RUN_TEST} clean-legacy 18027cb8d94SBarry Smith +@cd src/snes/tutorials >/dev/null; ${RUN_TEST} testex19 18127cb8d94SBarry Smith +@if [ ! "${MPI_IS_MPIUNI}" ]; then cd src/snes/tutorials >/dev/null; ${RUN_TEST} testex19_mpi; fi 18227cb8d94SBarry Smith +@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_SCALAR}" = "real" ]; then \ 183de5e753aSSatish Balay if [ "${CUDA_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_cuda; \ 184de5e753aSSatish Balay elif [ "${HIP_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_hip; \ 18527cb8d94SBarry Smith else HYPRE_TEST=runex19_hypre; fi; \ 18627cb8d94SBarry Smith cd src/snes/tutorials >/dev/null; ${RUN_TEST} $${HYPRE_TEST}; \ 18727cb8d94SBarry Smith fi; 18827cb8d94SBarry Smith +@if [ "${CUDA_LIB}" != "" ]; then \ 18927cb8d94SBarry Smith cd src/snes/tutorials >/dev/null; ${RUN_TEST} runex19_cuda; \ 19027cb8d94SBarry Smith fi; 19127cb8d94SBarry Smith +@if [ "${MPI_IS_MPIUNI}" = "" ]; then \ 19227cb8d94SBarry Smith cd src/snes/tutorials >/dev/null; \ 19327cb8d94SBarry Smith if [ "${KOKKOS_KERNELS_LIB}" != "" ] && [ "${PETSC_SCALAR}" = "real" ] && [ "${PETSC_PRECISION}" = "double" ]; then \ 19427cb8d94SBarry Smith ${RUN_TEST} runex3k_kokkos; \ 195de5e753aSSatish Balay fi;\ 19627cb8d94SBarry Smith if [ "${MUMPS_LIB}" != "" ]; then \ 19727cb8d94SBarry Smith ${RUN_TEST} runex19_fieldsplit_mumps; \ 19827cb8d94SBarry Smith fi;\ 19927cb8d94SBarry Smith if [ "${SUITESPARSE_LIB}" != "" ]; then \ 20027cb8d94SBarry Smith ${RUN_TEST} runex19_suitesparse; \ 20127cb8d94SBarry Smith fi;\ 20227cb8d94SBarry Smith if [ "${SUPERLU_DIST_LIB}" != "" ]; then \ 20327cb8d94SBarry Smith ${RUN_TEST} runex19_superlu_dist; \ 20427cb8d94SBarry Smith fi;\ 20527cb8d94SBarry Smith if ( [ "${ML_LIB}" != "" ] || [ "${TRILINOS_LIB}" != "" ] ); then \ 20627cb8d94SBarry Smith ${RUN_TEST} runex19_ml; \ 20727cb8d94SBarry Smith fi; \ 20827cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 20927cb8d94SBarry Smith cd - > /dev/null; \ 210e91fee76SPierre Jolivet if ( [ "${AMREX_LIB}" != "" ] && [ "${CUDA_LIB}" = "" ] ); then \ 211bd579fedSSatish Balay echo "Running amrex test example to verify correct installation";\ 212bd579fedSSatish Balay echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}";\ 213bd579fedSSatish Balay cd src/ksp/ksp/tutorials/amrex >/dev/null;\ 21427cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 21527cb8d94SBarry Smith ${RUN_TEST} testamrex; \ 21627cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 21727cb8d94SBarry Smith cd - > /dev/null; \ 21827cb8d94SBarry Smith fi;\ 21927cb8d94SBarry Smith fi; 22027cb8d94SBarry Smith +@if [ "${HDF5_LIB}" != "" ]; then \ 22127cb8d94SBarry Smith cd src/vec/vec/tests >/dev/null;\ 22227cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 22327cb8d94SBarry Smith ${RUN_TEST} runex47; \ 22427cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 225bd579fedSSatish Balay fi; 226b6efb0a5SBarry Smith +@if [ "${MPI4PY}" = "yes" ]; then \ 227b6efb0a5SBarry Smith cd src/sys/tests >/dev/null; \ 22827cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 22927cb8d94SBarry Smith ${RUN_TEST} testex55; \ 23027cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 231b6efb0a5SBarry Smith fi; 23245ee4180SJed Brown +@if [ "${PETSC4PY}" = "yes" ]; then \ 233c4762a1bSJed Brown cd src/ksp/ksp/tutorials >/dev/null; \ 23427cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 23527cb8d94SBarry Smith ${RUN_TEST} testex100; \ 23627cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 2375061939cSBarry Smith fi; 238f53b81b6SPierre Jolivet +@grep -E "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 239cb297985SSatish Balay if test -s .ftn.log; then \ 240bd579fedSSatish Balay cd src/snes/tutorials >/dev/null; \ 24127cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 24227cb8d94SBarry Smith ${RUN_TEST} testex5f; \ 24327cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 244cb297985SSatish Balay fi; ${RM} .ftn.log; 245f53b81b6SPierre Jolivet +@grep -E "^#define PETSC_HAVE_MATLAB 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 24669cdbcb9SBarry Smith if test -s .ftn.log; then \ 247bd579fedSSatish Balay cd src/vec/vec/tutorials >/dev/null; \ 24827cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 24927cb8d94SBarry Smith ${RUN_TEST} testex31; \ 25027cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 25169cdbcb9SBarry Smith fi; ${RM} .ftn.log; 252753a1a87SJed Brown -@echo "Completed test examples" 25327cb8d94SBarry Smith 2540e03b746SBarry Smithcheck_usermakefile: 255b752486dSSatish Balay -@echo "Testing compile with user makefile" 256b752486dSSatish Balay -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 25727cb8d94SBarry Smith @cd src/snes/tutorials; ${RUN_TEST} clean-legacy 258c4762a1bSJed Brown @cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex19 259f53b81b6SPierre Jolivet @grep -E "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 260b752486dSSatish Balay if test -s .ftn.log; then \ 261c4762a1bSJed Brown cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex5f; \ 262b752486dSSatish Balay fi; ${RM} .ftn.log; 26327cb8d94SBarry Smith @cd src/snes/tutorials; ${RUN_TEST} clean-legacy 264b752486dSSatish Balay -@echo "Completed compile with user makefile" 265753a1a87SJed Brown 266c45dcc3fSBarry Smithcheckgitclean: 2679a632cc8SPierre Jolivet @if ! git diff --quiet; then \ 268d5b43468SJose E. Roman echo "The repository has uncommitted files, cannot run checkclangformat" ;\ 269c45dcc3fSBarry Smith git status -s --untracked-files=no ;\ 270c45dcc3fSBarry Smith false;\ 271c45dcc3fSBarry Smith fi; 272c45dcc3fSBarry Smith 273c45dcc3fSBarry Smithcheckclangformatversion: 274c45dcc3fSBarry Smith @version=`clang-format --version | cut -d" " -f3 | cut -d"." -f 1` ;\ 275c45dcc3fSBarry Smith if [ "$$version" == "version" ]; then version=`clang-format --version | cut -d" " -f4 | cut -d"." -f 1`; fi;\ 2766c5826a2SPierre Jolivet if [ $$version != 16 ]; then echo "Require clang-format version 16! Currently used clang-format version is $$version" ;false ; fi 277c45dcc3fSBarry Smith 278c45dcc3fSBarry Smith# Check that all the source code in the repository satisfies the .clang_format 279c45dcc3fSBarry Smithcheckclangformat: checkclangformatversion checkgitclean clangformat 2809a632cc8SPierre Jolivet @if ! git diff --quiet; then \ 2819a632cc8SPierre Jolivet printf "The current commit has source code formatting problems\n" ;\ 2829a632cc8SPierre Jolivet if [ -z "${CI_PIPELINE_ID}" ]; then \ 2839a632cc8SPierre Jolivet printf "Please run 'git diff' to check\n"; \ 2849a632cc8SPierre Jolivet git diff --stat; \ 2859a632cc8SPierre Jolivet else \ 2869a632cc8SPierre Jolivet git diff --patch-with-stat > ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch; \ 2879a632cc8SPierre Jolivet git diff --patch-with-stat --color=always | head -1000; \ 2889a632cc8SPierre Jolivet if [ `wc -l < ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch` -gt 1000 ]; then \ 2899a632cc8SPierre Jolivet printf "The diff has been trimmed, check ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch (in CI artifacts) for all changes\n"; \ 2909a632cc8SPierre Jolivet fi;\ 2919a632cc8SPierre Jolivet fi;\ 292c45dcc3fSBarry Smith false;\ 293c45dcc3fSBarry Smith fi; 294c45dcc3fSBarry Smith 2953d33ad60SJunchao Zhang# Compare ABI/API of two versions of PETSc library with the old one defined by PETSC_{DIR,ARCH}_ABI_OLD 2963d33ad60SJunchao Zhangabitest: 297cab5ea25SPierre Jolivet @if [ "${PETSC_DIR_ABI_OLD}" = "" ] || [ "${PETSC_ARCH_ABI_OLD}" = "" ]; \ 2983d33ad60SJunchao Zhang then printf "You must set environment variables PETSC_DIR_ABI_OLD and PETSC_ARCH_ABI_OLD to run abitest\n"; \ 2993d33ad60SJunchao Zhang exit 1; \ 3003d33ad60SJunchao Zhang fi; 3013d33ad60SJunchao Zhang -@echo "Comparing ABI/API of the following two PETSc versions (you must have already configured and built them using GCC and with -g):" 3023d33ad60SJunchao Zhang -@echo "=========================================================================================" 3033d33ad60SJunchao Zhang -@echo " Old: PETSC_DIR_ABI_OLD = ${PETSC_DIR_ABI_OLD}" 3043d33ad60SJunchao Zhang -@echo " PETSC_ARCH_ABI_OLD = ${PETSC_ARCH_ABI_OLD}" 3057b444a09SBarry Smith -@pushd ${PETSC_DIR_ABI_OLD} >> /dev/null ; echo " Branch = "`git rev-parse --abbrev-ref HEAD` 3063d33ad60SJunchao Zhang -@echo " New: PETSC_DIR = ${PETSC_DIR}" 3073d33ad60SJunchao Zhang -@echo " PETSC_ARCH = ${PETSC_ARCH}" 3087b444a09SBarry Smith -@echo " Branch = "`git rev-parse --abbrev-ref HEAD` 3093d33ad60SJunchao Zhang -@echo "=========================================================================================" 310454c5dfcSJunchao 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 3113d33ad60SJunchao Zhang 3127b444a09SBarry Smith# Compare ABI/API of current PETSC_ARCH/PETSC_DIR with a previous branch 3137b444a09SBarry Smithabitestcomplete: 3147b444a09SBarry Smith -@if [[ -f "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log" ]]; then \ 3157b444a09SBarry 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"` ;\ 3167b444a09SBarry Smithecho $${OPTIONS} ;\ 3177b444a09SBarry Smith fi ; \ 3187b444a09SBarry Smith if [[ "${PETSC_DIR_ABI_OLD}" != "" ]]; then \ 3197b444a09SBarry Smith PETSC_DIR_OLD=${PETSC_DIR_ABI_OLD}; \ 3207b444a09SBarry Smith else \ 3217b444a09SBarry Smith PETSC_DIR_OLD=${PETSC_DIR}/../petsc-abi; \ 3227b444a09SBarry Smith fi ; \ 3237b444a09SBarry Smith echo "=================================================================================================" ;\ 3247b444a09SBarry Smith echo "Doing ABI/API comparison between" ${branch} " and " `git rev-parse --abbrev-ref HEAD` "using " $${OPTIONS} ;\ 3257b444a09SBarry Smith echo "=================================================================================================" ;\ 3267b444a09SBarry Smith if [[ ! -d $${PETSC_DIR_OLD} ]]; then \ 3277b444a09SBarry Smith git clone ${PETSC_DIR} $${PETSC_DIR_OLD} ; \ 3287b444a09SBarry Smith else \ 3297b444a09SBarry Smith cd $${PETSC_DIR_OLD} ; \ 3307b444a09SBarry Smith git pull ; \ 3317b444a09SBarry Smith fi ; \ 3327b444a09SBarry Smith cd $${PETSC_DIR_OLD} ; \ 3337b444a09SBarry Smith git checkout ${branch} ; \ 3347b444a09SBarry Smith PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` ./configure $${OPTIONS} ; \ 3357b444a09SBarry Smith PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` make all test ; \ 3367b444a09SBarry Smith cd ${PETSC_DIR} ; \ 3377b444a09SBarry Smith ./configure $${OPTIONS}; \ 3387b444a09SBarry Smith make all test ; \ 3397b444a09SBarry Smith PETSC_DIR_ABI_OLD=$${PETSC_DIR_OLD} PETSC_ARCH_ABI_OLD=arch-branch-`git rev-parse ${branch}` make abitest 3407b444a09SBarry Smith 341753a1a87SJed Brown# Deletes PETSc libraries 342dd8585cdSJed Browndeletelibs: 343753a1a87SJed Brown -${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.* 344dd8585cdSJed Browndeletemods: 345753a1a87SJed Brown -${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod 346753a1a87SJed Brown 34758080eacSSatish Balayallclean: 348dc0529c6SBarry Smith -@${OMAKE} -f gmakefile clean 34959d63732SSatish Balay 35059d63732SSatish Balayclean:: allclean 35159d63732SSatish Balay 35259d63732SSatish Balaydistclean: chk_petscdir 353af0996ceSBarry Smith @if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then \ 354af0996ceSBarry Smith echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***"; \ 355af0996ceSBarry Smith mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/; fi 35659d63732SSatish Balay @echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***" 35759d63732SSatish Balay -${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/ 35859d63732SSatish Balay 35959d63732SSatish Balay 360753a1a87SJed Brown# 36127dc398fSStefano Zampinireconfigure: allclean 3624d5cfbf7SSatish Balay @unset MAKEFLAGS && ${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py 363fad83eadSPatrick Sanan 364753a1a87SJed Browninstall: 3650ee81e68SLisandro Dalcin @${PYTHON} ./config/install.py -destDir=${DESTDIR} 366fad83eadSPatrick Sanan +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=$@ install-builtafterpetsc 367fad83eadSPatrick Sanan 368fad83eadSPatrick Sanan# A smaller install with fewer extras 369fad83eadSPatrick Sananinstall-lib: 370fad83eadSPatrick Sanan @${PYTHON} ./config/install.py -destDir=${DESTDIR} -no-examples 371fad83eadSPatrick Sanan +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=$@ install-builtafterpetsc 372fad83eadSPatrick Sanan 373fad83eadSPatrick Sananinstall-builtafterpetsc: 374fad83eadSPatrick Sanan +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=${PETSC_INSTALL} petsc4py-install libmesh-install mfem-install slepc-install hpddm-install amrex-install bamg-install 375753a1a87SJed Brown 3764198fb66SBarry Smithmpistreams: 3770e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistreams 3785fabf859SBarry Smith 3794198fb66SBarry Smithmpistream: 3800e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistream 3814198fb66SBarry Smith 3824198fb66SBarry Smithopenmpstreams: 3830e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstreams 3844198fb66SBarry Smith 3854198fb66SBarry Smithopenmpstream: 3860e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstream 3874198fb66SBarry Smith 3884198fb66SBarry Smith# for legacy reasons 3894198fb66SBarry Smithstream: mpistream 3904198fb66SBarry Smith 3914198fb66SBarry Smithstreams: mpistreams 392fc5166cbSSatish Balay 393753a1a87SJed Brown# ------------------------------------------------------------------ 394753a1a87SJed Brown# 395753a1a87SJed Brown# All remaining actions are intended for PETSc developers only. 396753a1a87SJed Brown# PETSc users should not generally need to use these commands. 397753a1a87SJed Brown# 398753a1a87SJed Brown# See the users manual for how the tags files may be used from Emacs and Vi/Vim 399753a1a87SJed Brown# 400753a1a87SJed Brownalletags: 401c3a89c15SBarry Smith -@${PYTHON} lib/petsc/bin/maint/generateetags.py 402753a1a87SJed Brown -@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON 403753a1a87SJed Brown 40437763f56SJed Brown# obtain gtags from https://www.gnu.org/software/global/ 405762ef373SBarry Smithallgtags: 40637763f56SJed 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 - 407762ef373SBarry Smith 408753a1a87SJed Brownallfortranstubs: 4091b266c99SBarry Smith -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 410c3a89c15SBarry Smith @${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py ${BFORT} ${VERBOSE} 411c3a89c15SBarry Smith -@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py -merge ${VERBOSE} 412a318115bSBarry Smith -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 413753a1a87SJed Browndeletefortranstubs: 414753a1a87SJed Brown -@find . -type d -name ftn-auto | xargs rm -rf 415753a1a87SJed Brown 416*9e423941SBarry Smith# rules for building the "classic" documentation; uses rules also in lib/petsc/conf/petscrules.doc 417*9e423941SBarry Smith 418*9e423941SBarry Smithchk_petscdir: 419*9e423941SBarry Smith @mypwd=`pwd`; cd ${PETSC_DIR} 2>&1 > /dev/null; true_PETSC_DIR=`pwd`; cd $${mypwd} 2>&1 >/dev/null; \ 420*9e423941SBarry Smith newpwd=`echo $${mypwd} | sed "s+$${true_PETSC_DIR}+DUMMY+g"`;\ 421*9e423941SBarry Smith haspetsc=`echo $${mypwd} | sed "s+petsc-+DUMMY+g"`;\ 422*9e423941SBarry Smith if [ $${mypwd} = $${newpwd} -a $${haspetsc} != $${mypwd} ]; then \ 423*9e423941SBarry Smith printf ${PETSC_TEXT_HILIGHT}"*********************W-a-r-n-i-n-g*************************\n" ; \ 424*9e423941SBarry Smith echo "Your PETSC_DIR may not match the directory you are in";\ 425*9e423941SBarry Smith echo "PETSC_DIR " $${true_PETSC_DIR} "Current directory" $${mypwd};\ 426*9e423941SBarry Smith echo "Ignore this if you are running make check ";\ 427*9e423941SBarry Smith printf "******************************************************"${PETSC_TEXT_NORMAL}"\n" ; \ 428*9e423941SBarry Smith fi 429*9e423941SBarry Smith 430*9e423941SBarry Smithchk_in_petscdir: 431*9e423941SBarry Smith @if [ ! -f include/petscversion.h ]; then \ 432*9e423941SBarry Smith printf ${PETSC_TEXT_HILIGHT}"*********************** ERROR **********************************************\n" ; \ 433*9e423941SBarry Smith echo " This target should be invoked in top level PETSc source dir!"; \ 434*9e423941SBarry Smith printf "****************************************************************************"${PETSC_TEXT_NORMAL}"\n" ; false; fi 435*9e423941SBarry Smith 436*9e423941SBarry Smithchk_loc: 437*9e423941SBarry Smith @if [ ${LOC}foo = foo ] ; then \ 438*9e423941SBarry Smith printf ${PETSC_TEXT_HILIGHT}"*********************** ERROR **********************************************\n" ; \ 439*9e423941SBarry Smith echo " Please specify LOC variable for eg: make allmanpages LOC=/sandbox/petsc "; \ 440*9e423941SBarry Smith printf "****************************************************************************"${PETSC_TEXT_NORMAL}"\n" ; false; fi 441*9e423941SBarry Smith @${MKDIR} ${LOC}/manualpages 442*9e423941SBarry Smith 443*9e423941SBarry Smithchk_c2html: 444*9e423941SBarry Smith @if [ ${C2HTML}foo = foo ] ; then \ 445*9e423941SBarry Smith printf ${PETSC_TEXT_HILIGHT}"*********************** ERROR ************************\n" ; \ 446*9e423941SBarry Smith echo "Require c2html for html docs. Please reconfigure with --download-c2html=1"; \ 447*9e423941SBarry Smith printf "******************************************************"${PETSC_TEXT_NORMAL}"\n" ;false; fi 448*9e423941SBarry Smith 449*9e423941SBarry Smith 450*9e423941SBarry Smith# the ACTION=manualpages cannot run in parallel because they all write to the same manualpages.cit file 4516121d795SBarry Smithhloc=include/petsc/private 452589e537fSPatrick Sananallmanpages: chk_loc deletemanualpages 4532ba9d5beSBarry Smith -echo " /* SUBMANSEC = PetscH */ " > ${hloc}/generated_khash.h 4542ba9d5beSBarry Smith -sed -e 's?<T>?I?g' -e 's?<t>?i?g' -e 's?<KeyType>?PetscInt?g' ${hloc}/hashset.txt >> ${hloc}/generated_khash.h 4552ba9d5beSBarry Smith -sed -e 's?<T>?IJ?g' -e 's?<t>?ij?g' -e 's?<KeyType>?struct {PetscInt i, j;}?g' ${hloc}/hashset.txt >> ${hloc}/generated_khash.h 4562ba9d5beSBarry Smith -sed -e 's?<T>?I?g' -e 's?<t>?i?g' -e 's?<KeyType>?PetscInt?g' -e 's?<ValType>?PetscInt?g' ${hloc}/hashmap.txt >> ${hloc}/generated_khash.h 4572ba9d5beSBarry Smith -sed -e 's?<T>?IJ?g' -e 's?<t>?ij?g' -e 's?<KeyType>?struct {PetscInt i, j;}?g' -e 's?<ValType>?PetscInt?g' ${hloc}/hashmap.txt >> ${hloc}/generated_khash.h 458faa16638SBarry Smith -sed -e 's?<T>?IJ?g' -e 's?<t>?ij?g' -e 's?<KeyType>?struct {PetscInt i, j;}?g' -e 's?<ValType>?PetscScalar?g' ${hloc}/hashmap.txt >> ${hloc}/generated_khash.h 4592ba9d5beSBarry Smith -sed -e 's?<T>?IV?g' -e 's?<t>?iv?g' -e 's?<KeyType>?PetscInt?g' -e 's?<ValType>?PetscScalar?g' ${hloc}/hashmap.txt >> ${hloc}/generated_khash.h 4602ba9d5beSBarry Smith -sed -e 's?<T>?Obj?g' -e 's?<t>?obj?g' -e 's?<KeyType>?PetscInt64?g' -e 's?<ValType>?PetscObject?g' ${hloc}/hashmap.txt >> ${hloc}/generated_khash.h 46171c41f4fSBarry Smith -${RM} ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 462ac09b921SBarry Smith -${OMAKE_SELF} ACTION=manualpages tree_src LOC=${LOC} 46373fdd05bSBarry Smith -@sed -e s%man+../%man+manualpages/% ${LOC}/manualpages/manualpages.cit > ${LOC}/manualpages/htmlmap 46473fdd05bSBarry Smith -@cat ${PETSC_DIR}/doc/classic/mpi.www.index >> ${LOC}/manualpages/htmlmap 46549762cbcSSatish Balay cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 466d7b6776fSBarry Smith a=`cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err | wc -l`; test ! $$a -gt 0 467f4da3331SVáclav Hapla 468f4da3331SVáclav Haplaallmanexamples: chk_loc allmanpages 469*9e423941SBarry Smith -${OMAKE_SELF} ACTION=manexamples tree LOC=${LOC} 470*9e423941SBarry Smith 471*9e423941SBarry Smith# 472*9e423941SBarry Smith# Goes through all manual pages adding links to implementations of the method 473*9e423941SBarry Smith# or class, at the end of the file. 474*9e423941SBarry Smith# 475*9e423941SBarry Smith# To find functions implementing methods, we use git grep to look for 476*9e423941SBarry Smith# well-formed PETSc functions 477*9e423941SBarry Smith# - with names containing a single underscore 478*9e423941SBarry Smith# - in files of appropriate types (.cu .c .cxx .h), 479*9e423941SBarry Smith# - in paths including "/impls/", 480*9e423941SBarry Smith# - excluding any line with a semicolon (to avoid matching prototypes), and 481*9e423941SBarry Smith# - excluding any line including "_Private", 482*9e423941SBarry Smith# storing potential matches in implsFuncAll.txt. 483*9e423941SBarry Smith# 484*9e423941SBarry Smith# For each man page we then grep in this file for the item's name followed by 485*9e423941SBarry Smith# a single underscore and process the resulting implsFunc.txt to generate HTML. 486*9e423941SBarry Smith# 487*9e423941SBarry Smith# To find class implementations, we populate implsClassAll.txt with candidates 488*9e423941SBarry Smith# - of the form "struct _p_itemName {", and 489*9e423941SBarry Smith# - not containing a semicolon 490*9e423941SBarry Smith# and then grep for particular values of itemName, generating implsClass.txt, 491*9e423941SBarry Smith# which is processed to generate HTML. 492*9e423941SBarry Smith# 493*9e423941SBarry Smith# Note: PETSC_DOC_OUT_ROOT_PLACEHOLDER must match the term used elsewhere in doc/ 494*9e423941SBarry Smithmanimplementations: 495*9e423941SBarry Smith -@git grep "struct\s\+_[pn]_[^\s]\+.*{" -- *.cpp *.cu *.c *.h *.cxx | grep -v -e ";" -e "/tests/" -e "/tutorials/" > implsClassAll.txt ; \ 496*9e423941SBarry Smith git grep -n "^\(static \)\?\(PETSC_EXTERN \)\?\(PETSC_INTERN \)\?\(extern \)\?PetscErrorCode \+[^_ ]\+_[^_ ]\+(" -- '*/impls/*.c' '*/impls/*.cpp' '*/impls/*.cu' '*/impls/*.cxx' '*/impls/*.h' | grep -v -e ";" -e "_[Pp]rivate" > implsFuncAll.txt ; \ 497*9e423941SBarry Smith for i in ${LOC}/manualpages/*/*.md foo; do \ 498*9e423941SBarry Smith if [ "$$i" != "foo" ] ; then \ 499*9e423941SBarry Smith itemName=`basename $$i .md`;\ 500*9e423941SBarry Smith grep "\s$${itemName}_" implsFuncAll.txt > implsFunc.txt ; \ 501*9e423941SBarry Smith grep "_p_$${itemName}\b" implsClassAll.txt > implsClass.txt ; \ 502*9e423941SBarry Smith if [ -s implsFunc.txt ] || [ -s implsClass.txt ] ; then \ 503*9e423941SBarry Smith printf "\n## Implementations\n\n" >> $$i; \ 504*9e423941SBarry Smith fi ; \ 505*9e423941SBarry Smith if [ -s implsFunc.txt ] ; then \ 506*9e423941SBarry Smith sed "s?\(.*\.[ch]x*u*\).*\($${itemName}.*\)(.*)?<A HREF=\"PETSC_DOC_OUT_ROOT_PLACEHOLDER/\1.html#\2\">\2 in \1</A><BR>?" implsFunc.txt >> $$i ; \ 507*9e423941SBarry Smith fi ; \ 508*9e423941SBarry Smith if [ -s implsClass.txt ] ; then \ 509*9e423941SBarry Smith sed "s?\(.*\.[ch]x*u*\):.*\(_p_$${itemName}\)\b.*{?<A HREF=\"PETSC_DOC_OUT_ROOT_PLACEHOLDER/\1.html#\2\">\2 in \1</A><BR>?" implsClass.txt >> $$i ; \ 510*9e423941SBarry Smith fi ; \ 511*9e423941SBarry Smith ${RM} implsFunc.txt implsClass.txt; \ 512*9e423941SBarry Smith fi ; \ 513*9e423941SBarry Smith done ; \ 514*9e423941SBarry Smith ${RM} implsClassAll.txt implsFuncAll.txt 515f4da3331SVáclav Hapla 5167b770568SPatrick Sanan# Build all classic docs except html sources 517*9e423941SBarry Smithalldoc_pre: chk_loc allmanpages allmanexamples 518*9e423941SBarry Smith -${OMAKE_SELF} LOC=${LOC} manimplementations 519c3a89c15SBarry Smith -${PYTHON} lib/petsc/bin/maint/wwwindex.py ${PETSC_DIR} ${LOC} 520753a1a87SJed Brown 521*9e423941SBarry Smith# Run after alldoc_pre 522b8a29d3aSPatrick Sananalldoc_post: chk_loc 523*9e423941SBarry Smith -${OMAKE_SELF} ACTION=html PETSC_DIR=${PETSC_DIR} tree LOC=${LOC} 524753a1a87SJed Brown 52572ece014SPatrick Sananalldocclean: deletemanualpages allcleanhtml 526753a1a87SJed Brown 527589e537fSPatrick Sanan# Deletes man pages (.md version) 528753a1a87SJed Browndeletemanualpages: chk_loc 52973fdd05bSBarry Smith -@if [ -d ${LOC} -a -d ${LOC}/manualpages ]; then \ 53073fdd05bSBarry Smith find ${LOC}/manualpages -type f -name "*.md" -exec ${RM} {} \; ;\ 53173fdd05bSBarry Smith ${RM} ${LOC}/manualpages/manualpages.cit ;\ 532753a1a87SJed Brown fi 533753a1a87SJed Brown 534753a1a87SJed Brownallcleanhtml: 535*9e423941SBarry Smith -${OMAKE_SELF} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} tree 536753a1a87SJed Brown 537753a1a87SJed Brown########################################################### 538753a1a87SJed Brown# targets to build distribution and update docs 539753a1a87SJed Brown########################################################### 540753a1a87SJed Brown 541a8af48b3SSatish Balay# Creates ${HOME}/petsc.tar.gz [and petsc-with-docs.tar.gz] 542753a1a87SJed Browndist: 5439dddd249SSatish Balay ${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} main 544753a1a87SJed Brown 545753a1a87SJed Brown########################################################### 546753a1a87SJed Brown# 547753a1a87SJed Brown# See script for details 548753a1a87SJed Brown# 549753a1a87SJed Browngcov: 55041baa1e4SJacob Faibussowitsch output_file_base_name=${PETSC_ARCH}-gcovr-report.json; \ 55120c90202SJacob Faibussowitsch petsc_arch_dir=${PETSC_DIR}/${PETSC_ARCH}; \ 552ccfcae5eSJacob Faibussowitsch tar_file=$${petsc_arch_dir}/$${output_file_base_name}.tar.bz2; \ 553ccfcae5eSJacob Faibussowitsch cd $${petsc_arch_dir}/obj && \ 554ccfcae5eSJacob Faibussowitsch gcovr --json --output $${petsc_arch_dir}/$${output_file_base_name} --exclude '.*/ftn-auto/.*' --exclude-lines-by-pattern '^\s*SETERR.*' --exclude-throw-branches --exclude-unreachable-branches -j 4 --gcov-executable "${PETSC_COVERAGE_EXEC}" --root ${PETSC_DIR} . ${PETSC_GCOV_OPTIONS} && \ 555ccfcae5eSJacob Faibussowitsch ${RM} -f $${tar_file} && \ 556ccfcae5eSJacob Faibussowitsch tar --bzip2 -cf $${tar_file} -C $${petsc_arch_dir} ./$${output_file_base_name} && \ 557ccfcae5eSJacob Faibussowitsch ${RM} $${petsc_arch_dir}/$${output_file_base_name} 558753a1a87SJed Brown 559753a1a87SJed Brownmergegcov: 5607ce81a4bSJacob 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} 561b0e5478fSScott Kruger 562753a1a87SJed Brown# 563753a1a87SJed Brown# ------------------------------------------------------------------------------- 564753a1a87SJed Brown# 565753a1a87SJed Brown# Some macros to check if the fortran interface is up-to-date. 566753a1a87SJed Brown# 567753a1a87SJed Browncountfortranfunctions: 568f53b81b6SPierre Jolivet -@cd ${PETSC_DIR}/src/fortran; grep -E '^void' custom/*.c auto/*.c | \ 569f53b81b6SPierre Jolivet cut -d'(' -f1 | tr -s ' ' | cut -d' ' -f2 | uniq | grep -E -v "(^$$|Petsc)" | \ 570753a1a87SJed Brown sed "s/_$$//" | sort > /tmp/countfortranfunctions 571753a1a87SJed Brown 572753a1a87SJed Browncountcfunctions: 573068711b4SBarry Smith -@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h | grep "(" | tr -s ' ' | \ 574753a1a87SJed Brown cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' | \ 575068711b4SBarry Smith tr 'A-Z' 'a-z' | sort | uniq > /tmp/countcfunctions 576753a1a87SJed Brown 577753a1a87SJed Browndifffortranfunctions: countfortranfunctions countcfunctions 578753a1a87SJed Brown -@echo -------------- Functions missing in the fortran interface --------------------- 579753a1a87SJed Brown -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 580753a1a87SJed Brown -@echo ----------------- Functions missing in the C interface ------------------------ 581753a1a87SJed Brown -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 582753a1a87SJed Brown -@${RM} /tmp/countcfunctions /tmp/countfortranfunctions 583753a1a87SJed Brown 584753a1a87SJed Browncheckbadfortranstubs: 585753a1a87SJed Brown -@echo "=========================================" 586753a1a87SJed Brown -@echo "Functions with MPI_Comm as an Argument" 587753a1a87SJed Brown -@echo "=========================================" 588753a1a87SJed Brown -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \ 589753a1a87SJed Brown tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 590753a1a87SJed Brown -@echo "=========================================" 591753a1a87SJed Brown -@echo "Functions with a String as an Argument" 592753a1a87SJed Brown -@echo "=========================================" 593753a1a87SJed Brown -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \ 594753a1a87SJed Brown tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 595753a1a87SJed Brown -@echo "=========================================" 596753a1a87SJed Brown -@echo "Functions with Pointers to PETSc Objects as Argument" 597753a1a87SJed Brown -@echo "=========================================" 598753a1a87SJed Brown -@cd ${PETSC_DIR}/src/fortran/auto; \ 599753a1a87SJed Brown _p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \ 600753a1a87SJed Brown cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \ 601753a1a87SJed Brown sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ 602753a1a87SJed Brown for OBJ in $$_p_OBJ; do \ 603753a1a87SJed Brown grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \ 604753a1a87SJed Brown cut -d'(' -f1 | cut -d' ' -f1,3; \ 605753a1a87SJed Brown done 606a3269974SBarry Smith 607a3269974SBarry Smithcheckpackagetests: 608a3269974SBarry Smith -@echo "Missing package tests" 609f53b81b6SPierre 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 610a3269974SBarry Smith -@echo "Missing download package tests" 611f53b81b6SPierre 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 612a3269974SBarry Smith 613dc0529c6SBarry Smith.PHONY: info info_h all deletelibs allclean update \ 614425fd74bSBarry Smith alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanpages \ 615425fd74bSBarry Smith allcleanhtml countfortranfunctions \ 616416ff897SSatish Balay start_configure configure_petsc configure_clean matlabbin install 617