1753a1a87SJed Brown# 2*4c512586SBarry Smith# See https://petsc.org/release/install/ for instructions on installing PETSc 3753a1a87SJed Brown# 4*4c512586SBarry Smith# This is the top level makefile for compiling PETSc. 5*4c512586SBarry Smith# * make help - useful messages on functionality 6*4c512586SBarry Smith# * make all - compile the PETSc libraries and utilities 7*4c512586SBarry Smith# * make check - runs a quick test that the libraries are built correctly and PETSc applications can run 8*4c512586SBarry Smith# 9*4c512586SBarry Smith# * make install - for use with ./configure is run with the --prefix=directory option 10*4c512586SBarry Smith# * make test - runs a comprehensive test suite (requires gnumake) 11*4c512586SBarry Smith# * make docs - build the entire PETSc website of documentation (locally) 12*4c512586SBarry Smith# * a variety of rules that print library properties useful for building applications (use make help) 13*4c512586SBarry Smith# * a variety of rules for PETSc developers 14*4c512586SBarry Smith# 15*4c512586SBarry Smith# gmakefile - manages the compiling PETSc in parallel 16*4c512586SBarry Smith# gmakefile.test - manages running the comprehensive test suite 17*4c512586SBarry Smith# 18*4c512586SBarry Smith# This makefile does not require GNUmake 19753a1a87SJed BrownALL: all 209e423941SBarry SmithDIRS = src include interfaces share/petsc/matlab 21753a1a87SJed Brown 22753a1a87SJed Brown# next line defines PETSC_DIR and PETSC_ARCH if they are not set 23af0996ceSBarry Smithinclude ././${PETSC_ARCH}/lib/petsc/conf/petscvariables 249e423941SBarry Smith#include ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscrules 25af0996ceSBarry Smithinclude ${PETSC_DIR}/lib/petsc/conf/variables 269e423941SBarry Smithinclude ${PETSC_DIR}/lib/petsc/conf/rules.doc 27e8666488SSatish Balayinclude ${PETSC_DIR}/lib/petsc/conf/test.common 28753a1a87SJed Brown 29fa2665b1SJed Brown# This makefile contains a lot of PHONY targets with improperly specified prerequisites 30fa2665b1SJed Brown# where correct execution instead depends on the targets being processed in the correct 31*4c512586SBarry Smith# order. 32fa2665b1SJed Brown.NOTPARALLEL: 33fa2665b1SJed Brown 340e03b746SBarry SmithOMAKE_SELF = $(OMAKE) -f makefile 350e03b746SBarry SmithOMAKE_SELF_PRINTDIR = $(OMAKE_PRINTDIR) -f makefile 360e03b746SBarry Smith 37*4c512586SBarry Smith#********* Rules for make all ********************************************************************************************************************************** 38*4c512586SBarry Smith 39dd8585cdSJed Brownall: 400e03b746SBarry Smith +@${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} chk_petscdir chk_upgrade | tee ${PETSC_ARCH}/lib/petsc/conf/make.log 41af0996ceSBarry Smith @ln -sf ${PETSC_ARCH}/lib/petsc/conf/make.log make.log 420093410fSSatish 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 432b38c152SPierre Jolivet +@if [ "`cat ${PETSC_ARCH}/lib/petsc/conf/error.log 2> /dev/null`" != "0" ]; then \ 44f53b81b6SPierre 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; \ 450093410fSSatish Balay if test -s ${PETSC_ARCH}/lib/petsc/conf/memoryerror.log; then \ 4671488455SBarry Smith printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 4771488455SBarry 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; \ 4871488455SBarry Smith printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 490093410fSSatish Balay else \ 50af0996ceSBarry Smith printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 51af0996ceSBarry Smith echo " Error during compile, check ${PETSC_ARCH}/lib/petsc/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 52af0996ceSBarry 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;\ 53af0996ceSBarry Smith printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 540093410fSSatish Balay fi \ 55753a1a87SJed Brown else \ 560e03b746SBarry 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 ;\ 57753a1a87SJed Brown fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below 584dcdf380SSatish Balay @echo "Finishing make run at `date +'%a, %d %b %Y %H:%M:%S %z'`" >> ${PETSC_ARCH}/lib/petsc/conf/make.log 592b38c152SPierre Jolivet @if [ "`cat ${PETSC_ARCH}/lib/petsc/conf/error.log 2> /dev/null`" != "0" ]; then exit 1; fi 60753a1a87SJed Brown 61504e95faSBarry Smithall-local: info libs matlabbin petsc4py-build libmesh-build mfem-build slepc-build hpddm-build amrex-build bamg-build 62fa2665b1SJed Brown 639e423941SBarry Smith${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/files: 649e423941SBarry Smith @touch -t 197102020000 ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/files 659e423941SBarry Smith 669e423941SBarry Smith${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles: 679e423941SBarry Smith @${MKDIR} -p ${PETSC_DIR}/${PETSC_ARCH}/tests && touch -t 197102020000 ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles 689e423941SBarry Smith 699e423941SBarry Smithlibs: ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/files ${PETSC_DIR}/${PETSC_ARCH}/tests/testfiles 709e423941SBarry Smith +@r=`echo "${MAKEFLAGS}" | grep ' -j'`; \ 719e423941SBarry Smith if [ "$$?" = 0 ]; then make_j=""; else make_j="-j${MAKE_NP}"; fi; \ 729e423941SBarry Smith r=`echo "${MAKEFLAGS}" | grep ' -l'`; \ 739e423941SBarry Smith if [ "$$?" = 0 ]; then make_l=""; else make_l="-l${MAKE_LOAD}"; fi; \ 749e423941SBarry Smith cmd="${OMAKE_PRINTDIR} -f gmakefile $${make_j} $${make_l} ${MAKE_PAR_OUT_FLG} V=${V} libs"; \ 759e423941SBarry Smith cd ${PETSC_DIR} && echo $${cmd} && exec $${cmd} 769e423941SBarry Smith 77*4c512586SBarry Smithchk_upgrade: 78*4c512586SBarry Smith -@PETSC_DIR=${PETSC_DIR} ${PYTHON} ${PETSC_DIR}/lib/petsc/bin/petscnagupgrade.py 79753a1a87SJed Brown 80*4c512586SBarry Smithchklib_dir: 81*4c512586SBarry Smith @if [ ! -d "${INSTALL_LIB_DIR}" ]; then \ 82*4c512586SBarry Smith echo Making directory ${INSTALL_LIB_DIR} for library; ${MKDIR} ${INSTALL_LIB_DIR} ; fi 83*4c512586SBarry Smith 84d2b3add8SSatish Balaymatlabbin: 854242cbabSBarry Smith -@if [ "${MATLAB_MEX}" != "" -a "${MATLAB_SOCKET}" != "" -a "${PETSC_SCALAR}" = "real" -a "${PETSC_PRECISION}" = "double" ]; then \ 86d2b3add8SSatish Balay echo "BEGINNING TO COMPILE MATLAB INTERFACE"; \ 87d2b3add8SSatish Balay if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc; fi; \ 88d2b3add8SSatish Balay if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab; fi; \ 89b75c6efcSBarry Smith cd src/sys/classes/viewer/impls/socket/mex-scripts && ${OMAKE_SELF} mex-scripts PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR}; \ 90d2b3add8SSatish Balay echo "========================================="; \ 91d2b3add8SSatish Balay fi 92*4c512586SBarry Smith 93*4c512586SBarry Smithallfortranstubs: 94*4c512586SBarry Smith -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 95*4c512586SBarry Smith @${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py ${BFORT} ${VERBOSE} 96*4c512586SBarry Smith -@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py -merge ${VERBOSE} 97*4c512586SBarry Smith -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 98*4c512586SBarry Smith 99*4c512586SBarry Smithdeleteshared: 100*4c512586SBarry Smith @for LIBNAME in ${SHLIBS}; \ 101*4c512586SBarry Smith do \ 102*4c512586SBarry Smith if [ -d ${INSTALL_LIB_DIR}/$${LIBNAME}.dylib.dSYM ]; then \ 103*4c512586SBarry Smith echo ${RM} -rf ${INSTALL_LIB_DIR}/$${LIBNAME}.dylib.dSYM; \ 104*4c512586SBarry Smith ${RM} -rf ${INSTALL_LIB_DIR}/$${LIBNAME}.dylib.dSYM; \ 105*4c512586SBarry Smith fi; \ 106*4c512586SBarry Smith echo ${RM} ${INSTALL_LIB_DIR}/$${LIBNAME}.${SL_LINKER_SUFFIX}; \ 107*4c512586SBarry Smith ${RM} ${INSTALL_LIB_DIR}/$${LIBNAME}.${SL_LINKER_SUFFIX}; \ 108*4c512586SBarry Smith done 109*4c512586SBarry Smith @if [ -f ${INSTALL_LIB_DIR}/so_locations ]; then \ 110*4c512586SBarry Smith echo ${RM} ${INSTALL_LIB_DIR}/so_locations; \ 111*4c512586SBarry Smith ${RM} ${INSTALL_LIB_DIR}/so_locations; \ 112*4c512586SBarry Smith fi 113*4c512586SBarry Smith 114*4c512586SBarry Smithdeletefortranstubs: 115*4c512586SBarry Smith -@find . -type d -name ftn-auto | xargs rm -rf 116*4c512586SBarry Smith 117*4c512586SBarry Smithreconfigure: allclean 118*4c512586SBarry Smith @unset MAKEFLAGS && ${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py 119*4c512586SBarry Smith 120*4c512586SBarry Smithchkopts: 121*4c512586SBarry Smith -@echo "Warning: chkopts target is deprecated and can be removed from user makefiles" 122*4c512586SBarry Smith 123*4c512586SBarry Smithgnumake: 124*4c512586SBarry Smith +@echo "make gnumake is deprecated, use make libs" 125*4c512586SBarry Smith +@make libs 126*4c512586SBarry Smith 127*4c512586SBarry Smith# ******** Rules for make check **************************************************************************************************************************** 128*4c512586SBarry Smith 12927cb8d94SBarry SmithRUN_TEST = ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff 13027cb8d94SBarry Smith 1310e03b746SBarry Smithcheck_install: check 1320e03b746SBarry Smithcheck: 1330e03b746SBarry Smith -@echo "Running check examples to verify correct installation" 134753a1a87SJed Brown -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 13527cb8d94SBarry Smith @if [ "${PETSC_WITH_BATCH}" != "" ]; then \ 13627cb8d94SBarry Smith echo "Running with batch filesystem, cannot run make check"; \ 13727cb8d94SBarry Smith elif [ "${MPIEXEC}" = "/bin/false" ]; then \ 13827cb8d94SBarry Smith echo "*mpiexec not found*. cannot run make check"; \ 13927cb8d94SBarry Smith else \ 14027cb8d94SBarry Smith ${RM} -f check_error;\ 14127cb8d94SBarry 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; \ 14227cb8d94SBarry Smith if [ -f check_error ]; then \ 14327cb8d94SBarry Smith echo "Error while running make check"; \ 14427cb8d94SBarry Smith ${RM} -f check_error;\ 14527cb8d94SBarry Smith exit 1; \ 14627cb8d94SBarry Smith fi; \ 14727cb8d94SBarry Smith ${RM} -f check_error;\ 14827cb8d94SBarry Smith fi; 14927cb8d94SBarry Smith 15027cb8d94SBarry Smithcheck_build: 15127cb8d94SBarry Smith +@cd src/snes/tutorials >/dev/null; ${RUN_TEST} clean-legacy 15227cb8d94SBarry Smith +@cd src/snes/tutorials >/dev/null; ${RUN_TEST} testex19 15327cb8d94SBarry Smith +@if [ ! "${MPI_IS_MPIUNI}" ]; then cd src/snes/tutorials >/dev/null; ${RUN_TEST} testex19_mpi; fi 15427cb8d94SBarry Smith +@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_SCALAR}" = "real" ]; then \ 155de5e753aSSatish Balay if [ "${CUDA_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_cuda; \ 156de5e753aSSatish Balay elif [ "${HIP_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_hip; \ 15727cb8d94SBarry Smith else HYPRE_TEST=runex19_hypre; fi; \ 15827cb8d94SBarry Smith cd src/snes/tutorials >/dev/null; ${RUN_TEST} $${HYPRE_TEST}; \ 15927cb8d94SBarry Smith fi; 16027cb8d94SBarry Smith +@if [ "${CUDA_LIB}" != "" ]; then \ 16127cb8d94SBarry Smith cd src/snes/tutorials >/dev/null; ${RUN_TEST} runex19_cuda; \ 16227cb8d94SBarry Smith fi; 16327cb8d94SBarry Smith +@if [ "${MPI_IS_MPIUNI}" = "" ]; then \ 16427cb8d94SBarry Smith cd src/snes/tutorials >/dev/null; \ 16527cb8d94SBarry Smith if [ "${KOKKOS_KERNELS_LIB}" != "" ] && [ "${PETSC_SCALAR}" = "real" ] && [ "${PETSC_PRECISION}" = "double" ]; then \ 16627cb8d94SBarry Smith ${RUN_TEST} runex3k_kokkos; \ 167de5e753aSSatish Balay fi;\ 16827cb8d94SBarry Smith if [ "${MUMPS_LIB}" != "" ]; then \ 16927cb8d94SBarry Smith ${RUN_TEST} runex19_fieldsplit_mumps; \ 17027cb8d94SBarry Smith fi;\ 17127cb8d94SBarry Smith if [ "${SUITESPARSE_LIB}" != "" ]; then \ 17227cb8d94SBarry Smith ${RUN_TEST} runex19_suitesparse; \ 17327cb8d94SBarry Smith fi;\ 17427cb8d94SBarry Smith if [ "${SUPERLU_DIST_LIB}" != "" ]; then \ 17527cb8d94SBarry Smith ${RUN_TEST} runex19_superlu_dist; \ 17627cb8d94SBarry Smith fi;\ 17727cb8d94SBarry Smith if ( [ "${ML_LIB}" != "" ] || [ "${TRILINOS_LIB}" != "" ] ); then \ 17827cb8d94SBarry Smith ${RUN_TEST} runex19_ml; \ 17927cb8d94SBarry Smith fi; \ 18027cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 18127cb8d94SBarry Smith cd - > /dev/null; \ 182e91fee76SPierre Jolivet if ( [ "${AMREX_LIB}" != "" ] && [ "${CUDA_LIB}" = "" ] ); then \ 183bd579fedSSatish Balay echo "Running amrex test example to verify correct installation";\ 184bd579fedSSatish Balay echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}";\ 185bd579fedSSatish Balay cd src/ksp/ksp/tutorials/amrex >/dev/null;\ 18627cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 18727cb8d94SBarry Smith ${RUN_TEST} testamrex; \ 18827cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 18927cb8d94SBarry Smith cd - > /dev/null; \ 19027cb8d94SBarry Smith fi;\ 19127cb8d94SBarry Smith fi; 19227cb8d94SBarry Smith +@if [ "${HDF5_LIB}" != "" ]; then \ 19327cb8d94SBarry Smith cd src/vec/vec/tests >/dev/null;\ 19427cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 19527cb8d94SBarry Smith ${RUN_TEST} runex47; \ 19627cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 197bd579fedSSatish Balay fi; 198b6efb0a5SBarry Smith +@if [ "${MPI4PY}" = "yes" ]; then \ 199b6efb0a5SBarry Smith cd src/sys/tests >/dev/null; \ 20027cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 20127cb8d94SBarry Smith ${RUN_TEST} testex55; \ 20227cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 203b6efb0a5SBarry Smith fi; 20445ee4180SJed Brown +@if [ "${PETSC4PY}" = "yes" ]; then \ 205c4762a1bSJed Brown cd src/ksp/ksp/tutorials >/dev/null; \ 20627cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 20727cb8d94SBarry Smith ${RUN_TEST} testex100; \ 20827cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 2095061939cSBarry Smith fi; 210f53b81b6SPierre Jolivet +@grep -E "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 211cb297985SSatish Balay if test -s .ftn.log; then \ 212bd579fedSSatish Balay cd src/snes/tutorials >/dev/null; \ 21327cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 21427cb8d94SBarry Smith ${RUN_TEST} testex5f; \ 21527cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 216cb297985SSatish Balay fi; ${RM} .ftn.log; 217f53b81b6SPierre Jolivet +@grep -E "^#define PETSC_HAVE_MATLAB 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 21869cdbcb9SBarry Smith if test -s .ftn.log; then \ 219bd579fedSSatish Balay cd src/vec/vec/tutorials >/dev/null; \ 22027cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 22127cb8d94SBarry Smith ${RUN_TEST} testex31; \ 22227cb8d94SBarry Smith ${RUN_TEST} clean-legacy; \ 22369cdbcb9SBarry Smith fi; ${RM} .ftn.log; 224753a1a87SJed Brown -@echo "Completed test examples" 22527cb8d94SBarry Smith 226*4c512586SBarry Smith# ********* Rules for make install ******************************************************************************************************************* 227*4c512586SBarry Smith 228*4c512586SBarry Smithinstall: 229*4c512586SBarry Smith @${PYTHON} ./config/install.py -destDir=${DESTDIR} 230*4c512586SBarry Smith +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=$@ install-builtafterpetsc 231*4c512586SBarry Smith 232*4c512586SBarry Smith# A smaller install with fewer extras 233*4c512586SBarry Smithinstall-lib: 234*4c512586SBarry Smith @${PYTHON} ./config/install.py -destDir=${DESTDIR} -no-examples 235*4c512586SBarry Smith +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_INSTALL=$@ install-builtafterpetsc 236*4c512586SBarry Smith 237*4c512586SBarry Smithinstall-builtafterpetsc: 238*4c512586SBarry Smith +${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 239*4c512586SBarry Smith 240*4c512586SBarry Smith# Creates ${HOME}/petsc.tar.gz [and petsc-with-docs.tar.gz] 241*4c512586SBarry Smithdist: 242*4c512586SBarry Smith ${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} main 243*4c512586SBarry Smith 244*4c512586SBarry Smith#********* Rules for cleaning *************************************************************************************************************************** 245*4c512586SBarry Smith 246*4c512586SBarry Smithdeletelibs: 247*4c512586SBarry Smith -${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.* 248*4c512586SBarry Smithdeletemods: 249*4c512586SBarry Smith -${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod 250*4c512586SBarry Smith 251*4c512586SBarry Smithallclean: 252*4c512586SBarry Smith -@${OMAKE} -f gmakefile clean 253*4c512586SBarry Smith 254*4c512586SBarry Smithclean:: allclean 255*4c512586SBarry Smith 256*4c512586SBarry Smithdistclean: chk_petscdir 257*4c512586SBarry Smith @if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then \ 258*4c512586SBarry Smith echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***"; \ 259*4c512586SBarry Smith mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/; fi 260*4c512586SBarry Smith @echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***" 261*4c512586SBarry Smith -${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/ 262*4c512586SBarry Smith 263*4c512586SBarry Smith#********* Rules for printing library properties useful for building applications *********************************************************** 264*4c512586SBarry Smith 265*4c512586SBarry Smithgetmpilinklibs: 266*4c512586SBarry Smith -@echo ${MPI_LIB} 267*4c512586SBarry Smith 268*4c512586SBarry Smithgetmpiincludedirs: 269*4c512586SBarry Smith -@echo ${MPI_INCLUDE} 270*4c512586SBarry Smith 271*4c512586SBarry Smithgetmpiexec: 272*4c512586SBarry Smith -@echo ${MPIEXEC} 273*4c512586SBarry Smith 274*4c512586SBarry Smithgetccompiler: 275*4c512586SBarry Smith -@echo ${CC} 276*4c512586SBarry Smith 277*4c512586SBarry Smithgetfortrancompiler: 278*4c512586SBarry Smith -@echo ${FC} 279*4c512586SBarry Smith 280*4c512586SBarry Smithgetcxxcompiler: 281*4c512586SBarry Smith -@echo ${CXX} 282*4c512586SBarry Smith 283*4c512586SBarry Smithgetlinklibs: 284*4c512586SBarry Smith -@echo ${C_SH_LIB_PATH} ${PETSC_TS_LIB} 285*4c512586SBarry Smith 286*4c512586SBarry Smithgetincludedirs: 287*4c512586SBarry Smith -@echo ${PETSC_CC_INCLUDES} 288*4c512586SBarry Smith 289*4c512586SBarry Smithgetcflags: 290*4c512586SBarry Smith -@echo ${CC_FLAGS} 291*4c512586SBarry Smith 292*4c512586SBarry Smithgetcxxflags: 293*4c512586SBarry Smith -@echo ${CXX_FLAGS} 294*4c512586SBarry Smith 295*4c512586SBarry Smithgetfortranflags: 296*4c512586SBarry Smith -@echo ${FC_FLAGS} 297*4c512586SBarry Smith 298*4c512586SBarry Smithgetblaslapacklibs: 299*4c512586SBarry Smith -@echo ${BLASLAPACK_LIB} 300*4c512586SBarry Smith 301*4c512586SBarry Smithgetautoconfargs: 302*4c512586SBarry Smith -@echo CC='"${CC}"' CXX='"${CXX}"' FC='"${FC}"' CFLAGS='"${CC_FLAGS}"' CXXFLAGS='"${CXX_FLAGS}"' FCFLAGS='"${FC_FLAGS}"' LIBS='"${C_SH_LIB_PATH} ${PETSC_TS_LIB}"' 303*4c512586SBarry Smith 304*4c512586SBarry Smithinfo: 305*4c512586SBarry Smith -@echo "==========================================" 306*4c512586SBarry Smith -@echo " " 307*4c512586SBarry Smith -@echo "See documentation/faq.html and documentation/bugreporting.html" 308*4c512586SBarry Smith -@echo "for help with installation problems. Please send EVERYTHING" 309*4c512586SBarry Smith -@echo "printed out below when reporting problems. Please check the" 310*4c512586SBarry Smith -@echo "mailing list archives and consider subscribing." 311*4c512586SBarry Smith -@echo " " 312*4c512586SBarry Smith -@echo " https://petsc.org/release/community/mailing/" 313*4c512586SBarry Smith -@echo " " 314*4c512586SBarry Smith -@echo "==========================================" 315*4c512586SBarry Smith -@echo Starting make run on `hostname` at `date +'%a, %d %b %Y %H:%M:%S %z'` 316*4c512586SBarry Smith -@echo Machine characteristics: `uname -a` 317*4c512586SBarry Smith -@echo "-----------------------------------------" 318*4c512586SBarry Smith -@echo "Using PETSc directory: ${PETSC_DIR}" 319*4c512586SBarry Smith -@echo "Using PETSc arch: ${PETSC_ARCH}" 320*4c512586SBarry Smith -@echo "-----------------------------------------" 321*4c512586SBarry Smith -@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//" | head -n 7 322*4c512586SBarry Smith -@echo "-----------------------------------------" 323*4c512586SBarry Smith -@echo "Using configure Options: ${CONFIGURE_OPTIONS}" 324*4c512586SBarry Smith -@echo "Using configuration flags:" 325*4c512586SBarry Smith -@grep "\#define " ${PETSCCONF_H} | tail -n +2 326*4c512586SBarry Smith -@echo "-----------------------------------------" 327*4c512586SBarry Smith -@echo "Using C compile: ${PETSC_CCOMPILE_SINGLE}" 328*4c512586SBarry Smith -@if [ "${MPICC_SHOW}" != "" ]; then \ 329*4c512586SBarry Smith printf "mpicc -show: %b\n" "${MPICC_SHOW}";\ 330*4c512586SBarry Smith fi; \ 331*4c512586SBarry Smith printf "C compiler version: %b\n" "${C_VERSION}"; \ 332*4c512586SBarry Smith if [ "${CXX}" != "" ]; then \ 333*4c512586SBarry Smith echo "Using C++ compile: ${PETSC_CXXCOMPILE_SINGLE}";\ 334*4c512586SBarry Smith if [ "${MPICXX_SHOW}" != "" ]; then \ 335*4c512586SBarry Smith printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \ 336*4c512586SBarry Smith fi;\ 337*4c512586SBarry Smith printf "C++ compiler version: %b\n" "${Cxx_VERSION}"; \ 338*4c512586SBarry Smith fi 339*4c512586SBarry Smith -@if [ "${FC}" != "" ]; then \ 340*4c512586SBarry Smith echo "Using Fortran compile: ${PETSC_FCOMPILE_SINGLE}";\ 341*4c512586SBarry Smith if [ "${MPIFC_SHOW}" != "" ]; then \ 342*4c512586SBarry Smith printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \ 343*4c512586SBarry Smith fi; \ 344*4c512586SBarry Smith printf "Fortran compiler version: %b\n" "${FC_VERSION}"; \ 345*4c512586SBarry Smith fi 346*4c512586SBarry Smith -@if [ "${CUDAC}" != "" ]; then \ 347*4c512586SBarry Smith echo "Using CUDA compile: ${PETSC_CUCOMPILE_SINGLE}";\ 348*4c512586SBarry Smith fi 349*4c512586SBarry Smith -@if [ "${CLANGUAGE}" = "CXX" ]; then \ 350*4c512586SBarry Smith echo "Using C++ compiler to compile PETSc";\ 351*4c512586SBarry Smith fi 352*4c512586SBarry Smith -@echo "-----------------------------------------" 353*4c512586SBarry Smith -@echo "Using C/C++ linker: ${PCC_LINKER}" 354*4c512586SBarry Smith -@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}" 355*4c512586SBarry Smith -@if [ "${FC}" != "" ]; then \ 356*4c512586SBarry Smith echo "Using Fortran linker: ${FC_LINKER}";\ 357*4c512586SBarry Smith echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\ 358*4c512586SBarry Smith fi 359*4c512586SBarry Smith -@echo "-----------------------------------------" 360*4c512586SBarry Smith -@echo "Using system modules: ${LOADEDMODULES}" 361*4c512586SBarry Smith -@if [ "${MPI_IS_MPIUNI}" = "1" ]; then \ 362*4c512586SBarry Smith echo Using mpi.h: mpiuni; \ 363*4c512586SBarry Smith else \ 364*4c512586SBarry Smith TESTDIR=`mktemp -q -d -t petscmpi-XXXXXXXX` && \ 365*4c512586SBarry Smith echo '#include <mpi.h>' > $${TESTDIR}/mpitest.c && \ 366*4c512586SBarry Smith BUF=`${CPP} ${PETSC_CPPFLAGS} ${PETSC_CC_INCLUDES} $${TESTDIR}/mpitest.c |grep 'mpi\.h' | ( head -1 ; cat > /dev/null )` && \ 367*4c512586SBarry Smith echo Using mpi.h: $${BUF}; ${RM} -rf $${TESTDIR}; \ 368*4c512586SBarry Smith fi 369*4c512586SBarry Smith -@echo "-----------------------------------------" 370*4c512586SBarry Smith -@echo "Using libraries: ${PETSC_LIB}" 371*4c512586SBarry Smith -@echo "------------------------------------------" 372*4c512586SBarry Smith -@echo "Using mpiexec: ${MPIEXEC}" 373*4c512586SBarry Smith -@echo "------------------------------------------" 374*4c512586SBarry Smith -@echo "Using MAKE: ${MAKE}" 375*4c512586SBarry Smith -@echo "Default MAKEFLAGS: MAKE_NP:${MAKE_NP} MAKE_LOAD:${MAKE_LOAD} MAKEFLAGS:${MAKEFLAGS}" 376*4c512586SBarry Smith -@echo "==========================================" 377*4c512586SBarry Smith 378*4c512586SBarry Smith 3790e03b746SBarry Smithcheck_usermakefile: 380b752486dSSatish Balay -@echo "Testing compile with user makefile" 381b752486dSSatish Balay -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 38227cb8d94SBarry Smith @cd src/snes/tutorials; ${RUN_TEST} clean-legacy 383c4762a1bSJed Brown @cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex19 384f53b81b6SPierre Jolivet @grep -E "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 385b752486dSSatish Balay if test -s .ftn.log; then \ 386c4762a1bSJed Brown cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex5f; \ 387b752486dSSatish Balay fi; ${RM} .ftn.log; 38827cb8d94SBarry Smith @cd src/snes/tutorials; ${RUN_TEST} clean-legacy 389b752486dSSatish Balay -@echo "Completed compile with user makefile" 390753a1a87SJed Brown 391*4c512586SBarry Smith#********* Rules for running clangformat ************************************************************************************************************ 392*4c512586SBarry Smith 393c45dcc3fSBarry Smithcheckgitclean: 3949a632cc8SPierre Jolivet @if ! git diff --quiet; then \ 395d5b43468SJose E. Roman echo "The repository has uncommitted files, cannot run checkclangformat" ;\ 396c45dcc3fSBarry Smith git status -s --untracked-files=no ;\ 397c45dcc3fSBarry Smith false;\ 398c45dcc3fSBarry Smith fi; 399c45dcc3fSBarry Smith 400c45dcc3fSBarry Smithcheckclangformatversion: 401c45dcc3fSBarry Smith @version=`clang-format --version | cut -d" " -f3 | cut -d"." -f 1` ;\ 402c45dcc3fSBarry Smith if [ "$$version" == "version" ]; then version=`clang-format --version | cut -d" " -f4 | cut -d"." -f 1`; fi;\ 4036c5826a2SPierre Jolivet if [ $$version != 16 ]; then echo "Require clang-format version 16! Currently used clang-format version is $$version" ;false ; fi 404c45dcc3fSBarry Smith 405c45dcc3fSBarry Smith# Check that all the source code in the repository satisfies the .clang_format 406c45dcc3fSBarry Smithcheckclangformat: checkclangformatversion checkgitclean clangformat 4079a632cc8SPierre Jolivet @if ! git diff --quiet; then \ 4089a632cc8SPierre Jolivet printf "The current commit has source code formatting problems\n" ;\ 4099a632cc8SPierre Jolivet if [ -z "${CI_PIPELINE_ID}" ]; then \ 4109a632cc8SPierre Jolivet printf "Please run 'git diff' to check\n"; \ 4119a632cc8SPierre Jolivet git diff --stat; \ 4129a632cc8SPierre Jolivet else \ 4139a632cc8SPierre Jolivet git diff --patch-with-stat > ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch; \ 4149a632cc8SPierre Jolivet git diff --patch-with-stat --color=always | head -1000; \ 4159a632cc8SPierre Jolivet if [ `wc -l < ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch` -gt 1000 ]; then \ 4169a632cc8SPierre Jolivet printf "The diff has been trimmed, check ${PETSC_ARCH}/lib/petsc/conf/checkclangformat.patch (in CI artifacts) for all changes\n"; \ 4179a632cc8SPierre Jolivet fi;\ 4189a632cc8SPierre Jolivet fi;\ 419c45dcc3fSBarry Smith false;\ 420c45dcc3fSBarry Smith fi; 421c45dcc3fSBarry Smith 4223d33ad60SJunchao Zhang# Compare ABI/API of two versions of PETSc library with the old one defined by PETSC_{DIR,ARCH}_ABI_OLD 4233d33ad60SJunchao Zhangabitest: 424cab5ea25SPierre Jolivet @if [ "${PETSC_DIR_ABI_OLD}" = "" ] || [ "${PETSC_ARCH_ABI_OLD}" = "" ]; \ 4253d33ad60SJunchao Zhang then printf "You must set environment variables PETSC_DIR_ABI_OLD and PETSC_ARCH_ABI_OLD to run abitest\n"; \ 4263d33ad60SJunchao Zhang exit 1; \ 4273d33ad60SJunchao Zhang fi; 4283d33ad60SJunchao Zhang -@echo "Comparing ABI/API of the following two PETSc versions (you must have already configured and built them using GCC and with -g):" 4293d33ad60SJunchao Zhang -@echo "=========================================================================================" 4303d33ad60SJunchao Zhang -@echo " Old: PETSC_DIR_ABI_OLD = ${PETSC_DIR_ABI_OLD}" 4313d33ad60SJunchao Zhang -@echo " PETSC_ARCH_ABI_OLD = ${PETSC_ARCH_ABI_OLD}" 4327b444a09SBarry Smith -@pushd ${PETSC_DIR_ABI_OLD} >> /dev/null ; echo " Branch = "`git rev-parse --abbrev-ref HEAD` 4333d33ad60SJunchao Zhang -@echo " New: PETSC_DIR = ${PETSC_DIR}" 4343d33ad60SJunchao Zhang -@echo " PETSC_ARCH = ${PETSC_ARCH}" 4357b444a09SBarry Smith -@echo " Branch = "`git rev-parse --abbrev-ref HEAD` 4363d33ad60SJunchao Zhang -@echo "=========================================================================================" 437454c5dfcSJunchao 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 4383d33ad60SJunchao Zhang 4397b444a09SBarry Smith# Compare ABI/API of current PETSC_ARCH/PETSC_DIR with a previous branch 4407b444a09SBarry Smithabitestcomplete: 4417b444a09SBarry Smith -@if [[ -f "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log" ]]; then \ 4427b444a09SBarry 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"` ;\ 4437b444a09SBarry Smithecho $${OPTIONS} ;\ 4447b444a09SBarry Smith fi ; \ 4457b444a09SBarry Smith if [[ "${PETSC_DIR_ABI_OLD}" != "" ]]; then \ 4467b444a09SBarry Smith PETSC_DIR_OLD=${PETSC_DIR_ABI_OLD}; \ 4477b444a09SBarry Smith else \ 4487b444a09SBarry Smith PETSC_DIR_OLD=${PETSC_DIR}/../petsc-abi; \ 4497b444a09SBarry Smith fi ; \ 4507b444a09SBarry Smith echo "=================================================================================================" ;\ 4517b444a09SBarry Smith echo "Doing ABI/API comparison between" ${branch} " and " `git rev-parse --abbrev-ref HEAD` "using " $${OPTIONS} ;\ 4527b444a09SBarry Smith echo "=================================================================================================" ;\ 4537b444a09SBarry Smith if [[ ! -d $${PETSC_DIR_OLD} ]]; then \ 4547b444a09SBarry Smith git clone ${PETSC_DIR} $${PETSC_DIR_OLD} ; \ 4557b444a09SBarry Smith else \ 4567b444a09SBarry Smith cd $${PETSC_DIR_OLD} ; \ 4577b444a09SBarry Smith git pull ; \ 4587b444a09SBarry Smith fi ; \ 4597b444a09SBarry Smith cd $${PETSC_DIR_OLD} ; \ 4607b444a09SBarry Smith git checkout ${branch} ; \ 4617b444a09SBarry Smith PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` ./configure $${OPTIONS} ; \ 4627b444a09SBarry Smith PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` make all test ; \ 4637b444a09SBarry Smith cd ${PETSC_DIR} ; \ 4647b444a09SBarry Smith ./configure $${OPTIONS}; \ 4657b444a09SBarry Smith make all test ; \ 4667b444a09SBarry Smith PETSC_DIR_ABI_OLD=$${PETSC_DIR_OLD} PETSC_ARCH_ABI_OLD=arch-branch-`git rev-parse ${branch}` make abitest 4677b444a09SBarry Smith 468*4c512586SBarry Smith# ******** Rules for running Streams benchmark **************************************************************************************************** 469753a1a87SJed Brown 4704198fb66SBarry Smithmpistreams: 4710e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistreams 4725fabf859SBarry Smith 4734198fb66SBarry Smithmpistream: 4740e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistream 4754198fb66SBarry Smith 4764198fb66SBarry Smithopenmpstreams: 4770e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstreams 4784198fb66SBarry Smith 4794198fb66SBarry Smithopenmpstream: 4800e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstream 4814198fb66SBarry Smith 4824198fb66SBarry Smithstream: mpistream 4834198fb66SBarry Smith 4844198fb66SBarry Smithstreams: mpistreams 485fc5166cbSSatish Balay 486*4c512586SBarry Smith# ******** Rules for generating tag files for Emacs/VIM ******************************************************************************************* 487*4c512586SBarry Smith 488753a1a87SJed Brownalletags: 489c3a89c15SBarry Smith -@${PYTHON} lib/petsc/bin/maint/generateetags.py 490753a1a87SJed Brown -@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON 491753a1a87SJed Brown 49237763f56SJed Brown# obtain gtags from https://www.gnu.org/software/global/ 493762ef373SBarry Smithallgtags: 49437763f56SJed 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 - 495762ef373SBarry Smith 496*4c512586SBarry Smith# ********* Rules for building "classic" documentation; uses rules also in lib/petsc/conf/petscrules.doc ************************************************** 497753a1a87SJed Brown 498*4c512586SBarry Smithdocs: 499*4c512586SBarry Smith cd doc; ${OMAKE_SELF} sphinxhtml 5009e423941SBarry Smith 5019e423941SBarry Smithchk_petscdir: 5029e423941SBarry Smith @mypwd=`pwd`; cd ${PETSC_DIR} 2>&1 > /dev/null; true_PETSC_DIR=`pwd`; cd $${mypwd} 2>&1 >/dev/null; \ 5039e423941SBarry Smith newpwd=`echo $${mypwd} | sed "s+$${true_PETSC_DIR}+DUMMY+g"`;\ 5049e423941SBarry Smith haspetsc=`echo $${mypwd} | sed "s+petsc-+DUMMY+g"`;\ 5059e423941SBarry Smith if [ $${mypwd} = $${newpwd} -a $${haspetsc} != $${mypwd} ]; then \ 5069e423941SBarry Smith printf ${PETSC_TEXT_HILIGHT}"*********************W-a-r-n-i-n-g*************************\n" ; \ 5079e423941SBarry Smith echo "Your PETSC_DIR may not match the directory you are in";\ 5089e423941SBarry Smith echo "PETSC_DIR " $${true_PETSC_DIR} "Current directory" $${mypwd};\ 5099e423941SBarry Smith echo "Ignore this if you are running make check ";\ 5109e423941SBarry Smith printf "******************************************************"${PETSC_TEXT_NORMAL}"\n" ; \ 5119e423941SBarry Smith fi 5129e423941SBarry Smith 5139e423941SBarry Smithchk_in_petscdir: 5149e423941SBarry Smith @if [ ! -f include/petscversion.h ]; then \ 5159e423941SBarry Smith printf ${PETSC_TEXT_HILIGHT}"*********************** ERROR **********************************************\n" ; \ 5169e423941SBarry Smith echo " This target should be invoked in top level PETSc source dir!"; \ 5179e423941SBarry Smith printf "****************************************************************************"${PETSC_TEXT_NORMAL}"\n" ; false; fi 5189e423941SBarry Smith 5199e423941SBarry Smithchk_loc: 5209e423941SBarry Smith @if [ ${LOC}foo = foo ] ; then \ 5219e423941SBarry Smith printf ${PETSC_TEXT_HILIGHT}"*********************** ERROR **********************************************\n" ; \ 5229e423941SBarry Smith echo " Please specify LOC variable for eg: make allmanpages LOC=/sandbox/petsc "; \ 5239e423941SBarry Smith printf "****************************************************************************"${PETSC_TEXT_NORMAL}"\n" ; false; fi 5249e423941SBarry Smith @${MKDIR} ${LOC}/manualpages 5259e423941SBarry Smith 5269e423941SBarry Smithchk_c2html: 5279e423941SBarry Smith @if [ ${C2HTML}foo = foo ] ; then \ 5289e423941SBarry Smith printf ${PETSC_TEXT_HILIGHT}"*********************** ERROR ************************\n" ; \ 5299e423941SBarry Smith echo "Require c2html for html docs. Please reconfigure with --download-c2html=1"; \ 5309e423941SBarry Smith printf "******************************************************"${PETSC_TEXT_NORMAL}"\n" ;false; fi 5319e423941SBarry Smith 5329e423941SBarry Smith 5339e423941SBarry Smith# the ACTION=manualpages cannot run in parallel because they all write to the same manualpages.cit file 5346121d795SBarry Smithhloc=include/petsc/private 535589e537fSPatrick Sananallmanpages: chk_loc deletemanualpages 5362ba9d5beSBarry Smith -echo " /* SUBMANSEC = PetscH */ " > ${hloc}/generated_khash.h 5372ba9d5beSBarry Smith -sed -e 's?<T>?I?g' -e 's?<t>?i?g' -e 's?<KeyType>?PetscInt?g' ${hloc}/hashset.txt >> ${hloc}/generated_khash.h 5382ba9d5beSBarry 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 5392ba9d5beSBarry 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 5402ba9d5beSBarry 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 541faa16638SBarry 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 5422ba9d5beSBarry 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 5432ba9d5beSBarry 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 54471c41f4fSBarry Smith -${RM} ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 545ac09b921SBarry Smith -${OMAKE_SELF} ACTION=manualpages tree_src LOC=${LOC} 54673fdd05bSBarry Smith -@sed -e s%man+../%man+manualpages/% ${LOC}/manualpages/manualpages.cit > ${LOC}/manualpages/htmlmap 54773fdd05bSBarry Smith -@cat ${PETSC_DIR}/doc/classic/mpi.www.index >> ${LOC}/manualpages/htmlmap 54849762cbcSSatish Balay cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 549d7b6776fSBarry Smith a=`cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err | wc -l`; test ! $$a -gt 0 550f4da3331SVáclav Hapla 551f4da3331SVáclav Haplaallmanexamples: chk_loc allmanpages 5529e423941SBarry Smith -${OMAKE_SELF} ACTION=manexamples tree LOC=${LOC} 5539e423941SBarry Smith 5549e423941SBarry Smith# 5559e423941SBarry Smith# Goes through all manual pages adding links to implementations of the method 5569e423941SBarry Smith# or class, at the end of the file. 5579e423941SBarry Smith# 5589e423941SBarry Smith# To find functions implementing methods, we use git grep to look for 5599e423941SBarry Smith# well-formed PETSc functions 5609e423941SBarry Smith# - with names containing a single underscore 5619e423941SBarry Smith# - in files of appropriate types (.cu .c .cxx .h), 5629e423941SBarry Smith# - in paths including "/impls/", 5639e423941SBarry Smith# - excluding any line with a semicolon (to avoid matching prototypes), and 5649e423941SBarry Smith# - excluding any line including "_Private", 5659e423941SBarry Smith# storing potential matches in implsFuncAll.txt. 5669e423941SBarry Smith# 5679e423941SBarry Smith# For each man page we then grep in this file for the item's name followed by 5689e423941SBarry Smith# a single underscore and process the resulting implsFunc.txt to generate HTML. 5699e423941SBarry Smith# 5709e423941SBarry Smith# To find class implementations, we populate implsClassAll.txt with candidates 5719e423941SBarry Smith# - of the form "struct _p_itemName {", and 5729e423941SBarry Smith# - not containing a semicolon 5739e423941SBarry Smith# and then grep for particular values of itemName, generating implsClass.txt, 5749e423941SBarry Smith# which is processed to generate HTML. 5759e423941SBarry Smith# 5769e423941SBarry Smith# Note: PETSC_DOC_OUT_ROOT_PLACEHOLDER must match the term used elsewhere in doc/ 5779e423941SBarry Smithmanimplementations: 5789e423941SBarry Smith -@git grep "struct\s\+_[pn]_[^\s]\+.*{" -- *.cpp *.cu *.c *.h *.cxx | grep -v -e ";" -e "/tests/" -e "/tutorials/" > implsClassAll.txt ; \ 5799e423941SBarry 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 ; \ 5809e423941SBarry Smith for i in ${LOC}/manualpages/*/*.md foo; do \ 5819e423941SBarry Smith if [ "$$i" != "foo" ] ; then \ 5829e423941SBarry Smith itemName=`basename $$i .md`;\ 5839e423941SBarry Smith grep "\s$${itemName}_" implsFuncAll.txt > implsFunc.txt ; \ 5849e423941SBarry Smith grep "_p_$${itemName}\b" implsClassAll.txt > implsClass.txt ; \ 5859e423941SBarry Smith if [ -s implsFunc.txt ] || [ -s implsClass.txt ] ; then \ 5869e423941SBarry Smith printf "\n## Implementations\n\n" >> $$i; \ 5879e423941SBarry Smith fi ; \ 5889e423941SBarry Smith if [ -s implsFunc.txt ] ; then \ 5899e423941SBarry 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 ; \ 5909e423941SBarry Smith fi ; \ 5919e423941SBarry Smith if [ -s implsClass.txt ] ; then \ 5929e423941SBarry 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 ; \ 5939e423941SBarry Smith fi ; \ 5949e423941SBarry Smith ${RM} implsFunc.txt implsClass.txt; \ 5959e423941SBarry Smith fi ; \ 5969e423941SBarry Smith done ; \ 5979e423941SBarry Smith ${RM} implsClassAll.txt implsFuncAll.txt 598f4da3331SVáclav Hapla 5997b770568SPatrick Sanan# Build all classic docs except html sources 6009e423941SBarry Smithalldoc_pre: chk_loc allmanpages allmanexamples 6019e423941SBarry Smith -${OMAKE_SELF} LOC=${LOC} manimplementations 602c3a89c15SBarry Smith -${PYTHON} lib/petsc/bin/maint/wwwindex.py ${PETSC_DIR} ${LOC} 603753a1a87SJed Brown 60403953011SBarry Smith# Run after alldoc_pre to build html sources 60503953011SBarry Smithalldoc_post: chk_loc chk_c2html 60603953011SBarry Smith -@if command -v parallel &> /dev/null; then \ 60703953011SBarry Smith ls include/makefile src/*/makefile | xargs dirname | parallel -j ${MAKE_TEST_NP} --load ${MAKE_LOAD} 'cd {}; ${OMAKE_SELF} LOC=${LOC} PETSC_DIR=${PETSC_DIR} ACTION=html tree' ; \ 60803953011SBarry Smith else \ 60903953011SBarry Smith ${OMAKE_SELF} ACTION=html PETSC_DIR=${PETSC_DIR} tree LOC=${LOC}; \ 61003953011SBarry Smith fi 611753a1a87SJed Brown 61272ece014SPatrick Sananalldocclean: deletemanualpages allcleanhtml 613753a1a87SJed Brown 614589e537fSPatrick Sanan# Deletes man pages (.md version) 615753a1a87SJed Browndeletemanualpages: chk_loc 61673fdd05bSBarry Smith -@if [ -d ${LOC} -a -d ${LOC}/manualpages ]; then \ 61773fdd05bSBarry Smith find ${LOC}/manualpages -type f -name "*.md" -exec ${RM} {} \; ;\ 61873fdd05bSBarry Smith ${RM} ${LOC}/manualpages/manualpages.cit ;\ 619753a1a87SJed Brown fi 620753a1a87SJed Brown 621753a1a87SJed Brownallcleanhtml: 6229e423941SBarry Smith -${OMAKE_SELF} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} tree 623753a1a87SJed Brown 624*4c512586SBarry Smith# ********* Rules for checking code coverage ********************************************************************************************* 625753a1a87SJed Brown 626753a1a87SJed Browngcov: 62741baa1e4SJacob Faibussowitsch output_file_base_name=${PETSC_ARCH}-gcovr-report.json; \ 62820c90202SJacob Faibussowitsch petsc_arch_dir=${PETSC_DIR}/${PETSC_ARCH}; \ 629ccfcae5eSJacob Faibussowitsch tar_file=$${petsc_arch_dir}/$${output_file_base_name}.tar.bz2; \ 630ccfcae5eSJacob Faibussowitsch cd $${petsc_arch_dir}/obj && \ 631ccfcae5eSJacob 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} && \ 632ccfcae5eSJacob Faibussowitsch ${RM} -f $${tar_file} && \ 633ccfcae5eSJacob Faibussowitsch tar --bzip2 -cf $${tar_file} -C $${petsc_arch_dir} ./$${output_file_base_name} && \ 634ccfcae5eSJacob Faibussowitsch ${RM} $${petsc_arch_dir}/$${output_file_base_name} 635753a1a87SJed Brown 636753a1a87SJed Brownmergegcov: 6377ce81a4bSJacob 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} 638b0e5478fSScott Kruger 639*4c512586SBarry Smith#********* Rules for make clangformat and checking violation of coding standards ************************************************************** 640*4c512586SBarry Smith 641*4c512586SBarry Smith# Format all the source code in the given directory and down according to the file .clang_format 642*4c512586SBarry Smithclangformat: 643*4c512586SBarry Smith -@git --no-pager ls-files -z ${GITCFSRC} | xargs -0 -P $(MAKE_NP) -L 10 clang-format -i 644*4c512586SBarry Smith 645*4c512586SBarry SmithGITSRC = '*.[chF]' '*.F90' '*.hpp' '*.cpp' '*.cxx' '*.cu' ${GITSRCEXCL} 646*4c512586SBarry SmithGITSRCEXCL = \ 647*4c512586SBarry Smith':!*khash/*' \ 648*4c512586SBarry Smith':!*valgrind/*' \ 649*4c512586SBarry Smith':!*yaml/*' \ 650*4c512586SBarry Smith':!*perfstubs/*' 651*4c512586SBarry SmithGITCFSRC = '*.[ch]' '*.hpp' '*.cpp' '*.cxx' '*.cu' ${GITSRCEXCL} ${GITCFSRCEXCL} 652*4c512586SBarry SmithGITCFSRCEXCL = \ 653*4c512586SBarry Smith':!*petscversion.h' \ 654*4c512586SBarry Smith':!*mpif.h' \ 655*4c512586SBarry Smith':!*mpiunifdef.h' \ 656*4c512586SBarry Smith':!*finclude/*' \ 657*4c512586SBarry Smith':!systems/*' \ 658*4c512586SBarry Smith':!*benchmarks/*' \ 659*4c512586SBarry Smith':!*binding/*' \ 660*4c512586SBarry Smith':!*-custom/*' \ 661*4c512586SBarry Smith':!*f90-mod/*' 662*4c512586SBarry Smith 663*4c512586SBarry SmithcheckbadSource: 664*4c512586SBarry Smith @git --no-pager grep -n -P 'self\.gitcommit' -- config/BuildSystem/config/packages | grep 'origin/' ; if [[ "$$?" == "0" ]]; then echo "Error: Do not use a branch name in a configure package file"; false; fi 665*4c512586SBarry Smith -@${RM} -f checkbadSource.out 666*4c512586SBarry Smith -@echo "------Double blank lines in file -----------------------------------" > checkbadSource.out 667*4c512586SBarry Smith -@git --no-pager grep -n -P '^$$' -- ${GITSRC} > doublelinecheck.out 668*4c512586SBarry Smith -@${PYTHON} ${PETSC_DIR}/lib/petsc/bin/maint/doublelinecheck.py doublelinecheck.out >> checkbadSource.out 669*4c512586SBarry Smith -@${RM} -f doublelinecheck.out 670*4c512586SBarry Smith -@echo "------Tabs in file -------------------------------------------------" >> checkbadSource.out 671*4c512586SBarry Smith -@git --no-pager grep -n -P '\t' -- ${GITSRC} >> checkbadSource.out;true 672*4c512586SBarry Smith -@echo "------White space at end of line -----------------------------------" >> checkbadSource.out 673*4c512586SBarry Smith -@git --no-pager grep -n -P ' $$' -- ${GITSRC} >> checkbadSource.out;true 674*4c512586SBarry Smith -@echo "------Two ;; -------------------------------------------------------" >> checkbadSource.out 675*4c512586SBarry Smith -@git --no-pager grep -n -P -e ';;' -- ${GITSRC} | grep -v ' for (' >> checkbadSource.out;true 676*4c512586SBarry Smith -@echo "------PetscCall for an MPI error code ------------------------------" >> checkbadSource.out 677*4c512586SBarry Smith -@git --no-pager grep -n -P -e '= MPI[U]*_\w*\(.*PetscCall' -- ${GITSRC} | grep -v MPIU_File >> checkbadSource.out;true 678*4c512586SBarry Smith -@echo "------Missing if (ierr) return ierr; -------------------------------" >> checkbadSource.out 679*4c512586SBarry Smith -@git --no-pager grep -n -P -e 'ierr = PetscInitialize\(' -- '*.[ch]' '*.cpp' '*.cxx' '*.cu' | grep -v 'if (ierr) return ierr;' | grep -E "(test|tutorial)" >> checkbadSource.out;true 680*4c512586SBarry Smith -@echo "------DOS file (with DOS newlines) ---------------------------------" >> checkbadSource.out 681*4c512586SBarry Smith -@git --no-pager grep -n -P '\r' -- ${GITSRC} >> checkbadSource.out;true 682*4c512586SBarry Smith -@echo "------{ before SETERRQ ---------------------------------------------" >> checkbadSource.out 683*4c512586SBarry Smith -@git --no-pager grep -n -P '{SETERRQ' -- ${GITSRC} >> checkbadSource.out;true 684*4c512586SBarry Smith -@echo "------PetscCall following SETERRQ ----------------------------------" >> checkbadSource.out 685*4c512586SBarry Smith -@git --no-pager grep -n -P 'SETERRQ' -- ${GITSRC} | grep ";PetscCall" >> checkbadSource.out;true 686*4c512586SBarry Smith -@echo "------SETERRQ() without defined error code -------------------------" >> checkbadSource.out 687*4c512586SBarry Smith -@git --no-pager grep -n -P 'SETERRQ\((?!\))' -- ${GITSRC} | grep -v PETSC_ERR | grep " if " | grep -v "__VA_ARGS__" | grep -v flow.c >> checkbadSource.out;true 688*4c512586SBarry Smith -@echo "------SETERRQ() with trailing newline ------------------------------" >> checkbadSource.out 689*4c512586SBarry Smith -@git --no-pager grep -n -P "SETERRQ[1-9]?.*\\\n\"" -- ${GITSRC} >> checkbadSource.out;true 690*4c512586SBarry Smith -@echo "------Define keyword used in test definition -----------------------" >> checkbadSource.out 691*4c512586SBarry Smith -@git --no-pager grep -n -P -e 'requires:.*define\(' -- ${GITSRC} >> checkbadSource.out;true 692*4c512586SBarry Smith -@echo "------No new line at end of file -----------------------------------" >> checkbadSource.out 693*4c512586SBarry Smith -@git --no-pager grep -n -P '[^\n]\z' -- ${GITSRC} >> checkbadSource.out;true 694*4c512586SBarry Smith -@echo "------Using if (condition) SETERRQ(...) instead of PetscCheck() ----" >> checkbadSource.out 695*4c512586SBarry Smith -@git --no-pager grep -n -P ' if +(.*) *SETERRQ' -- ${GITSRC} | grep -v 'PetscUnlikelyDebug' | grep -v 'petscerror.h' >> checkbadSource.out;true 696*4c512586SBarry Smith -@echo "------Using if (PetscUnlikelyDebug(condition)) SETERRQ(...) instead of PetscAssert()" >> checkbadSource.out 697*4c512586SBarry Smith -@git --no-pager grep -n -P -E ' if +\(PetscUnlikelyDebug.*\) *SETERRQ' -- ${GITSRC} | grep -v petscerror.h >> checkbadSource.out;true 698*4c512586SBarry Smith -@echo "------Using PetscFunctionReturn(ierr) ------------------------------" >> checkbadSource.out 699*4c512586SBarry Smith -@git --no-pager grep -n -P 'PetscFunctionReturn(ierr)' -- ${GITSRC} >> checkbadSource.out;true 700*4c512586SBarry Smith -@echo "------Defining a returning macro without PetscMacroReturns() -------" >> checkbadSource.out 701*4c512586SBarry Smith -@git --no-pager grep -n -P 'define .*\w+;\s+do' -- ${GITSRC} | grep -E -v '(PetscMacroReturns|PetscDrawCollectiveBegin|MatPreallocateBegin|PetscOptionsBegin|PetscObjectOptionsBegin|PetscOptionsHeadEnd)' >> checkbadSource.out;true 702*4c512586SBarry Smith -@echo "------Defining an error checking macro using CHKERR style ----------" >> checkbadSource.out 703*4c512586SBarry Smith -@git --no-pager grep -n -P 'define\s+CHKERR\w*\(.*\)\s*do\s+{' -- ${GITSRC} >> checkbadSource.out;true 704*4c512586SBarry Smith @a=`cat checkbadSource.out | wc -l`; l=`expr $$a - 18` ;\ 705*4c512586SBarry Smith if [ $$l -gt 0 ] ; then \ 706*4c512586SBarry Smith echo $$l " files with errors detected in source code formatting" ;\ 707*4c512586SBarry Smith cat checkbadSource.out ;\ 708*4c512586SBarry Smith else \ 709*4c512586SBarry Smith ${RM} -f checkbadSource.out;\ 710*4c512586SBarry Smith fi;\ 711*4c512586SBarry Smith test ! $$l -gt 0 712*4c512586SBarry Smith -@git --no-pager grep -P -n "[\x00-\x08\x0E-\x1F\x80-\xFF]" -- ${GITSRC} > badSourceChar.out;true 713*4c512586SBarry Smith -@w=`cat badSourceChar.out | wc -l`;\ 714*4c512586SBarry Smith if [ $$w -gt 0 ] ; then \ 715*4c512586SBarry Smith echo "Source files with non-ASCII characters ----------------" ;\ 716*4c512586SBarry Smith cat badSourceChar.out ;\ 717*4c512586SBarry Smith else \ 718*4c512586SBarry Smith ${RM} -f badSourceChar.out;\ 719*4c512586SBarry Smith fi 720*4c512586SBarry Smith @test ! -s badSourceChar.out 721*4c512586SBarry Smith 722*4c512586SBarry SmithcheckbadFileChange: 723*4c512586SBarry Smith @git diff --stat --exit-code `lib/petsc/bin/maint/check-merge-branch.sh`..HEAD -- src/sys/yaml/src src/sys/yaml/include src/sys/yaml/License include/petsc/private/valgrind include/petsc/private/kash 724*4c512586SBarry Smith 725*4c512586SBarry Smithvermin: 726*4c512586SBarry Smith @vermin -vvv -t=3.4- ${VERMIN_OPTIONS} ${PETSC_DIR}/config 727*4c512586SBarry Smith 728*4c512586SBarry Smithlint: 729*4c512586SBarry Smith ${PYTHON} ${PETSC_DIR}/lib/petsc/bin/maint/petsclinter --verbose=${V} --apply-patches=${REPLACE} $(LINTER_OPTIONS) 730*4c512586SBarry Smith 731*4c512586SBarry Smithhelp-lint: 732*4c512586SBarry Smith @${PYTHON} ${PETSC_DIR}/lib/petsc/bin/maint/petsclinter --help 733*4c512586SBarry Smith -@echo "Basic usage:" 734*4c512586SBarry Smith -@echo " make lint <options>" 735*4c512586SBarry Smith -@echo " make test-lint <options> <test only options>" 736*4c512586SBarry Smith -@echo 737*4c512586SBarry Smith -@echo "Options:" 738*4c512586SBarry Smith -@echo " V=[1,0] Enable or disable verbose output" 739*4c512586SBarry Smith -@echo " LINTER_OPTIONS=\"--opt1 --opt2 ...\" See above for available options" 740*4c512586SBarry Smith -@echo 741*4c512586SBarry Smith -@echo "Test Only Options:" 742*4c512586SBarry Smith -@echo " REPLACE=[1,0] Enable or disable replacing test output" 743*4c512586SBarry Smith -@echo 744*4c512586SBarry Smith 745*4c512586SBarry Smithtest-lint: 746*4c512586SBarry Smith ${PYTHON} ${PETSC_DIR}/lib/petsc/bin/maint/petsclinter ${PETSC_DIR}/src/sys/tests/linter --test -j0 --werror --replace=${REPLACE} --verbose=${V} $(LINTER_OPTIONS) 747*4c512586SBarry Smith 748753a1a87SJed Browncountfortranfunctions: 749f53b81b6SPierre Jolivet -@cd ${PETSC_DIR}/src/fortran; grep -E '^void' custom/*.c auto/*.c | \ 750f53b81b6SPierre Jolivet cut -d'(' -f1 | tr -s ' ' | cut -d' ' -f2 | uniq | grep -E -v "(^$$|Petsc)" | \ 751753a1a87SJed Brown sed "s/_$$//" | sort > /tmp/countfortranfunctions 752753a1a87SJed Brown 753753a1a87SJed Browncountcfunctions: 754068711b4SBarry Smith -@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h | grep "(" | tr -s ' ' | \ 755753a1a87SJed Brown cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' | \ 756068711b4SBarry Smith tr 'A-Z' 'a-z' | sort | uniq > /tmp/countcfunctions 757753a1a87SJed Brown 758753a1a87SJed Browndifffortranfunctions: countfortranfunctions countcfunctions 759753a1a87SJed Brown -@echo -------------- Functions missing in the fortran interface --------------------- 760753a1a87SJed Brown -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 761753a1a87SJed Brown -@echo ----------------- Functions missing in the C interface ------------------------ 762753a1a87SJed Brown -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 763753a1a87SJed Brown -@${RM} /tmp/countcfunctions /tmp/countfortranfunctions 764753a1a87SJed Brown 765753a1a87SJed Browncheckbadfortranstubs: 766753a1a87SJed Brown -@echo "=========================================" 767753a1a87SJed Brown -@echo "Functions with MPI_Comm as an Argument" 768753a1a87SJed Brown -@echo "=========================================" 769753a1a87SJed Brown -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \ 770753a1a87SJed Brown tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 771753a1a87SJed Brown -@echo "=========================================" 772753a1a87SJed Brown -@echo "Functions with a String as an Argument" 773753a1a87SJed Brown -@echo "=========================================" 774753a1a87SJed Brown -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \ 775753a1a87SJed Brown tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 776753a1a87SJed Brown -@echo "=========================================" 777753a1a87SJed Brown -@echo "Functions with Pointers to PETSc Objects as Argument" 778753a1a87SJed Brown -@echo "=========================================" 779753a1a87SJed Brown -@cd ${PETSC_DIR}/src/fortran/auto; \ 780753a1a87SJed Brown _p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \ 781753a1a87SJed Brown cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \ 782753a1a87SJed Brown sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ 783753a1a87SJed Brown for OBJ in $$_p_OBJ; do \ 784753a1a87SJed Brown grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \ 785753a1a87SJed Brown cut -d'(' -f1 | cut -d' ' -f1,3; \ 786753a1a87SJed Brown done 787a3269974SBarry Smith 788a3269974SBarry Smithcheckpackagetests: 789a3269974SBarry Smith -@echo "Missing package tests" 790f53b81b6SPierre 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 791a3269974SBarry Smith -@echo "Missing download package tests" 792f53b81b6SPierre 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 793a3269974SBarry Smith 794*4c512586SBarry Smithcheck_petsc4py_rst: 795*4c512586SBarry Smith @${RM} -f petsc4py_rst.log 796*4c512586SBarry Smith @echo "Checking src/binding/petsc4py/DESCRIPTION.rst" 797*4c512586SBarry Smith @rst2html src/binding/petsc4py/DESCRIPTION.rst > /dev/null 2> petsc4py_rst.log 798*4c512586SBarry Smith @if test -s petsc4py_rst.log; then cat petsc4py_rst.log; exit 1; fi 799*4c512586SBarry Smith 800*4c512586SBarry Smith# TODO: checkTestCoverage: that makes sure every tutorial test has at least one test listed in the file, perhaps handled by gmakegentest.py 801*4c512586SBarry Smith# TODO: check for PetscBeginFunctionUser in non-example source 802*4c512586SBarry Smith# TODO: check for __ at start of #define or symbol 803*4c512586SBarry Smith# TODO: checking for missing manual pages 804*4c512586SBarry Smith# TODO: check for incorrect %d 805*4c512586SBarry Smith# TODO: check for double blank lines 806*4c512586SBarry Smith# TODO: check for ill-formed manual pages 807*4c512586SBarry Smith# TODO: check for { on line after for 808*4c512586SBarry Smith# TODO: check for } then else on following line 809*4c512586SBarry Smith# TODO: check for } else { with SETERRQ on following line or if () { with SETERRQ on following line 810*4c512586SBarry Smith 811*4c512586SBarry Smith# Lists all the URLs in the PETSc repository that are unaccessible, nonexistent, or permanently moved (301) 812*4c512586SBarry Smith# REPLACE=1 locations marked as permanently moved (301) are replaced in the repository 813*4c512586SBarry Smith# This code is fragile; always check the changes after a use of REPLACE=1 before committing the changes 814*4c512586SBarry Smith# 815*4c512586SBarry Smith# Notes: 816*4c512586SBarry Smith# The first tr in the line is split lines for the cases where multiple URLs are in the same line 817*4c512586SBarry Smith# The first sed handles the case (http[s]*://xxx) 818*4c512586SBarry Smith# The list is sorted by length so that if REPLACE is used the longer apply before the shorter 819*4c512586SBarry Smith# The code recursively follows the permanently moved (301) redirections until it reaches the final URL 820*4c512586SBarry Smith# For DropBox we need to check the validity of the new URL but do not want to return to user the internal "raw" URL 821*4c512586SBarry SmithcheckbadURLS: 822*4c512586SBarry Smith -@x=`git grep "http[s]*://" -- '*.[chF]' '*.html' '*.cpp' '*.cxx' '*.cu' '*.F90' '*.py' '*.tex' | grep -E -v "(config/packages|HandsOnExercises)" | tr '[[:blank:]]' '\n' | grep 'http[s]*://' | sed 's!.*(\(http[s]*://[-a-zA-Z0-9_./()?=&+%~]*\))!\1!g' | sed 's!.*\(http[s]*://[-a-zA-Z0-9_./()?=&+%~]*\).*!\1!g' | sed 's/\.$$//g' | sort | uniq| awk '{ print length, $$0 }' | sort -r -n -s | cut -d" " -f2` ; \ 823*4c512586SBarry Smith for i in $$x; do \ 824*4c512586SBarry Smith url=$$i; \ 825*4c512586SBarry Smith msg=''; \ 826*4c512586SBarry Smith while [[ "$${msg}D" == "D" ]] ; do \ 827*4c512586SBarry Smith y1=`curl --connect-timeout 5 --head --silent $${url} | head -n 1`; \ 828*4c512586SBarry Smith y2=`echo $${y1} | grep ' 4[0-9]* '`; \ 829*4c512586SBarry Smith y3=`echo $${y1} | grep ' 301 '`; \ 830*4c512586SBarry Smith if [[ "$${y1}D" == "D" ]] ; then \ 831*4c512586SBarry Smith msg="Unable to reach site" ; \ 832*4c512586SBarry Smith elif [[ "$${y2}D" != "D" ]] ; then \ 833*4c512586SBarry Smith msg=$${y1} ; \ 834*4c512586SBarry Smith elif [[ "$${y3}D" != "D" ]] ; then \ 835*4c512586SBarry Smith l=`curl --connect-timeout 5 --head --silent $${url} | grep ocation | sed 's/.*ocation:[[:blank:]]\(.*\)/\1/g' | tr -d '\r'` ; \ 836*4c512586SBarry Smith w=`echo $$l | grep 'http'` ; \ 837*4c512586SBarry Smith if [[ "$${w}D" != "D" ]] ; then \ 838*4c512586SBarry Smith url=$$l ; \ 839*4c512586SBarry Smith else \ 840*4c512586SBarry Smith ws=`echo $${url} | sed 's!\(http[s]*://[-a-zA-Z0-9_.]*\)/.*!\1!g'` ; \ 841*4c512586SBarry Smith dp=`echo $${ws}$${l} | grep "dropbox.com/s/raw"` ; \ 842*4c512586SBarry Smith if [[ "$${dp}D" != "D" ]] ; then \ 843*4c512586SBarry Smith b=`curl --connect-timeout 5 --head --silent $${ws}$$l | head -n 1` ; \ 844*4c512586SBarry Smith c=`echo $${b} | grep -E "( 2[0-9]* | 302 )"` ; \ 845*4c512586SBarry Smith if [[ "$${c}D" == "D" ]] ; then \ 846*4c512586SBarry Smith msg=`echo "dropbox file doesn't exist" $${c}` ; \ 847*4c512586SBarry Smith else \ 848*4c512586SBarry Smith break ; \ 849*4c512586SBarry Smith fi; \ 850*4c512586SBarry Smith else \ 851*4c512586SBarry Smith url="$${ws}$$l" ; \ 852*4c512586SBarry Smith fi; \ 853*4c512586SBarry Smith fi; \ 854*4c512586SBarry Smith else \ 855*4c512586SBarry Smith break; \ 856*4c512586SBarry Smith fi; \ 857*4c512586SBarry Smith done;\ 858*4c512586SBarry Smith if [[ "$${msg}D" == "D" && "$${url}" != "$$i" ]] ; then \ 859*4c512586SBarry Smith echo "URL" $$i "has moved to valid final location:" $${url} ; \ 860*4c512586SBarry Smith if [[ "$${REPLACE}D" != "D" ]] ; then \ 861*4c512586SBarry Smith git psed $$i $$l ;\ 862*4c512586SBarry Smith fi; \ 863*4c512586SBarry Smith elif [[ "$${msg}D" != "D" && "$${url}" != "$$i" ]] ; then \ 864*4c512586SBarry Smith echo "ERROR: URL" $$i "has moved to invalid final location:" $${url} $${msg} ; \ 865*4c512586SBarry Smith elif [[ "$${msg}D" != "D" ]] ; then \ 866*4c512586SBarry Smith echo "ERROR: URL" $$i "invalid:" $${msg} ; \ 867*4c512586SBarry Smith fi; \ 868*4c512586SBarry Smith done 869*4c512586SBarry Smith 870*4c512586SBarry SmithcheckbadSpelling: 871*4c512586SBarry Smith -@x=`python3 ../bin/extract.py | aspell list | sort -u` ; 872*4c512586SBarry Smith 873*4c512586SBarry Smithupdatedatafiles: 874*4c512586SBarry Smith -@if [ -d "${HOME}/datafiles" ]; then \ 875*4c512586SBarry Smith echo " ** Updating datafiles at ${HOME}/datafiles **"; \ 876*4c512586SBarry Smith cd "${HOME}/datafiles" && git pull -q; fi 877*4c512586SBarry Smith 878dc0529c6SBarry Smith.PHONY: info info_h all deletelibs allclean update \ 879425fd74bSBarry Smith alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanpages \ 880425fd74bSBarry Smith allcleanhtml countfortranfunctions \ 881416ff897SSatish Balay start_configure configure_petsc configure_clean matlabbin install 882