1# 2# This is the makefile for compiling PETSc. See 3# http://www.mcs.anl.gov/petsc/documentation/installation.html for directions on installing PETSc. 4# See also conf for additional commands. 5# 6ALL: all 7LOCDIR = ./ 8DIRS = src include tutorials interfaces share/petsc/matlab 9CFLAGS = 10FFLAGS = 11CPPFLAGS = 12FPPFLAGS = 13 14# next line defines PETSC_DIR and PETSC_ARCH if they are not set 15include ././${PETSC_ARCH}/lib/petsc/conf/petscvariables 16include ${PETSC_DIR}/lib/petsc/conf/variables 17include ${PETSC_DIR}/lib/petsc/conf/rules 18include ${PETSC_DIR}/lib/petsc/conf/test.common 19 20# This makefile contains a lot of PHONY targets with improperly specified prerequisites 21# where correct execution instead depends on the targets being processed in the correct 22# order. This is gross, but this makefile doesn't really do any work. Sub-makes still 23# benefit from parallelism. 24.NOTPARALLEL: 25 26# 27# Basic targets to build PETSc libraries. 28# all: builds the c, fortran, and f90 libraries 29all: 30 +@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} chk_petscdir chk_upgrade | tee ${PETSC_ARCH}/lib/petsc/conf/make.log 31 @ln -sf ${PETSC_ARCH}/lib/petsc/conf/make.log make.log 32 +@if [ "${MAKE_IS_GNUMAKE}" != "" ]; then \ 33 ${OMAKE_PRINTDIR} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-gnumake-local 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 34 elif [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \ 35 ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-cmake-local 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log \ 36 | egrep -v '( --check-build-system |cmake -E | -o CMakeFiles/petsc[[:lower:]]*.dir/| -o lib/libpetsc|CMakeFiles/petsc[[:lower:]]*\.dir/(build|depend|requires)|-f CMakeFiles/Makefile2|Dependee .* is newer than depender |provides\.build. is up to date)'; \ 37 else \ 38 ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-legacy-local 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log \ 39 | ${GREP} -v "has no symbols"; \ 40 fi 41 @egrep -i "( error | error: |no such file or directory)" ${PETSC_ARCH}/lib/petsc/conf/make.log | tee ${PETSC_ARCH}/lib/petsc/conf/error.log > /dev/null 42 +@if test -s ${PETSC_ARCH}/lib/petsc/conf/error.log; then \ 43 printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 44 echo " Error during compile, check ${PETSC_ARCH}/lib/petsc/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \ 45 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;\ 46 printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\ 47 else \ 48 ${OMAKE} shared_install PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log ;\ 49 fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below 50 @echo "Finishing make run at `date +'%a, %d %b %Y %H:%M:%S %z'`" >> ${PETSC_ARCH}/lib/petsc/conf/make.log 51 @if test -s ${PETSC_ARCH}/lib/petsc/conf/error.log; then exit 1; fi 52 53all-gnumake: 54 @if [ "${MAKE_IS_GNUMAKE}" != "" ]; then \ 55 ${OMAKE_PRINTDIR} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_BUILD_USING_CMAKE="" all;\ 56 else printf ${PETSC_TEXT_HILIGHT}"Build not configured for GNUMAKE. Quiting"${PETSC_TEXT_NORMAL}"\n"; exit 1; fi 57 58all-cmake: 59 @if [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \ 60 ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} MAKE_IS_GNUMAKE="" all;\ 61 else printf ${PETSC_TEXT_HILIGHT}"Build not configured for CMAKE. Quiting"${PETSC_TEXT_NORMAL}"\n"; exit 1; fi 62 63all-legacy: 64 @${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} PETSC_BUILD_USING_CMAKE="" MAKE_IS_GNUMAKE="" all 65 66all-gnumake-local: info gnumake matlabbin mpi4py-build petsc4py-build libmesh-build slepc-build mfem-build 67 68all-cmake-local: info cmakegen cmake matlabbin mpi4py-build petsc4py-build 69 70all-legacy-local: chklib_dir info deletelibs deletemods build matlabbin shared_nomesg mpi4py-build petsc4py-build 71 72# 73# Prints information about the system and version of PETSc being compiled 74# 75info: 76 -@echo "==========================================" 77 -@echo " " 78 -@echo "See documentation/faq.html and documentation/bugreporting.html" 79 -@echo "for help with installation problems. Please send EVERYTHING" 80 -@echo "printed out below when reporting problems. Please check the" 81 -@echo "mailing list archives and consider subscribing." 82 -@echo " " 83 -@echo " http://www.mcs.anl.gov/petsc/miscellaneous/mailing-lists.html" 84 -@echo " " 85 -@echo "==========================================" 86 -@echo Starting make run on `hostname` at `date +'%a, %d %b %Y %H:%M:%S %z'` 87 -@echo Machine characteristics: `uname -a` 88 -@echo "-----------------------------------------" 89 -@echo "Using PETSc directory: ${PETSC_DIR}" 90 -@echo "Using PETSc arch: ${PETSC_ARCH}" 91 -@echo "-----------------------------------------" 92 -@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//" 93 -@echo "-----------------------------------------" 94 -@echo "Using configure Options: ${CONFIGURE_OPTIONS}" 95 -@echo "Using configuration flags:" 96 -@grep "\#define " ${PETSCCONF_H} 97 -@echo "-----------------------------------------" 98 -@echo "Using C compile: ${PETSC_COMPILE}" 99 -@if [ "${MPICC_SHOW}" != "" ]; then \ 100 printf "mpicc -show: %b\n" "${MPICC_SHOW}";\ 101 fi; \ 102 printf "C compiler version: %b\n" "${C_VERSION}"; \ 103 if [ "${CXX}" != "" ]; then \ 104 echo "Using C++ compile: ${PETSC_CXXCOMPILE}";\ 105 if [ "${MPICXX_SHOW}" != "" ]; then \ 106 printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \ 107 fi;\ 108 printf "C++ compiler version: %b\n" "${Cxx_VERSION}"; \ 109 fi 110 -@if [ "${FC}" != "" ]; then \ 111 echo "Using Fortran compile: ${PETSC_FCOMPILE}";\ 112 if [ "${MPIFC_SHOW}" != "" ]; then \ 113 printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \ 114 fi; \ 115 printf "Fortran compiler version: %b\n" "${FC_VERSION}"; \ 116 fi 117 -@if [ "${CUDAC}" != "" ]; then \ 118 echo "Using CUDA compile: ${PETSC_CUCOMPILE}";\ 119 fi 120 -@echo "-----------------------------------------" 121 -@echo "Using C/C++ linker: ${PCC_LINKER}" 122 -@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}" 123 -@if [ "${FC}" != "" ]; then \ 124 echo "Using Fortran linker: ${FC_LINKER}";\ 125 echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\ 126 fi 127 -@echo "-----------------------------------------" 128 -@echo "Using system modules: ${LOADEDMODULES}" 129 -@if [ "${MPI_IS_MPIUNI}" = "1" ]; then \ 130 echo Using mpi.h: mpiuni; \ 131 else \ 132 TESTDIR=`mktemp -q -d -t petscmpi-XXXXXXXX` && \ 133 echo '#include <mpi.h>' > $${TESTDIR}/mpitest.c && \ 134 BUF=`${CPP} ${PETSC_CCPPFLAGS} $${TESTDIR}/mpitest.c |grep 'mpi\.h' | ( head -1 ; cat > /dev/null )` && \ 135 echo Using mpi.h: $${BUF}; ${RM} -rf $${TESTDIR}; \ 136 fi 137 -@echo "-----------------------------------------" 138 -@echo "Using libraries: ${PETSC_LIB}" 139 -@echo "------------------------------------------" 140 -@echo "Using mpiexec: ${MPIEXEC}" 141 -@echo "------------------------------------------" 142 -@echo "Using MAKEFLAGS: -j$(MAKE_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)" 143 -@echo "==========================================" 144 145# 146# Builds the PETSc libraries 147# This target also builds fortran77 and f90 interface 148# files and compiles .F files 149# 150build: 151 -@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES" 152 -@echo "=========================================" 153 -@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree 154 -@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX} > tmpf 2>&1 ; ${GREP} -v "has no symbols" tmpf; ${RM} tmpf; 155 -@echo "Completed building libraries" 156 -@echo "=========================================" 157# 158# Build MatLab binaries 159# 160matlabbin: 161 -@if [ "${MATLAB_MEX}" != "" -a "${MATLAB_SOCKET}" != "" -a "${PETSC_SCALAR}" = "real" -a "${PETSC_PRECISION}" = "double" ]; then \ 162 echo "BEGINNING TO COMPILE MATLAB INTERFACE"; \ 163 if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc; fi; \ 164 if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab" ] ; then ${MKDIR} ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab; fi; \ 165 cd src/sys/classes/viewer/impls/socket/matlab && ${OMAKE} matlabcodes PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR}; \ 166 echo "========================================="; \ 167 fi 168# 169# Builds PETSc test examples for a given architecture 170# 171test_install: test 172check: test 173test: 174 -+@${OMAKE} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} test_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/test.log 175testx: 176 -@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testx_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/testx.log 177test_build: 178 -@echo "Running test examples to verify correct installation" 179 -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 180 +@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean 181 +@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex19 182 +@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 183 cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_hypre; \ 184 fi; 185 +@if [ "${MUMPS_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 186 cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_fieldsplit_mumps; \ 187 fi; 188 +@if [ "${SUPERLU_DIST_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 189 cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_superlu_dist; \ 190 fi; 191 +@if ( [ "${ML_LIB}" != "" ] || [ "${TRILINOS_LIB}" != "" ] ) && [ "${PETSC_WITH_BATCH}" = "" ]; then \ 192 cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex19_ml; \ 193 fi; 194 +@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ex19.rm 195 +@if [ "${PETSC4PY}" = "yes" ]; then \ 196 cd src/ksp/ksp/examples/tutorials >/dev/null; \ 197 ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean; \ 198 ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex100; \ 199 ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean; \ 200 fi; 201 +@egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 202 if test -s .ftn.log; then \ 203 cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testex5f; \ 204 fi; ${RM} .ftn.log; 205 +@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean 206 -@echo "Completed test examples" 207testx_build: 208 -@echo "Running graphics test example to verify correct X11 installation" 209 -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 210 @cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean 211 @cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} testxex19 212 @cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean 213 -@echo "Completed graphics test example" 214test_usermakefile: 215 -@echo "Testing compile with user makefile" 216 -@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}" 217 @cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex19 218 @egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \ 219 if test -s .ftn.log; then \ 220 cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex5f; \ 221 fi; ${RM} .ftn.log; 222 @cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} clean 223 -@echo "Completed compile with user makefile" 224 225# Compare ABI/API of two versions of PETSc library with the old one defined by PETSC_{DIR,ARCH}_ABI_OLD 226abitest: 227 @if [ "${PETSC_DIR_ABI_OLD}" == "" ] || [ "${PETSC_ARCH_ABI_OLD}" == "" ]; \ 228 then printf "You must set environment variables PETSC_DIR_ABI_OLD and PETSC_ARCH_ABI_OLD to run abitest\n"; \ 229 exit 1; \ 230 fi; 231 -@echo "Comparing ABI/API of the following two PETSc versions (you must have already configured and built them using GCC and with -g):" 232 -@echo "=========================================================================================" 233 -@echo " Old: PETSC_DIR_ABI_OLD = ${PETSC_DIR_ABI_OLD}" 234 -@echo " PETSC_ARCH_ABI_OLD = ${PETSC_ARCH_ABI_OLD}" 235 -@pushd ${PETSC_DIR_ABI_OLD} >> /dev/null ; echo " Branch = "`git rev-parse --abbrev-ref HEAD` 236 -@echo " New: PETSC_DIR = ${PETSC_DIR}" 237 -@echo " PETSC_ARCH = ${PETSC_ARCH}" 238 -@echo " Branch = "`git rev-parse --abbrev-ref HEAD` 239 -@echo "=========================================================================================" 240 -@$(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 241 242# Compare ABI/API of current PETSC_ARCH/PETSC_DIR with a previous branch 243abitestcomplete: 244 -@if [[ -f "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log" ]]; then \ 245 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"` ;\ 246echo $${OPTIONS} ;\ 247 fi ; \ 248 if [[ "${PETSC_DIR_ABI_OLD}" != "" ]]; then \ 249 PETSC_DIR_OLD=${PETSC_DIR_ABI_OLD}; \ 250 else \ 251 PETSC_DIR_OLD=${PETSC_DIR}/../petsc-abi; \ 252 fi ; \ 253 echo "=================================================================================================" ;\ 254 echo "Doing ABI/API comparison between" ${branch} " and " `git rev-parse --abbrev-ref HEAD` "using " $${OPTIONS} ;\ 255 echo "=================================================================================================" ;\ 256 if [[ ! -d $${PETSC_DIR_OLD} ]]; then \ 257 git clone ${PETSC_DIR} $${PETSC_DIR_OLD} ; \ 258 else \ 259 cd $${PETSC_DIR_OLD} ; \ 260 git pull ; \ 261 fi ; \ 262 cd $${PETSC_DIR_OLD} ; \ 263 git checkout ${branch} ; \ 264 PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` ./configure $${OPTIONS} ; \ 265 PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` make all test ; \ 266 cd ${PETSC_DIR} ; \ 267 ./configure $${OPTIONS}; \ 268 make all test ; \ 269 PETSC_DIR_ABI_OLD=$${PETSC_DIR_OLD} PETSC_ARCH_ABI_OLD=arch-branch-`git rev-parse ${branch}` make abitest 270 271# Ranlib on the libraries 272ranlib: 273 ${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX} 274 275# Deletes PETSc libraries 276deletelibs: 277 -${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.* 278deletemods: 279 -${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod 280 281# Cleans up build 282allclean-legacy: deletelibs deletemods 283 -@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean-legacy tree 284allclean-cmake: 285 -@cd ${PETSC_ARCH} && ${OMAKE} clean 286allclean-gnumake: 287 -@${OMAKE} -f gmakefile clean 288 289allclean: 290 @if [ "${MAKE_IS_GNUMAKE}" != "" ]; then \ 291 ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} allclean-gnumake; \ 292 elif [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \ 293 ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} allclean-cmake; \ 294 else \ 295 ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} allclean-legacy; \ 296 fi 297 298clean:: allclean 299 300distclean: chk_petscdir 301 @if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then \ 302 echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***"; \ 303 mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/; fi 304 @echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***" 305 -${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/ 306 307 308# 309reconfigure: 310 @unset MAKEFLAGS && ${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py 311# 312install: 313 @${PYTHON} ./config/install.py -destDir=${DESTDIR} 314 +${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} mpi4py-install petsc4py-install libmesh-install slepc-install mfem-install 315 316newall: 317 -@cd src/sys; @${PYTHON} ${PETSC_DIR}/config/builder.py 318 -@cd src/vec; @${PYTHON} ${PETSC_DIR}/config/builder.py 319 -@cd src/mat; @${PYTHON} ${PETSC_DIR}/config/builder.py 320 -@cd src/dm; @${PYTHON} ${PETSC_DIR}/config/builder.py 321 -@cd src/ksp; @${PYTHON} ${PETSC_DIR}/config/builder.py 322 -@cd src/snes; @${PYTHON} ${PETSC_DIR}/config/builder.py 323 -@cd src/ts; @${PYTHON} ${PETSC_DIR}/config/builder.py 324 325streams: 326 -@echo "running streams in src/benchmarks/streams" 327 +@cd src/benchmarks/streams; ${OMAKE} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} streams 328 329stream: 330 -@echo "running stream in src/benchmarks/streams" 331 +@cd src/benchmarks/streams; ${OMAKE} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} stream 332 333# ------------------------------------------------------------------ 334# 335# All remaining actions are intended for PETSc developers only. 336# PETSc users should not generally need to use these commands. 337# 338# See the users manual for how the tags files may be used from Emacs and Vi/Vim 339# 340alletags: 341 -@${PYTHON} lib/petsc/bin/maint/generateetags.py 342 -@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON 343 344# obtain gtags from http://www.gnu.org/s/global/ 345allgtags: 346 -@find ${PETSC_DIR}/include ${PETSC_DIR}/src ${PETSC_DIR}/bin -regex '\(.*makefile\|.*\.\(cc\|hh\|cpp\|C\|hpp\|c\|h\|cu\|m\)$$\)' | grep -v ftn-auto | gtags -f - 347 348allfortranstubs: 349 -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 350 @${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py ${BFORT} ${VERBOSE} 351 -@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py -merge ${VERBOSE} 352 -@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir 353deletefortranstubs: 354 -@find . -type d -name ftn-auto | xargs rm -rf 355cmakegen: 356 -@${PYTHON} config/cmakegen.py 357# 358# These are here for the target allci and allco, and etags 359# 360 361BMAKEFILES = conf/variables conf/rules conf/test 362SCRIPTS = lib/petsc/bin/maint/builddist lib/petsc/bin/maint/wwwman lib/petsc/bin/maint/xclude lib/petsc/bin/maint/bugReport.py lib/petsc/bin/maint/buildconfigtest lib/petsc/bin/maint/builddistlite \ 363 lib/petsc/bin/maint/buildtest lib/petsc/bin/maint/checkBuilds.py lib/petsc/bin/maint/copylognightly lib/petsc/bin/maint/copylognightly.tao lib/petsc/bin/maint/countfiles lib/petsc/bin/maint/findbadfiles \ 364 lib/petsc/bin/maint/fixinclude lib/petsc/bin/maint/getexlist lib/petsc/bin/maint/getpdflabels.py lib/petsc/bin/maint/helpindex.py lib/petsc/bin/maint/hosts.local lib/petsc/bin/maint/hosts.solaris \ 365 lib/petsc/bin/maint/lex.py lib/petsc/bin/maint/mapnameslatex.py lib/petsc/bin/maint/startnightly lib/petsc/bin/maint/startnightly.tao lib/petsc/bin/maint/submitPatch.py \ 366 lib/petsc/bin/maint/update-docs.py lib/petsc/bin/maint/wwwindex.py lib/petsc/bin/maint/xcludebackup lib/petsc/bin/maint/xcludecblas lib/petsc/bin/maint/zap lib/petsc/bin/maint/zapall \ 367 config/PETSc/Configure.py config/PETSc/Options.py \ 368 config/PETSc/utilities/*.py 369 370 371# Builds all the documentation - should be done every night 372alldoc: allcite allpdf alldoc1 alldoc2 docsetdate 373 374# Build just citations 375allcite: chk_loc deletemanualpages 376 -${PYTHON} lib/petsc/bin/maint/countpetsccits.py 377 -${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC} 378 -@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap 379 -@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap 380 381# Build just PDF manuals + prerequisites 382allpdf: chk_loc allcite 383 -cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC} 384 -cd src/docs/tex/manual; ${OMAKE} developers.pdf LOC=${LOC} 385 -cd src/docs/tao_tex/manual; ${OMAKE} manual.pdf LOC=${LOC} 386 387# Build just manual pages + prerequisites 388allmanpages: chk_loc allcite 389 -${OMAKE} ACTION=manualpages tree_basic LOC=${LOC} 390 391# Build just manual examples + prerequisites 392allmanexamples: chk_loc allmanpages 393 -${OMAKE} ACTION=manexamples tree_basic LOC=${LOC} 394 395# Build everything that goes into 'doc' dir except html sources 396alldoc1: chk_loc chk_concepts_dir allcite allmanpages allmanexamples 397 -${OMAKE} manimplementations LOC=${LOC} 398 -${PYTHON} lib/petsc/bin/maint/wwwindex.py ${PETSC_DIR} ${LOC} 399 -${OMAKE} manconcepts LOC=${LOC} 400 -${OMAKE} ACTION=getexlist tree_basic LOC=${LOC} 401 -${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC} 402 -${PYTHON} lib/petsc/bin/maint/helpindex.py ${PETSC_DIR} ${LOC} 403 404# Builds .html versions of the source 405# html overwrites some stuff created by update-docs - hence this is done later. 406alldoc2: chk_loc 407 -${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC} 408 -${PYTHON} lib/petsc/bin/maint/update-docs.py ${PETSC_DIR} ${LOC} 409# 410# Makes links for all manual pages in $LOC/docs/manualpages/all 411allman: 412 @cd ${LOC}/docs/manualpages; rm -rf all ; mkdir all ; find * -type d -wholename all -prune -o -name index.html -prune -o -type f -name \*.html -exec ln -s -f ../{} all \; 413 414DOCSETDATE_PRUNE_LIST=-o -type f -wholename share/petsc/saws/linearsolveroptions.html -prune -o -type f -wholename tutorials/HandsOnExercise.html -prune -o -type f -wholename tutorials/TAOHandsOnExercise.html -prune 415 416# modify all generated html files and add in version number, date, canonical URL info. 417docsetdate: chk_petscdir 418 @echo "Updating generated html files with petsc version, date, canonical URL info";\ 419 version_release=`grep '^#define PETSC_VERSION_RELEASE ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \ 420 version_major=`grep '^#define PETSC_VERSION_MAJOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \ 421 version_minor=`grep '^#define PETSC_VERSION_MINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \ 422 version_subminor=`grep '^#define PETSC_VERSION_SUBMINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \ 423 if [ $${version_release} = 0 ]; then \ 424 petscversion=petsc-master; \ 425 export petscversion; \ 426 elif [ $${version_release} = 1 ]; then \ 427 petscversion=petsc-$${version_major}.$${version_minor}.$${version_subminor}; \ 428 export petscversion; \ 429 else \ 430 echo "Unknown PETSC_VERSION_RELEASE: $${version_release}"; \ 431 exit; \ 432 fi; \ 433 datestr=`git log -1 --pretty=format:%ci | cut -d ' ' -f 1`; \ 434 export datestr; \ 435 gitver=`git describe --match "v*"`; \ 436 export gitver; \ 437 find * -type d -wholename src/docs/website -prune -o -type d -wholename src/benchmarks/results -prune -o \ 438 -type d -wholename config/BuildSystem/docs/website -prune -o -type d -wholename include/web -prune -o \ 439 -type d -wholename 'arch-*' -prune -o -type d -wholename src/tops -prune -o -type d -wholename externalpackages -prune ${DOCSETDATE_PRUNE_LIST} -o \ 440 -type f -name \*.html \ 441 -exec perl -pi -e 's^(<body.*>)^$$1\n <div id=\"version\" align=right><b>$$ENV{petscversion} $$ENV{datestr}</b></div>\n <div id="bugreport" align=right><a href="mailto:petsc-maint\@mcs.anl.gov?subject=Typo or Error in Documentation &body=Please describe the typo or error in the documentation: $$ENV{petscversion} $$ENV{gitver} {} "><small>Report Typos and Errors</small></a></div>^i' {} \; \ 442 -exec perl -pi -e 's^(<head>)^$$1 <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/{}" />^i' {} \; ; \ 443 echo "Done fixing version number, date, canonical URL info" 444 445alldocclean: deletemanualpages allcleanhtml 446 447# Deletes man pages (HTML version) 448deletemanualpages: chk_loc 449 -@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \ 450 find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\ 451 ${RM} ${LOC}/docs/exampleconcepts ;\ 452 ${RM} ${LOC}/docs/manconcepts ;\ 453 ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\ 454 ${PYTHON} lib/petsc/bin/maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\ 455 fi 456 457allcleanhtml: 458 -${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree 459 460chk_concepts_dir: chk_loc 461 @if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \ 462 echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi 463 464########################################################### 465# targets to build distribution and update docs 466########################################################### 467 468# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz] 469dist: 470 ${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} master 471 472# This target works only if you can do 'ssh petsc@login.mcs.anl.gov' 473# also copy the file over to ftp site. 474web-snapshot: 475 @if [ ! -f "${HOME}/petsc-master.tar.gz" ]; then \ 476 echo "~/petsc-master.tar.gz missing! cannot update petsc-master snapshot on mcs-web-site"; \ 477 else \ 478 echo "updating petsc-master snapshot on mcs-web-site"; \ 479 tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \ 480 cd $${tmpdir}; tar -xzf ${HOME}/petsc-master.tar.gz; \ 481 /usr/bin/rsync -e ssh -az --delete $${tmpdir}/petsc-master/ \ 482 petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-master ;\ 483 /bin/cp -f /home/petsc/petsc-master.tar.gz /mcs/ftp/pub/petsc/petsc-master.tar.gz;\ 484 ${RM} -rf $${tmpdir} ;\ 485 fi 486 487# build the tarfile - and then update petsc-master snapshot on mcs-web-site 488update-web-snapshot: dist web-snapshot 489 490# This target updates website main pages 491update-web: 492 @cd ${PETSC_DIR}/src/docs; make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \ 493 /usr/bin/rsync -az -C --exclude=documentation/index.html \ 494 --exclude=documentation/installation.html --exclude=download/index.html \ 495 ${PETSC_DIR}/src/docs/website/ petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc 496 @cd ${PETSC_DIR}/docs; /usr/bin/rsync -az developers.pdf petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/developers/ 497 @cd ${PETSC_DIR}/src/docs/tex; /usr/bin/rsync -az petscapp.bib petsc.bib petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/publications 498 499# 500# builds a single list of files for each PETSc library so they may all be built in parallel 501# without a recursive set of make calls 502createfastbuild: 503 cd src/vec; ${RM} -f files; /bin/echo -n "SOURCEC = " > files; make tree ACTION=sourcelist BASE_DIR=${PETSC_DIR}/src/vec 504 505########################################################### 506# 507# See script for details 508# 509gcov: 510 -@$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py -run_gcov 511 512mergegcov: 513 -@$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py -merge_gcov ${LOC} *.tar.gz 514 515######################## 516# 517# Create the include dependency graph (requires graphviz to be available) 518# 519includegraph: 520 -@${PETSC_DIR}/src/contrib/style/include-graph.sh includegraph.pdf 521 -@echo Include dependency graph written to includegraph.pdf 522 523# 524# ------------------------------------------------------------------------------- 525# 526# Some macros to check if the fortran interface is up-to-date. 527# 528countfortranfunctions: 529 -@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \ 530 cut -d'(' -f1 | tr -s ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \ 531 sed "s/_$$//" | sort > /tmp/countfortranfunctions 532 533countcfunctions: 534 -@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h | grep "(" | tr -s ' ' | \ 535 cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' | \ 536 tr 'A-Z' 'a-z' | sort | uniq > /tmp/countcfunctions 537 538difffortranfunctions: countfortranfunctions countcfunctions 539 -@echo -------------- Functions missing in the fortran interface --------------------- 540 -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 541 -@echo ----------------- Functions missing in the C interface ------------------------ 542 -@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 543 -@${RM} /tmp/countcfunctions /tmp/countfortranfunctions 544 545checkbadfortranstubs: 546 -@echo "=========================================" 547 -@echo "Functions with MPI_Comm as an Argument" 548 -@echo "=========================================" 549 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \ 550 tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 551 -@echo "=========================================" 552 -@echo "Functions with a String as an Argument" 553 -@echo "=========================================" 554 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \ 555 tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 556 -@echo "=========================================" 557 -@echo "Functions with Pointers to PETSc Objects as Argument" 558 -@echo "=========================================" 559 -@cd ${PETSC_DIR}/src/fortran/auto; \ 560 _p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \ 561 cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \ 562 sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ 563 for OBJ in $$_p_OBJ; do \ 564 grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \ 565 cut -d'(' -f1 | cut -d' ' -f1,3; \ 566 done 567 568checkpackagetests: 569 -@echo "Missing package tests" 570 -@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 571 -@echo "Missing download package tests" 572 -@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 573 574# 575# Automatically generates PETSc exercises in html from the tutorial examples. 576# 577# The introduction for each section is obtained from docs/manualpages-cite/header_${MANSEC} may be edited 578# (used also in introductions to the manual pages) 579# 580# DO NOT EDIT the *.htm files generated since they will be automatically replaced. 581# 582# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed 583# -@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker 584# 585exercises: 586 -@echo "=========================================" 587 -@echo "Generating HTML tutorial exercises" 588 -@${RM} docs/pageform.txt 589 -@echo "title=\"PETSc Exercises\"" > docs/pageform.txt 590 -@echo "access_title=Exercise Sections" >> docs/pageform.txt 591 -@echo "access_format=short" >> docs/pageform.txt 592 -@echo "startpage=../exercises/introduction.htm" >> docs/pageform.txt 593 -@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt 594 -@echo "Generating HTML for individual directories" 595 -@echo "=========================================" 596 -@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree 597 -@echo "Completed HTML for individual directories" 598 -@echo "NONE title=\"<HR>\" " >> docs/pageform.txt; 599 -@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt 600 /home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises 601 -@echo "=========================================" 602 603.PHONY: info info_h all build ranlib deletelibs allclean update \ 604 alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \ 605 allhtml allcleanhtml allci allco allrcslabel countfortranfunctions \ 606 start_configure configure_petsc configure_clean matlabbin install 607 608petscao : petscmat petscao.f90.h 609petscdm : petscksp petscdm.f90.h 610petscdraw : petsc petscdraw.f90.h 611petscis : petsc petscis.f90.h 612petscksp : petscpc petscksp.f90.h 613petsclog : petsc petsclog.f90.h 614petscmat : petscvec petscmat.f90.h 615petscmg : petscksp petscmg.f90.h 616petscpc : petscmat petscpc.f90.h 617petscsnes : petscksp petscsnes.f90.h 618petscsys : petsc petscsys.f90.h 619petscts : petscsnes petscts.f90.h 620petsc : petsc.f90.h 621petscvec : petscis petscvec.f90.h 622petscviewer : petsc petscviewer.f90.h 623petscmesh : petsc petscmesh.f90.h 624modules : petscao petscdm petscdraw petscis petscksp petsclog petscmat petscmg petscpc petscsnes petscsys petscts petsc petscvec petscviewer petscmesh 625