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 7753a1a87SJed BrownLOCDIR = ./ 8fb3ce96aSSatish BalayDIRS = src include tutorials interfaces share/petsc/matlab 9753a1a87SJed BrownCFLAGS = 10753a1a87SJed BrownFFLAGS = 11d4f3a1abSSatish BalayCPPFLAGS = 12d4f3a1abSSatish BalayFPPFLAGS = 13753a1a87SJed Brown 14753a1a87SJed Brown# next line defines PETSC_DIR and PETSC_ARCH if they are not set 15af0996ceSBarry Smithinclude ././${PETSC_ARCH}/lib/petsc/conf/petscvariables 16af0996ceSBarry Smithinclude ${PETSC_DIR}/lib/petsc/conf/variables 17af0996ceSBarry Smithinclude ${PETSC_DIR}/lib/petsc/conf/rules 18e8666488SSatish Balayinclude ${PETSC_DIR}/lib/petsc/conf/test.common 19753a1a87SJed Brown 20fa2665b1SJed Brown# This makefile contains a lot of PHONY targets with improperly specified prerequisites 21fa2665b1SJed Brown# where correct execution instead depends on the targets being processed in the correct 22fa2665b1SJed Brown# order. This is gross, but this makefile doesn't really do any work. Sub-makes still 23fa2665b1SJed Brown# benefit from parallelism. 24fa2665b1SJed Brown.NOTPARALLEL: 25fa2665b1SJed Brown 260e03b746SBarry SmithOMAKE_SELF = $(OMAKE) -f makefile 270e03b746SBarry SmithOMAKE_SELF_PRINTDIR = $(OMAKE_PRINTDIR) -f makefile 280e03b746SBarry Smith 29753a1a87SJed Brown# 30753a1a87SJed Brown# Basic targets to build PETSc libraries. 31dc0529c6SBarry Smith# 32dd8585cdSJed Brownall: 330e03b746SBarry Smith +@${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} chk_petscdir chk_upgrade | tee ${PETSC_ARCH}/lib/petsc/conf/make.log 34af0996ceSBarry Smith @ln -sf ${PETSC_ARCH}/lib/petsc/conf/make.log make.log 350093410fSSatish 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 360093410fSSatish Balay +@if [ `cat ${PETSC_ARCH}/lib/petsc/conf/error.log` != 0 ]; then \ 370093410fSSatish Balay egrep '(out of memory allocating.*after a total of|gfortran: fatal error: Killed signal terminated program f951|f95: fatal error: Killed signal terminated program f951)' ${PETSC_ARCH}/lib/petsc/conf/make.log | tee ${PETSC_ARCH}/lib/petsc/conf/memoryerror.log > /dev/null; \ 380093410fSSatish Balay if test -s ${PETSC_ARCH}/lib/petsc/conf/memoryerror.log; then \ 3971488455SBarry Smith printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 4071488455SBarry 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; \ 4171488455SBarry Smith printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 420093410fSSatish Balay else \ 43af0996ceSBarry Smith printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 44af0996ceSBarry Smith echo " Error during compile, check ${PETSC_ARCH}/lib/petsc/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 45af0996ceSBarry 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;\ 46af0996ceSBarry Smith printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 470093410fSSatish Balay fi \ 48753a1a87SJed Brown else \ 490e03b746SBarry 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 ;\ 50753a1a87SJed Brown fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below 514dcdf380SSatish Balay @echo "Finishing make run at `date +'%a, %d %b %Y %H:%M:%S %z'`" >> ${PETSC_ARCH}/lib/petsc/conf/make.log 520093410fSSatish Balay @if [ `cat ${PETSC_ARCH}/lib/petsc/conf/error.log` != 0 ]; then exit 1; fi 53753a1a87SJed Brown 54504e95faSBarry Smithall-local: info libs matlabbin petsc4py-build libmesh-build mfem-build slepc-build hpddm-build amrex-build bamg-build 55fa2665b1SJed Brown 56753a1a87SJed Brown# 57753a1a87SJed Brown# Prints information about the system and version of PETSc being compiled 58753a1a87SJed Brown# 59dd8585cdSJed Browninfo: 60753a1a87SJed Brown -@echo "==========================================" 61753a1a87SJed Brown -@echo " " 62753a1a87SJed Brown -@echo "See documentation/faq.html and documentation/bugreporting.html" 63753a1a87SJed Brown -@echo "for help with installation problems. Please send EVERYTHING" 64bc10b077SJed Brown -@echo "printed out below when reporting problems. Please check the" 65bc10b077SJed Brown -@echo "mailing list archives and consider subscribing." 66753a1a87SJed Brown -@echo " " 67a17b96a8SKyle Gerard Felker -@echo " https://petsc.org/release/community/mailing/" 68753a1a87SJed Brown -@echo " " 69753a1a87SJed Brown -@echo "==========================================" 704dcdf380SSatish Balay -@echo Starting make run on `hostname` at `date +'%a, %d %b %Y %H:%M:%S %z'` 71753a1a87SJed Brown -@echo Machine characteristics: `uname -a` 72753a1a87SJed Brown -@echo "-----------------------------------------" 73753a1a87SJed Brown -@echo "Using PETSc directory: ${PETSC_DIR}" 74753a1a87SJed Brown -@echo "Using PETSc arch: ${PETSC_ARCH}" 75753a1a87SJed Brown -@echo "-----------------------------------------" 76753a1a87SJed Brown -@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//" 77753a1a87SJed Brown -@echo "-----------------------------------------" 78753a1a87SJed Brown -@echo "Using configure Options: ${CONFIGURE_OPTIONS}" 79753a1a87SJed Brown -@echo "Using configuration flags:" 807cab4194SSatish Balay -@grep "\#define " ${PETSCCONF_H} 81753a1a87SJed Brown -@echo "-----------------------------------------" 8236ad7b81SSatish Balay -@echo "Using C compile: ${PETSC_CCOMPILE_SINGLE}" 837c934407SBarry Smith -@if [ "${MPICC_SHOW}" != "" ]; then \ 84fd0cdb26SSatish Balay printf "mpicc -show: %b\n" "${MPICC_SHOW}";\ 857c934407SBarry Smith fi; \ 867c934407SBarry Smith printf "C compiler version: %b\n" "${C_VERSION}"; \ 8736ad7b81SSatish Balay if [ "${CXX}" != "" ]; then \ 8836ad7b81SSatish Balay echo "Using C++ compile: ${PETSC_CXXCOMPILE_SINGLE}";\ 897c934407SBarry Smith if [ "${MPICXX_SHOW}" != "" ]; then \ 90fd0cdb26SSatish Balay printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \ 917c934407SBarry Smith fi;\ 927c934407SBarry Smith printf "C++ compiler version: %b\n" "${Cxx_VERSION}"; \ 937c934407SBarry Smith fi 94753a1a87SJed Brown -@if [ "${FC}" != "" ]; then \ 9536ad7b81SSatish Balay echo "Using Fortran compile: ${PETSC_FCOMPILE_SINGLE}";\ 96607e78e0SSatish Balay if [ "${MPIFC_SHOW}" != "" ]; then \ 97fd0cdb26SSatish Balay printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \ 98607e78e0SSatish Balay fi; \ 997c934407SBarry Smith printf "Fortran compiler version: %b\n" "${FC_VERSION}"; \ 100da0b7683SSatish Balay fi 101da0b7683SSatish Balay -@if [ "${CUDAC}" != "" ]; then \ 10236ad7b81SSatish Balay echo "Using CUDA compile: ${PETSC_CUCOMPILE_SINGLE}";\ 103753a1a87SJed Brown fi 104cab5ea25SPierre Jolivet -@if [ "${CLANGUAGE}" = "CXX" ]; then \ 105f5718a65SBarry Smith echo "Using C++ compiler to compile PETSc";\ 106f5718a65SBarry Smith fi 107753a1a87SJed Brown -@echo "-----------------------------------------" 108753a1a87SJed Brown -@echo "Using C/C++ linker: ${PCC_LINKER}" 109753a1a87SJed Brown -@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}" 110753a1a87SJed Brown -@if [ "${FC}" != "" ]; then \ 111753a1a87SJed Brown echo "Using Fortran linker: ${FC_LINKER}";\ 112753a1a87SJed Brown echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\ 113753a1a87SJed Brown fi 114753a1a87SJed Brown -@echo "-----------------------------------------" 1151d2d58a3SSatish Balay -@echo "Using system modules: ${LOADEDMODULES}" 116d1f8d238SSatish Balay -@if [ "${MPI_IS_MPIUNI}" = "1" ]; then \ 117d1f8d238SSatish Balay echo Using mpi.h: mpiuni; \ 118d1f8d238SSatish Balay else \ 119d1f8d238SSatish Balay TESTDIR=`mktemp -q -d -t petscmpi-XXXXXXXX` && \ 12042a47be2SSatish Balay echo '#include <mpi.h>' > $${TESTDIR}/mpitest.c && \ 121f5718a65SBarry Smith BUF=`${CPP} ${PETSC_CPPFLAGS} ${PETSC_CC_INCLUDES} $${TESTDIR}/mpitest.c |grep 'mpi\.h' | ( head -1 ; cat > /dev/null )` && \ 122d1f8d238SSatish Balay echo Using mpi.h: $${BUF}; ${RM} -rf $${TESTDIR}; \ 123d1f8d238SSatish Balay fi 1241d2d58a3SSatish Balay -@echo "-----------------------------------------" 125753a1a87SJed Brown -@echo "Using libraries: ${PETSC_LIB}" 126753a1a87SJed Brown -@echo "------------------------------------------" 127753a1a87SJed Brown -@echo "Using mpiexec: ${MPIEXEC}" 1284e2e1449SJed Brown -@echo "------------------------------------------" 1295b4fc442SVaclav Hapla -@echo "Using MAKE: $(MAKE)" 130d7e70f41SSatish Balay -@echo "Using MAKEFLAGS: -j$(MAKE_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)" 131753a1a87SJed Brown -@echo "==========================================" 132753a1a87SJed Brown 133753a1a87SJed Brown# 134d2b3add8SSatish Balay# Build MatLab binaries 135d2b3add8SSatish Balay# 136d2b3add8SSatish Balaymatlabbin: 1374242cbabSBarry Smith -@if [ "${MATLAB_MEX}" != "" -a "${MATLAB_SOCKET}" != "" -a "${PETSC_SCALAR}" = "real" -a "${PETSC_PRECISION}" = "double" ]; then \ 138d2b3add8SSatish Balay echo "BEGINNING TO COMPILE MATLAB INTERFACE"; \ 139d2b3add8SSatish Balay if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc; fi; \ 140d2b3add8SSatish Balay if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab; fi; \ 1410e03b746SBarry Smith cd src/sys/classes/viewer/impls/socket/matlab && ${OMAKE_SELF} matlabcodes PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR}; \ 142d2b3add8SSatish Balay echo "========================================="; \ 143d2b3add8SSatish Balay fi 144753a1a87SJed Brown# 1450e03b746SBarry Smith# Builds PETSc check examples for a given architecture 146753a1a87SJed Brown# 1470e03b746SBarry Smithcheck_install: check 1480e03b746SBarry Smithcheck: 14950679f08SSatish Balay -+@${OMAKE_SELF} PETSC_OPTIONS="${PETSC_OPTIONS} ${PETSC_TEST_OPTIONS}" PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} check_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/check.log 1500e03b746SBarry Smithcheckx: 1510e03b746SBarry Smith -@${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} checkx_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/checkx.log 1520e03b746SBarry Smithcheck_build: 1530e03b746SBarry Smith -@echo "Running check examples to verify correct installation" 154753a1a87SJed Brown -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 1550e03b746SBarry Smith +@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy 1560e03b746SBarry Smith +@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex19 157de5e753aSSatish Balay +@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ] && [ "${PETSC_SCALAR}" = "real" ]; then \ 158de5e753aSSatish Balay if [ "${CUDA_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_cuda; \ 159de5e753aSSatish Balay elif [ "${HIP_LIB}" != "" ]; then HYPRE_TEST=runex19_hypre_hip; \ 160de5e753aSSatish Balay else HYPRE_TEST=runex19_hypre; \ 161de5e753aSSatish Balay fi; \ 162de5e753aSSatish Balay cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff $${HYPRE_TEST}; \ 163e5d08945SBarry Smith fi; 1642f225959SSatish Balay +@if [ "${CUDA_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 165e57d7714SBarry Smith cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_cuda; \ 166e57d7714SBarry Smith fi; 167042217e8SBarry Smith +@if [ "${KOKKOS_KERNELS_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ] && [ "${PETSC_SCALAR}" = "real" ] && [ "${PETSC_PRECISION}" = "double" ] && [ "${MPI_IS_MPIUNI}" = "" ]; then \ 168ef9bfa9fSSatish Balay cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex3k_kokkos; \ 169c0558f20SBarry Smith fi; 17045ee4180SJed Brown +@if [ "${MUMPS_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 1710e03b746SBarry Smith cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_fieldsplit_mumps; \ 172e5d08945SBarry Smith fi; 17345ee4180SJed Brown +@if [ "${SUPERLU_DIST_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 1740e03b746SBarry Smith cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_superlu_dist; \ 175e5d08945SBarry Smith fi; 176bacf6b6cSBarry Smith +@if [ "${HDF5_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 17748c5f195SStefano Zampini cd src/vec/vec/tests >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex47; \ 178bacf6b6cSBarry Smith fi; 1794e4a1d08SBarry Smith +@if [ "${AMREX_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 1804e4a1d08SBarry Smith echo "Running testamres examples to verify correct installation";\ 1814e4a1d08SBarry Smith echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}";\ 1820e03b746SBarry Smith cd src/ksp/ksp/tutorials/amrex >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy;\ 1830e03b746SBarry Smith ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testamrex;\ 1844e4a1d08SBarry Smith fi; 18545ee4180SJed Brown +@if ( [ "${ML_LIB}" != "" ] || [ "${TRILINOS_LIB}" != "" ] ) && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 1860e03b746SBarry Smith cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_ml; \ 187e5d08945SBarry Smith fi; 1888888e2d2SStefano Zampini +@if [ "${SUITESPARSE_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 1890e03b746SBarry Smith cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_suitesparse; \ 1908888e2d2SStefano Zampini fi; 1910e03b746SBarry Smith +@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex19.rm 192b6efb0a5SBarry Smith +@if [ "${MPI4PY}" = "yes" ]; then \ 193b6efb0a5SBarry Smith cd src/sys/tests >/dev/null; \ 194b6efb0a5SBarry Smith ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex55; \ 195b6efb0a5SBarry Smith fi; 19645ee4180SJed Brown +@if [ "${PETSC4PY}" = "yes" ]; then \ 197c4762a1bSJed Brown cd src/ksp/ksp/tutorials >/dev/null; \ 1980e03b746SBarry Smith ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy; \ 1990e03b746SBarry Smith ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex100; \ 2000e03b746SBarry Smith ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy; \ 2015061939cSBarry Smith fi; 20245ee4180SJed Brown +@egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 203cb297985SSatish Balay if test -s .ftn.log; then \ 2040e03b746SBarry Smith cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex5f; \ 205cb297985SSatish Balay fi; ${RM} .ftn.log; 20669cdbcb9SBarry Smith +@egrep "^#define PETSC_HAVE_MATLAB_ENGINE 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 20769cdbcb9SBarry Smith if test -s .ftn.log; then \ 20869cdbcb9SBarry Smith cd src/vec/vec/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex31; \ 20969cdbcb9SBarry Smith fi; ${RM} .ftn.log; 2100e03b746SBarry Smith +@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy 211753a1a87SJed Brown -@echo "Completed test examples" 2120e03b746SBarry Smithcheckx_build: 2130e03b746SBarry Smith -@echo "Running graphics check example to verify correct X11 installation" 214753a1a87SJed Brown -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 2150e03b746SBarry Smith @cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy 2160e03b746SBarry Smith @cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testxex19 2170e03b746SBarry Smith @cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy 2180e03b746SBarry Smith -@echo "Completed graphics check example" 2190e03b746SBarry Smithcheck_usermakefile: 220b752486dSSatish Balay -@echo "Testing compile with user makefile" 221b752486dSSatish Balay -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 222c4762a1bSJed Brown @cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex19 223b752486dSSatish Balay @egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 224b752486dSSatish Balay if test -s .ftn.log; then \ 225c4762a1bSJed Brown cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex5f; \ 226b752486dSSatish Balay fi; ${RM} .ftn.log; 2270e03b746SBarry Smith @cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean-legacy 228b752486dSSatish Balay -@echo "Completed compile with user makefile" 229753a1a87SJed Brown 2303d33ad60SJunchao Zhang# Compare ABI/API of two versions of PETSc library with the old one defined by PETSC_{DIR,ARCH}_ABI_OLD 2313d33ad60SJunchao Zhangabitest: 232cab5ea25SPierre Jolivet @if [ "${PETSC_DIR_ABI_OLD}" = "" ] || [ "${PETSC_ARCH_ABI_OLD}" = "" ]; \ 2333d33ad60SJunchao Zhang then printf "You must set environment variables PETSC_DIR_ABI_OLD and PETSC_ARCH_ABI_OLD to run abitest\n"; \ 2343d33ad60SJunchao Zhang exit 1; \ 2353d33ad60SJunchao Zhang fi; 2363d33ad60SJunchao Zhang -@echo "Comparing ABI/API of the following two PETSc versions (you must have already configured and built them using GCC and with -g):" 2373d33ad60SJunchao Zhang -@echo "=========================================================================================" 2383d33ad60SJunchao Zhang -@echo " Old: PETSC_DIR_ABI_OLD = ${PETSC_DIR_ABI_OLD}" 2393d33ad60SJunchao Zhang -@echo " PETSC_ARCH_ABI_OLD = ${PETSC_ARCH_ABI_OLD}" 2407b444a09SBarry Smith -@pushd ${PETSC_DIR_ABI_OLD} >> /dev/null ; echo " Branch = "`git rev-parse --abbrev-ref HEAD` 2413d33ad60SJunchao Zhang -@echo " New: PETSC_DIR = ${PETSC_DIR}" 2423d33ad60SJunchao Zhang -@echo " PETSC_ARCH = ${PETSC_ARCH}" 2437b444a09SBarry Smith -@echo " Branch = "`git rev-parse --abbrev-ref HEAD` 2443d33ad60SJunchao Zhang -@echo "=========================================================================================" 245454c5dfcSJunchao 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 2463d33ad60SJunchao Zhang 2477b444a09SBarry Smith# Compare ABI/API of current PETSC_ARCH/PETSC_DIR with a previous branch 2487b444a09SBarry Smithabitestcomplete: 2497b444a09SBarry Smith -@if [[ -f "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log" ]]; then \ 2507b444a09SBarry 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"` ;\ 2517b444a09SBarry Smithecho $${OPTIONS} ;\ 2527b444a09SBarry Smith fi ; \ 2537b444a09SBarry Smith if [[ "${PETSC_DIR_ABI_OLD}" != "" ]]; then \ 2547b444a09SBarry Smith PETSC_DIR_OLD=${PETSC_DIR_ABI_OLD}; \ 2557b444a09SBarry Smith else \ 2567b444a09SBarry Smith PETSC_DIR_OLD=${PETSC_DIR}/../petsc-abi; \ 2577b444a09SBarry Smith fi ; \ 2587b444a09SBarry Smith echo "=================================================================================================" ;\ 2597b444a09SBarry Smith echo "Doing ABI/API comparison between" ${branch} " and " `git rev-parse --abbrev-ref HEAD` "using " $${OPTIONS} ;\ 2607b444a09SBarry Smith echo "=================================================================================================" ;\ 2617b444a09SBarry Smith if [[ ! -d $${PETSC_DIR_OLD} ]]; then \ 2627b444a09SBarry Smith git clone ${PETSC_DIR} $${PETSC_DIR_OLD} ; \ 2637b444a09SBarry Smith else \ 2647b444a09SBarry Smith cd $${PETSC_DIR_OLD} ; \ 2657b444a09SBarry Smith git pull ; \ 2667b444a09SBarry Smith fi ; \ 2677b444a09SBarry Smith cd $${PETSC_DIR_OLD} ; \ 2687b444a09SBarry Smith git checkout ${branch} ; \ 2697b444a09SBarry Smith PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` ./configure $${OPTIONS} ; \ 2707b444a09SBarry Smith PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` make all test ; \ 2717b444a09SBarry Smith cd ${PETSC_DIR} ; \ 2727b444a09SBarry Smith ./configure $${OPTIONS}; \ 2737b444a09SBarry Smith make all test ; \ 2747b444a09SBarry Smith PETSC_DIR_ABI_OLD=$${PETSC_DIR_OLD} PETSC_ARCH_ABI_OLD=arch-branch-`git rev-parse ${branch}` make abitest 2757b444a09SBarry Smith 276753a1a87SJed Brown# Deletes PETSc libraries 277dd8585cdSJed Browndeletelibs: 278753a1a87SJed Brown -${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.* 279dd8585cdSJed Browndeletemods: 280753a1a87SJed Brown -${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod 281753a1a87SJed Brown 28258080eacSSatish Balayallclean: 283dc0529c6SBarry Smith -@${OMAKE} -f gmakefile clean 28459d63732SSatish Balay 28559d63732SSatish Balayclean:: allclean 28659d63732SSatish Balay 28759d63732SSatish Balaydistclean: chk_petscdir 288af0996ceSBarry Smith @if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then \ 289af0996ceSBarry Smith echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***"; \ 290af0996ceSBarry Smith mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/; fi 29159d63732SSatish Balay @echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***" 29259d63732SSatish Balay -${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/ 29359d63732SSatish Balay 29459d63732SSatish Balay 295753a1a87SJed Brown# 29627dc398fSStefano Zampinireconfigure: allclean 2974d5cfbf7SSatish Balay @unset MAKEFLAGS && ${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py 298753a1a87SJed Brown# 299753a1a87SJed Browninstall: 3000ee81e68SLisandro Dalcin @${PYTHON} ./config/install.py -destDir=${DESTDIR} 301504e95faSBarry Smith +${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} petsc4py-install libmesh-install mfem-install slepc-install hpddm-install amrex-install bamg-install 302753a1a87SJed Brown 3034198fb66SBarry Smithmpistreams: 3040e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistreams 3055fabf859SBarry Smith 3064198fb66SBarry Smithmpistream: 3070e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistream 3084198fb66SBarry Smith 3094198fb66SBarry Smithopenmpstreams: 3100e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstreams 3114198fb66SBarry Smith 3124198fb66SBarry Smithopenmpstream: 3130e03b746SBarry Smith +@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstream 3144198fb66SBarry Smith 3154198fb66SBarry Smith# for legacy reasons 3164198fb66SBarry Smithstream: mpistream 3174198fb66SBarry Smith 3184198fb66SBarry Smithstreams: mpistreams 319fc5166cbSSatish Balay 320753a1a87SJed Brown# ------------------------------------------------------------------ 321753a1a87SJed Brown# 322753a1a87SJed Brown# All remaining actions are intended for PETSc developers only. 323753a1a87SJed Brown# PETSc users should not generally need to use these commands. 324753a1a87SJed Brown# 325753a1a87SJed Brown# See the users manual for how the tags files may be used from Emacs and Vi/Vim 326753a1a87SJed Brown# 327753a1a87SJed Brownalletags: 328c3a89c15SBarry Smith -@${PYTHON} lib/petsc/bin/maint/generateetags.py 329753a1a87SJed Brown -@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON 330753a1a87SJed Brown 33137763f56SJed Brown# obtain gtags from https://www.gnu.org/software/global/ 332762ef373SBarry Smithallgtags: 33337763f56SJed 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 - 334762ef373SBarry Smith 335753a1a87SJed Brownallfortranstubs: 3361b266c99SBarry Smith -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 337c3a89c15SBarry Smith @${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py ${BFORT} ${VERBOSE} 338c3a89c15SBarry Smith -@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py -merge ${VERBOSE} 339a318115bSBarry Smith -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 340753a1a87SJed Browndeletefortranstubs: 341753a1a87SJed Brown -@find . -type d -name ftn-auto | xargs rm -rf 342753a1a87SJed Brown 343f4da3331SVáclav Hapla# Build just citations 344f4da3331SVáclav Haplaallcite: chk_loc deletemanualpages 3450e03b746SBarry Smith -${OMAKE_SELF} ACTION=manualpages_buildcite tree_basic LOC=${LOC} 346753a1a87SJed Brown -@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap 3475adeb073SPatrick Sanan -@cat ${PETSC_DIR}/doc/classic/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap 348f4da3331SVáclav Hapla 349f4da3331SVáclav Hapla# Build just manual pages + prerequisites 350f4da3331SVáclav Haplaallmanpages: chk_loc allcite 35171c41f4fSBarry Smith -${RM} ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err 3520e03b746SBarry Smith -${OMAKE_SELF} ACTION=manualpages tree_basic LOC=${LOC} 353*2e528e40SSatish Balay a=`cat ${PETSC_DIR}/${PETSC_ARCH}/manualpages.err | wc -l`; test ! $$a -gt 0 354f4da3331SVáclav Hapla 355f4da3331SVáclav Hapla# Build just manual examples + prerequisites 356f4da3331SVáclav Haplaallmanexamples: chk_loc allmanpages 3570e03b746SBarry Smith -${OMAKE_SELF} ACTION=manexamples tree_basic LOC=${LOC} 358f4da3331SVáclav Hapla 3597b770568SPatrick Sanan# Build all classic docs except html sources 360f4da3331SVáclav Haplaalldoc1: chk_loc chk_concepts_dir allcite allmanpages allmanexamples 3610e03b746SBarry Smith -${OMAKE_SELF} manimplementations LOC=${LOC} 362c3a89c15SBarry Smith -${PYTHON} lib/petsc/bin/maint/wwwindex.py ${PETSC_DIR} ${LOC} 3630e03b746SBarry Smith -${OMAKE_SELF} ACTION=getexlist tree_basic LOC=${LOC} 3640e03b746SBarry Smith -${OMAKE_SELF} ACTION=exampleconcepts tree_basic LOC=${LOC} 365c3a89c15SBarry Smith -${PYTHON} lib/petsc/bin/maint/helpindex.py ${PETSC_DIR} ${LOC} 366753a1a87SJed Brown 367753a1a87SJed Brown# Builds .html versions of the source 3687b770568SPatrick Sanan# html overwrites some stuff - hence this is done later. 369dc907ce5SJose E. Romanalldoc2: chk_loc allcite 3700e03b746SBarry Smith -${OMAKE_SELF} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC} 3712db48be3SPatrick Sanan 37298d6868cSPatrick Sananalldoc12: alldoc1 alldoc2 373753a1a87SJed Brown 37472ece014SPatrick Sananalldocclean: deletemanualpages allcleanhtml 375753a1a87SJed Brown 376753a1a87SJed Brown# Deletes man pages (HTML version) 377753a1a87SJed Browndeletemanualpages: chk_loc 378753a1a87SJed Brown -@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \ 379753a1a87SJed Brown find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\ 380753a1a87SJed Brown ${RM} ${LOC}/docs/exampleconcepts ;\ 381753a1a87SJed Brown ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\ 382753a1a87SJed Brown fi 383753a1a87SJed Brown 384753a1a87SJed Brownallcleanhtml: 3850e03b746SBarry Smith -${OMAKE_SELF} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree 386753a1a87SJed Brown 387753a1a87SJed Brownchk_concepts_dir: chk_loc 388753a1a87SJed Brown @if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \ 389753a1a87SJed Brown echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi 390753a1a87SJed Brown 3917b770568SPatrick Sanan# Builds simple html versions of the source without links into the $PETSC_ARCH/obj directory, used by make mergegcov 392f22bedf1SBarry Smithsrchtml: 393f22bedf1SBarry Smith -${OMAKE_SELF} ACTION=simplehtml PETSC_DIR=${PETSC_DIR} alltree_src 394f22bedf1SBarry Smith 395753a1a87SJed Brown########################################################### 396753a1a87SJed Brown# targets to build distribution and update docs 397753a1a87SJed Brown########################################################### 398753a1a87SJed Brown 399a8af48b3SSatish Balay# Creates ${HOME}/petsc.tar.gz [and petsc-with-docs.tar.gz] 400753a1a87SJed Browndist: 4019dddd249SSatish Balay ${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} main 402753a1a87SJed Brown 403753a1a87SJed Brown########################################################### 404753a1a87SJed Brown# 405753a1a87SJed Brown# See script for details 406753a1a87SJed Brown# 407753a1a87SJed Browngcov: 408f22bedf1SBarry Smith @$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py --run_gcov --petsc_arch ${PETSC_ARCH} 409753a1a87SJed Brown 410753a1a87SJed Brownmergegcov: 411a11e88d7SSatish Balay @$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py --merge_gcov --petsc_arch ${PETSC_ARCH} --merge_branch `lib/petsc/bin/maint/check-merge-branch.sh` 412b0e5478fSScott Kruger 413753a1a87SJed Brown 4149eed5432SKarl Rupp######################## 415235fd6e6SBarry Smith# 4169eed5432SKarl Rupp# Create the include dependency graph (requires graphviz to be available) 4179eed5432SKarl Rupp# 4189eed5432SKarl Ruppincludegraph: 4199eed5432SKarl Rupp -@${PETSC_DIR}/src/contrib/style/include-graph.sh includegraph.pdf 4209eed5432SKarl Rupp -@echo Include dependency graph written to includegraph.pdf 421235fd6e6SBarry Smith 422753a1a87SJed Brown# 423753a1a87SJed Brown# ------------------------------------------------------------------------------- 424753a1a87SJed Brown# 425753a1a87SJed Brown# Some macros to check if the fortran interface is up-to-date. 426753a1a87SJed Brown# 427753a1a87SJed Browncountfortranfunctions: 428753a1a87SJed Brown -@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \ 429753a1a87SJed Brown cut -d'(' -f1 | tr -s ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \ 430753a1a87SJed Brown sed "s/_$$//" | sort > /tmp/countfortranfunctions 431753a1a87SJed Brown 432753a1a87SJed Browncountcfunctions: 433068711b4SBarry Smith -@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h | grep "(" | tr -s ' ' | \ 434753a1a87SJed Brown cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' | \ 435068711b4SBarry Smith tr 'A-Z' 'a-z' | sort | uniq > /tmp/countcfunctions 436753a1a87SJed Brown 437753a1a87SJed Browndifffortranfunctions: countfortranfunctions countcfunctions 438753a1a87SJed Brown -@echo -------------- Functions missing in the fortran interface --------------------- 439753a1a87SJed Brown -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 440753a1a87SJed Brown -@echo ----------------- Functions missing in the C interface ------------------------ 441753a1a87SJed Brown -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 442753a1a87SJed Brown -@${RM} /tmp/countcfunctions /tmp/countfortranfunctions 443753a1a87SJed Brown 444753a1a87SJed Browncheckbadfortranstubs: 445753a1a87SJed Brown -@echo "=========================================" 446753a1a87SJed Brown -@echo "Functions with MPI_Comm as an Argument" 447753a1a87SJed Brown -@echo "=========================================" 448753a1a87SJed Brown -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \ 449753a1a87SJed Brown tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 450753a1a87SJed Brown -@echo "=========================================" 451753a1a87SJed Brown -@echo "Functions with a String as an Argument" 452753a1a87SJed Brown -@echo "=========================================" 453753a1a87SJed Brown -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \ 454753a1a87SJed Brown tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 455753a1a87SJed Brown -@echo "=========================================" 456753a1a87SJed Brown -@echo "Functions with Pointers to PETSc Objects as Argument" 457753a1a87SJed Brown -@echo "=========================================" 458753a1a87SJed Brown -@cd ${PETSC_DIR}/src/fortran/auto; \ 459753a1a87SJed Brown _p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \ 460753a1a87SJed Brown cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \ 461753a1a87SJed Brown sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ 462753a1a87SJed Brown for OBJ in $$_p_OBJ; do \ 463753a1a87SJed Brown grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \ 464753a1a87SJed Brown cut -d'(' -f1 | cut -d' ' -f1,3; \ 465753a1a87SJed Brown done 466a3269974SBarry Smith 467a3269974SBarry Smithcheckpackagetests: 468a3269974SBarry Smith -@echo "Missing package tests" 469a3269974SBarry Smith -@cat config/examples/*.py > configexamples; pushd config/BuildSystem/config/packages/; packages=`ls *.py | sed "s/\\.py//g"`;popd; for i in $${packages}; do j=`echo $${i} | tr '[:upper:]' '[:lower:]'`; printf $${j} ; egrep "(with-$${j}|download-$${j})" configexamples | grep -v "=0" | wc -l ; done 470a3269974SBarry Smith -@echo "Missing download package tests" 471a3269974SBarry Smith -@cat config/examples/*.py > configexamples; pushd config/BuildSystem/config/packages/; packages=`grep -l "download " *.py | sed "s/\\.py//g"`;popd; for i in $${packages}; do j=`echo $${i} | tr '[:upper:]' '[:lower:]'`; printf $${j} ; egrep "(download-$${j})" configexamples | grep -v "=0" | wc -l ; done 472a3269974SBarry Smith 473dc0529c6SBarry Smith.PHONY: info info_h all deletelibs allclean update \ 474753a1a87SJed Brown alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \ 475dc0529c6SBarry Smith allhtml allcleanhtml countfortranfunctions \ 476416ff897SSatish Balay start_configure configure_petsc configure_clean matlabbin install 477