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