xref: /petsc/makefile (revision 37763f56cfc90493641c6464b449cbc08e41aba2)
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
350e03b746SBarry Smith	+@${OMAKE_SELF_PRINTDIR} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-local 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;
36af0996ceSBarry Smith	@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
37dd8585cdSJed Brown	+@if test -s ${PETSC_ARCH}/lib/petsc/conf/error.log; then \
38af0996ceSBarry Smith           printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \
39af0996ceSBarry Smith           echo "  Error during compile, check ${PETSC_ARCH}/lib/petsc/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \
40af0996ceSBarry 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;\
41af0996ceSBarry Smith           printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\
42753a1a87SJed Brown	 else \
430e03b746SBarry 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 ;\
44753a1a87SJed Brown        fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below
454dcdf380SSatish Balay	@echo "Finishing make run at `date +'%a, %d %b %Y %H:%M:%S %z'`" >> ${PETSC_ARCH}/lib/petsc/conf/make.log
46af0996ceSBarry Smith	@if test -s ${PETSC_ARCH}/lib/petsc/conf/error.log; then exit 1; fi
47753a1a87SJed Brown
484e4a1d08SBarry Smithall-local: info libs matlabbin mpi4py-build petsc4py-build libmesh-build mfem-build slepc-build hpddm-build amrex-build
49fa2665b1SJed Brown
50753a1a87SJed Brown#
51753a1a87SJed Brown# Prints information about the system and version of PETSc being compiled
52753a1a87SJed Brown#
53dd8585cdSJed Browninfo:
54753a1a87SJed Brown	-@echo "=========================================="
55753a1a87SJed Brown	-@echo " "
56753a1a87SJed Brown	-@echo "See documentation/faq.html and documentation/bugreporting.html"
57753a1a87SJed Brown	-@echo "for help with installation problems.  Please send EVERYTHING"
58bc10b077SJed Brown	-@echo "printed out below when reporting problems.  Please check the"
59bc10b077SJed Brown	-@echo "mailing list archives and consider subscribing."
60753a1a87SJed Brown	-@echo " "
61bc10b077SJed Brown	-@echo "  http://www.mcs.anl.gov/petsc/miscellaneous/mailing-lists.html"
62753a1a87SJed Brown	-@echo " "
63753a1a87SJed Brown	-@echo "=========================================="
644dcdf380SSatish Balay	-@echo Starting make run on `hostname` at `date +'%a, %d %b %Y %H:%M:%S %z'`
65753a1a87SJed Brown	-@echo Machine characteristics: `uname -a`
66753a1a87SJed Brown	-@echo "-----------------------------------------"
67753a1a87SJed Brown	-@echo "Using PETSc directory: ${PETSC_DIR}"
68753a1a87SJed Brown	-@echo "Using PETSc arch: ${PETSC_ARCH}"
69753a1a87SJed Brown	-@echo "-----------------------------------------"
70753a1a87SJed Brown	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
71753a1a87SJed Brown	-@echo "-----------------------------------------"
72753a1a87SJed Brown	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
73753a1a87SJed Brown	-@echo "Using configuration flags:"
747cab4194SSatish Balay	-@grep "\#define " ${PETSCCONF_H}
75753a1a87SJed Brown	-@echo "-----------------------------------------"
76f5718a65SBarry Smith	-@echo "Using C compile: ${PETSC_CCOMPILE}"
777c934407SBarry Smith	-@if [  "${MPICC_SHOW}" != "" ]; then \
78fd0cdb26SSatish Balay             printf  "mpicc -show: %b\n" "${MPICC_SHOW}";\
797c934407SBarry Smith          fi; \
807c934407SBarry Smith        printf  "C compiler version: %b\n" "${C_VERSION}"; \
81f5718a65SBarry Smith        if [ "${PETSC_CXXCOMPILE}" != "" ]; then \
827c934407SBarry Smith        echo "Using C++ compile: ${PETSC_CXXCOMPILE}";\
837c934407SBarry Smith        if [ "${MPICXX_SHOW}" != "" ]; then \
84fd0cdb26SSatish Balay               printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \
857c934407SBarry Smith            fi;\
867c934407SBarry Smith            printf  "C++ compiler version: %b\n" "${Cxx_VERSION}"; \
877c934407SBarry Smith          fi
88753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
89da0b7683SSatish Balay	   echo "Using Fortran compile: ${PETSC_FCOMPILE}";\
90607e78e0SSatish Balay           if [ "${MPIFC_SHOW}" != "" ]; then \
91fd0cdb26SSatish Balay             printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \
92607e78e0SSatish Balay           fi; \
937c934407SBarry Smith             printf  "Fortran compiler version: %b\n" "${FC_VERSION}"; \
94da0b7683SSatish Balay         fi
95da0b7683SSatish Balay	-@if [ "${CUDAC}" != "" ]; then \
96da0b7683SSatish Balay	   echo "Using CUDA compile: ${PETSC_CUCOMPILE}";\
97753a1a87SJed Brown         fi
98cab5ea25SPierre Jolivet	-@if [ "${CLANGUAGE}" = "CXX" ]; then \
99f5718a65SBarry Smith           echo "Using C++ compiler to compile PETSc";\
100f5718a65SBarry Smith        fi
101753a1a87SJed Brown	-@echo "-----------------------------------------"
102753a1a87SJed Brown	-@echo "Using C/C++ linker: ${PCC_LINKER}"
103753a1a87SJed Brown	-@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}"
104753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
105753a1a87SJed Brown	   echo "Using Fortran linker: ${FC_LINKER}";\
106753a1a87SJed Brown	   echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\
107753a1a87SJed Brown         fi
108753a1a87SJed Brown	-@echo "-----------------------------------------"
1091d2d58a3SSatish Balay	-@echo "Using system modules: ${LOADEDMODULES}"
110d1f8d238SSatish Balay	-@if [ "${MPI_IS_MPIUNI}" = "1" ]; then \
111d1f8d238SSatish Balay           echo Using mpi.h: mpiuni; \
112d1f8d238SSatish Balay        else \
113d1f8d238SSatish Balay           TESTDIR=`mktemp -q -d -t petscmpi-XXXXXXXX` && \
11442a47be2SSatish Balay           echo '#include <mpi.h>' > $${TESTDIR}/mpitest.c && \
115f5718a65SBarry Smith           BUF=`${CPP} ${PETSC_CPPFLAGS} ${PETSC_CC_INCLUDES} $${TESTDIR}/mpitest.c |grep 'mpi\.h' | ( head -1 ; cat > /dev/null )` && \
116d1f8d238SSatish Balay           echo Using mpi.h: $${BUF}; ${RM} -rf $${TESTDIR}; \
117d1f8d238SSatish Balay        fi
1181d2d58a3SSatish Balay	-@echo "-----------------------------------------"
119753a1a87SJed Brown	-@echo "Using libraries: ${PETSC_LIB}"
120753a1a87SJed Brown	-@echo "------------------------------------------"
121753a1a87SJed Brown	-@echo "Using mpiexec: ${MPIEXEC}"
1224e2e1449SJed Brown	-@echo "------------------------------------------"
123d7e70f41SSatish Balay	-@echo "Using MAKEFLAGS: -j$(MAKE_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)"
124753a1a87SJed Brown	-@echo "=========================================="
125753a1a87SJed Brown
126753a1a87SJed Brown#
127d2b3add8SSatish Balay# Build MatLab binaries
128d2b3add8SSatish Balay#
129d2b3add8SSatish Balaymatlabbin:
1304242cbabSBarry Smith	-@if [ "${MATLAB_MEX}" != "" -a "${MATLAB_SOCKET}" != "" -a "${PETSC_SCALAR}" = "real" -a "${PETSC_PRECISION}" = "double" ]; then \
131d2b3add8SSatish Balay          echo "BEGINNING TO COMPILE MATLAB INTERFACE"; \
132d2b3add8SSatish Balay            if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc" ] ; then ${MKDIR}  ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc; fi; \
133d2b3add8SSatish Balay            if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab" ] ; then ${MKDIR}  ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab; fi; \
1340e03b746SBarry Smith            cd src/sys/classes/viewer/impls/socket/matlab && ${OMAKE_SELF} matlabcodes PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR}; \
135d2b3add8SSatish Balay            echo "========================================="; \
136d2b3add8SSatish Balay        fi
137753a1a87SJed Brown#
1380e03b746SBarry Smith# Builds PETSc check examples for a given architecture
139753a1a87SJed Brown#
1400e03b746SBarry Smithcheck_install: check
1410e03b746SBarry Smithcheck:
1420e03b746SBarry Smith	-+@${OMAKE_SELF} 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
1430e03b746SBarry Smithcheckx:
1440e03b746SBarry Smith	-@${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} checkx_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/checkx.log
1450e03b746SBarry Smithcheck_build:
1460e03b746SBarry Smith	-@echo "Running check examples to verify correct installation"
147753a1a87SJed Brown	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
1480e03b746SBarry Smith	+@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy
1490e03b746SBarry Smith	+@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
15039accc25SStefano Zampini	+@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ] &&  [ "${PETSC_SCALAR}" = "real" ]; then \
1510e03b746SBarry 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_hypre; \
152e5d08945SBarry Smith         fi;
153c0558f20SBarry Smith	+@if [ "${KOKKOS_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ] &&  [ "${PETSC_SCALAR}" = "real" ] && [ "${PETSC_PRECISION}" = "double" ]; then \
154c0558f20SBarry Smith          cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex3_kokkos; \
155c0558f20SBarry Smith         fi;
15645ee4180SJed Brown	+@if [ "${MUMPS_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
1570e03b746SBarry 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; \
158e5d08945SBarry Smith         fi;
15945ee4180SJed Brown	+@if [ "${SUPERLU_DIST_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
1600e03b746SBarry 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; \
161e5d08945SBarry Smith         fi;
162bacf6b6cSBarry Smith	+@if [ "${HDF5_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
163c4762a1bSJed Brown          cd src/vec/vec/tests >/dev/null; \
1640e03b746SBarry Smith          ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy; \
1650e03b746SBarry Smith          ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ex47.PETSc DIFF=${PETSC_DIR}/lib/petsc/bin/petscdiff runex47; \
1660e03b746SBarry Smith          ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy; \
167bacf6b6cSBarry Smith         fi;
1684e4a1d08SBarry Smith	+@if [ "${AMREX_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
1694e4a1d08SBarry Smith           echo "Running testamres examples to verify correct installation";\
1704e4a1d08SBarry Smith           echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}";\
1710e03b746SBarry Smith           cd src/ksp/ksp/tutorials/amrex >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy;\
1720e03b746SBarry Smith           ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testamrex;\
1734e4a1d08SBarry Smith         fi;
17445ee4180SJed Brown	+@if ( [ "${ML_LIB}" != "" ] ||  [ "${TRILINOS_LIB}" != "" ] ) && [ "${PETSC_WITH_BATCH}" = "" ]; then \
1750e03b746SBarry 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; \
176e5d08945SBarry Smith         fi;
1778888e2d2SStefano Zampini	+@if [ "${SUITESPARSE_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
1780e03b746SBarry 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; \
1798888e2d2SStefano Zampini         fi;
1800e03b746SBarry Smith	+@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ex19.rm
18145ee4180SJed Brown	+@if [ "${PETSC4PY}" = "yes" ]; then \
182c4762a1bSJed Brown          cd src/ksp/ksp/tutorials >/dev/null; \
1830e03b746SBarry Smith          ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy; \
1840e03b746SBarry Smith          ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex100; \
1850e03b746SBarry Smith          ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy; \
1865061939cSBarry Smith         fi;
18745ee4180SJed Brown	+@egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \
188cb297985SSatish Balay         if test -s .ftn.log; then \
1890e03b746SBarry Smith          cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; \
190cb297985SSatish Balay         fi; ${RM} .ftn.log;
19169cdbcb9SBarry Smith	+@egrep "^#define PETSC_HAVE_MATLAB_ENGINE 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \
19269cdbcb9SBarry Smith         if test -s .ftn.log; then \
19369cdbcb9SBarry Smith          cd src/vec/vec/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex31; \
19469cdbcb9SBarry Smith         fi; ${RM} .ftn.log;
1950e03b746SBarry Smith	+@cd src/snes/tutorials >/dev/null; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy
196753a1a87SJed Brown	-@echo "Completed test examples"
1970e03b746SBarry Smithcheckx_build:
1980e03b746SBarry Smith	-@echo "Running graphics check example to verify correct X11 installation"
199753a1a87SJed Brown	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
2000e03b746SBarry Smith	@cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy
2010e03b746SBarry Smith	@cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testxex19
2020e03b746SBarry Smith	@cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy
2030e03b746SBarry Smith	-@echo "Completed graphics check example"
2040e03b746SBarry Smithcheck_usermakefile:
205b752486dSSatish Balay	-@echo "Testing compile with user makefile"
206b752486dSSatish Balay	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
207c4762a1bSJed Brown	@cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex19
208b752486dSSatish Balay	@egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \
209b752486dSSatish Balay         if test -s .ftn.log; then \
210c4762a1bSJed Brown          cd src/snes/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex5f; \
211b752486dSSatish Balay         fi; ${RM} .ftn.log;
2120e03b746SBarry Smith	@cd src/snes/tutorials; ${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean-legacy
213b752486dSSatish Balay	-@echo "Completed compile with user makefile"
214753a1a87SJed Brown
2153d33ad60SJunchao Zhang# Compare ABI/API of two versions of PETSc library with the old one defined by PETSC_{DIR,ARCH}_ABI_OLD
2163d33ad60SJunchao Zhangabitest:
217cab5ea25SPierre Jolivet	@if [ "${PETSC_DIR_ABI_OLD}" = "" ] || [ "${PETSC_ARCH_ABI_OLD}" = "" ]; \
2183d33ad60SJunchao Zhang		then printf "You must set environment variables PETSC_DIR_ABI_OLD and PETSC_ARCH_ABI_OLD to run abitest\n"; \
2193d33ad60SJunchao Zhang		exit 1; \
2203d33ad60SJunchao Zhang	fi;
2213d33ad60SJunchao Zhang	-@echo "Comparing ABI/API of the following two PETSc versions (you must have already configured and built them using GCC and with -g):"
2223d33ad60SJunchao Zhang	-@echo "========================================================================================="
2233d33ad60SJunchao Zhang	-@echo "    Old: PETSC_DIR_ABI_OLD  = ${PETSC_DIR_ABI_OLD}"
2243d33ad60SJunchao Zhang	-@echo "         PETSC_ARCH_ABI_OLD = ${PETSC_ARCH_ABI_OLD}"
2257b444a09SBarry Smith	-@pushd ${PETSC_DIR_ABI_OLD} >> /dev/null ; echo "         Branch             = "`git rev-parse --abbrev-ref HEAD`
2263d33ad60SJunchao Zhang	-@echo "    New: PETSC_DIR          = ${PETSC_DIR}"
2273d33ad60SJunchao Zhang	-@echo "         PETSC_ARCH         = ${PETSC_ARCH}"
2287b444a09SBarry Smith	-@echo "         Branch             = "`git rev-parse --abbrev-ref HEAD`
2293d33ad60SJunchao Zhang	-@echo "========================================================================================="
230454c5dfcSJunchao 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
2313d33ad60SJunchao Zhang
2327b444a09SBarry Smith# Compare ABI/API of current PETSC_ARCH/PETSC_DIR with a previous branch
2337b444a09SBarry Smithabitestcomplete:
2347b444a09SBarry Smith	-@if [[ -f "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log" ]]; then \
2357b444a09SBarry 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"` ;\
2367b444a09SBarry Smithecho $${OPTIONS} ;\
2377b444a09SBarry Smith        fi ; \
2387b444a09SBarry Smith        if [[ "${PETSC_DIR_ABI_OLD}" != "" ]]; then \
2397b444a09SBarry Smith          PETSC_DIR_OLD=${PETSC_DIR_ABI_OLD}; \
2407b444a09SBarry Smith        else \
2417b444a09SBarry Smith          PETSC_DIR_OLD=${PETSC_DIR}/../petsc-abi; \
2427b444a09SBarry Smith        fi ; \
2437b444a09SBarry Smith        echo "=================================================================================================" ;\
2447b444a09SBarry Smith        echo "Doing ABI/API comparison between" ${branch} " and " `git rev-parse --abbrev-ref HEAD` "using " $${OPTIONS} ;\
2457b444a09SBarry Smith        echo "=================================================================================================" ;\
2467b444a09SBarry Smith        if [[ ! -d $${PETSC_DIR_OLD} ]]; then \
2477b444a09SBarry Smith          git clone ${PETSC_DIR} $${PETSC_DIR_OLD} ; \
2487b444a09SBarry Smith        else \
2497b444a09SBarry Smith          cd $${PETSC_DIR_OLD} ; \
2507b444a09SBarry Smith          git pull ; \
2517b444a09SBarry Smith        fi ; \
2527b444a09SBarry Smith        cd $${PETSC_DIR_OLD} ; \
2537b444a09SBarry Smith        git checkout ${branch} ; \
2547b444a09SBarry Smith        PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` ./configure $${OPTIONS} ; \
2557b444a09SBarry Smith        PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` make all test ; \
2567b444a09SBarry Smith        cd ${PETSC_DIR} ; \
2577b444a09SBarry Smith        ./configure $${OPTIONS}; \
2587b444a09SBarry Smith        make all test ; \
2597b444a09SBarry Smith        PETSC_DIR_ABI_OLD=$${PETSC_DIR_OLD} PETSC_ARCH_ABI_OLD=arch-branch-`git rev-parse ${branch}` make abitest
2607b444a09SBarry Smith
261753a1a87SJed Brown# Deletes PETSc libraries
262dd8585cdSJed Browndeletelibs:
263753a1a87SJed Brown	-${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.*
264dd8585cdSJed Browndeletemods:
265753a1a87SJed Brown	-${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod
266753a1a87SJed Brown
26758080eacSSatish Balayallclean:
268dc0529c6SBarry Smith	-@${OMAKE} -f gmakefile clean
26959d63732SSatish Balay
27059d63732SSatish Balayclean:: allclean
27159d63732SSatish Balay
27259d63732SSatish Balaydistclean: chk_petscdir
273af0996ceSBarry Smith	@if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then \
274af0996ceSBarry Smith	  echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***"; \
275af0996ceSBarry Smith          mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/; fi
27659d63732SSatish Balay	@echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***"
27759d63732SSatish Balay	-${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/
27859d63732SSatish Balay
27959d63732SSatish Balay
280753a1a87SJed Brown#
281753a1a87SJed Brownreconfigure:
2824d5cfbf7SSatish Balay	@unset MAKEFLAGS && ${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py
283753a1a87SJed Brown#
284753a1a87SJed Browninstall:
2850ee81e68SLisandro Dalcin	@${PYTHON} ./config/install.py -destDir=${DESTDIR}
2860e03b746SBarry Smith	+${OMAKE_SELF} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} mpi4py-install petsc4py-install libmesh-install mfem-install slepc-install hpddm-install amrex-install
287753a1a87SJed Brown
2884198fb66SBarry Smithmpistreams:
2890e03b746SBarry Smith	+@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistreams
2905fabf859SBarry Smith
2914198fb66SBarry Smithmpistream:
2920e03b746SBarry Smith	+@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} mpistream
2934198fb66SBarry Smith
2944198fb66SBarry Smithopenmpstreams:
2950e03b746SBarry Smith	+@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstreams
2964198fb66SBarry Smith
2974198fb66SBarry Smithopenmpstream:
2980e03b746SBarry Smith	+@cd src/benchmarks/streams; ${OMAKE_SELF} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} openmpstream
2994198fb66SBarry Smith
3004198fb66SBarry Smith# for legacy reasons
3014198fb66SBarry Smithstream: mpistream
3024198fb66SBarry Smith
3034198fb66SBarry Smithstreams: mpistreams
304fc5166cbSSatish Balay
305753a1a87SJed Brown# ------------------------------------------------------------------
306753a1a87SJed Brown#
307753a1a87SJed Brown# All remaining actions are intended for PETSc developers only.
308753a1a87SJed Brown# PETSc users should not generally need to use these commands.
309753a1a87SJed Brown#
310753a1a87SJed Brown#  See the users manual for how the tags files may be used from Emacs and Vi/Vim
311753a1a87SJed Brown#
312753a1a87SJed Brownalletags:
313c3a89c15SBarry Smith	-@${PYTHON} lib/petsc/bin/maint/generateetags.py
314753a1a87SJed Brown	-@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
315753a1a87SJed Brown
316*37763f56SJed Brown# obtain gtags from https://www.gnu.org/software/global/
317762ef373SBarry Smithallgtags:
318*37763f56SJed 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 -
319762ef373SBarry Smith
320753a1a87SJed Brownallfortranstubs:
3211b266c99SBarry Smith	-@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir
322c3a89c15SBarry Smith	@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py ${BFORT}  ${VERBOSE}
323c3a89c15SBarry Smith	-@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py -merge  ${VERBOSE}
324a318115bSBarry Smith	-@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir
325753a1a87SJed Browndeletefortranstubs:
326753a1a87SJed Brown	-@find . -type d -name ftn-auto | xargs rm -rf
327753a1a87SJed Brown
328753a1a87SJed Brown# Builds all the documentation - should be done every night
329fb3ce96aSSatish Balayalldoc: allcite allpdf alldoc1 alldoc2 docsetdate
330753a1a87SJed Brown
331f4da3331SVáclav Hapla# Build just citations
332f4da3331SVáclav Haplaallcite: chk_loc deletemanualpages
333c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/countpetsccits.py
3340e03b746SBarry Smith	-${OMAKE_SELF} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
335753a1a87SJed Brown	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
336753a1a87SJed Brown	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
337f4da3331SVáclav Hapla
338f4da3331SVáclav Hapla# Build just PDF manuals + prerequisites
339f4da3331SVáclav Haplaallpdf: chk_loc allcite
3400e03b746SBarry Smith	-cd src/docs/tex/manual; ${OMAKE_SELF} manual.pdf LOC=${LOC}
3410e03b746SBarry Smith	-cd src/docs/tao_tex/manual; ${OMAKE_SELF} manual.pdf LOC=${LOC}
342f4da3331SVáclav Hapla
343f4da3331SVáclav Hapla# Build just manual pages + prerequisites
344f4da3331SVáclav Haplaallmanpages: chk_loc allcite
3450e03b746SBarry Smith	-${OMAKE_SELF} ACTION=manualpages tree_basic LOC=${LOC}
346f4da3331SVáclav Hapla
347f4da3331SVáclav Hapla# Build just manual examples + prerequisites
348f4da3331SVáclav Haplaallmanexamples: chk_loc allmanpages
3490e03b746SBarry Smith	-${OMAKE_SELF} ACTION=manexamples tree_basic LOC=${LOC}
350f4da3331SVáclav Hapla
351f4da3331SVáclav Hapla# Build everything that goes into 'doc' dir except html sources
352f4da3331SVáclav Haplaalldoc1: chk_loc chk_concepts_dir allcite allmanpages allmanexamples
3530e03b746SBarry Smith	-${OMAKE_SELF} manimplementations LOC=${LOC}
354c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/wwwindex.py ${PETSC_DIR} ${LOC}
3550e03b746SBarry Smith	-${OMAKE_SELF} ACTION=getexlist tree_basic LOC=${LOC}
3560e03b746SBarry Smith	-${OMAKE_SELF} ACTION=exampleconcepts tree_basic LOC=${LOC}
357c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/helpindex.py ${PETSC_DIR} ${LOC}
358753a1a87SJed Brown
359753a1a87SJed Brown# Builds .html versions of the source
360753a1a87SJed Brown# html overwrites some stuff created by update-docs - hence this is done later.
361dc907ce5SJose E. Romanalldoc2: chk_loc allcite
3620e03b746SBarry Smith	-${OMAKE_SELF} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
363c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/update-docs.py ${PETSC_DIR} ${LOC}
364753a1a87SJed Brown#
365d9dc08c3SBarry Smith# Makes links for all manual pages in $LOC/docs/manualpages/all
366d9dc08c3SBarry Smithallman:
367d9dc08c3SBarry Smith	@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 \;
368d9dc08c3SBarry Smith
369de86d973SSatish BalayDOCSETDATE_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
370f304b780SSatish Balay
371753a1a87SJed Brown# modify all generated html files and add in version number, date, canonical URL info.
372ad5c76d5SBarry Smithdocsetdate: chk_petscdir
373753a1a87SJed Brown	@echo "Updating generated html files with petsc version, date, canonical URL info";\
374753a1a87SJed Brown        version_release=`grep '^#define PETSC_VERSION_RELEASE ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
375753a1a87SJed Brown        version_major=`grep '^#define PETSC_VERSION_MAJOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
376753a1a87SJed Brown        version_minor=`grep '^#define PETSC_VERSION_MINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
377e4643290SSatish Balay        version_subminor=`grep '^#define PETSC_VERSION_SUBMINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
378753a1a87SJed Brown        if  [ $${version_release} = 0 ]; then \
379cc5a9e26SSatish Balay          petscversion=petsc-master; \
380753a1a87SJed Brown          export petscversion; \
381753a1a87SJed Brown        elif [ $${version_release} = 1 ]; then \
382e4643290SSatish Balay          petscversion=petsc-$${version_major}.$${version_minor}.$${version_subminor}; \
383753a1a87SJed Brown          export petscversion; \
384753a1a87SJed Brown        else \
385753a1a87SJed Brown          echo "Unknown PETSC_VERSION_RELEASE: $${version_release}"; \
386753a1a87SJed Brown          exit; \
387753a1a87SJed Brown        fi; \
3889c5cad75SSatish Balay        datestr=`git log -1 --pretty=format:%ci | cut -d ' ' -f 1`; \
389753a1a87SJed Brown        export datestr; \
3902c3da995SSatish Balay        gitver=`git describe --match "v*"`; \
3913408a366SSatish Balay        export gitver; \
392dc0529c6SBarry Smith        find * -type d -wholename src/docs/website \
393dc0529c6SBarry Smith          -prune -o -type d -wholename src/benchmarks/results \
394dc0529c6SBarry Smith          -prune -o -type d -wholename config/BuildSystem/docs/website \
395dc0529c6SBarry Smith          -prune -o -type d -wholename include/web \
396dc0529c6SBarry Smith          -prune -o -type d -wholename 'arch-*' \
397dc0529c6SBarry Smith          -prune -o -type d -wholename lib/petsc/bin/maint \
398dc0529c6SBarry Smith          -prune -o -type d -wholename externalpackages \
399dc0529c6SBarry Smith          -prune ${DOCSETDATE_PRUNE_LIST} -o -type f -name \*.html \
4003408a366SSatish Balay          -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' {} \; \
401753a1a87SJed Brown          -exec perl -pi -e 's^(<head>)^$$1 <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/{}" />^i' {} \; ; \
402753a1a87SJed Brown        echo "Done fixing version number, date, canonical URL info"
403753a1a87SJed Brown
4040897e0abSPatrick Sanan# Build the Sphinx HTML documentation.  This uses Python's venv, which should
4050897e0abSPatrick Sanan# behave similarly to what happens on e.g. ReadTheDocs. You may prefer to use
4060897e0abSPatrick Sanan# your own Python environment and directly build the Sphinx docs by using
4070897e0abSPatrick Sanan# the makefile in ${PETSC_SPHINX_ROOT}, paying attention to the requirements.txt
4080897e0abSPatrick Sanan# there.
4090897e0abSPatrick SananPETSC_SPHINX_ROOT=src/docs/sphinx_docs
4100897e0abSPatrick SananPETSC_SPHINX_ENV=sphinx_docs_env
4110897e0abSPatrick Sanan
4120897e0abSPatrick Sanansphinx-docs-html:
4130897e0abSPatrick Sanan	@${PYTHON} -c 'import sys; sys.exit(sys.version_info[:2] < (3,3))' || \
4140897e0abSPatrick Sanan    (printf 'Working Python 3.3 or later is required to build the Sphinx docs in a virtual environment\nTry e.g.\n  make sphinx-docs-html PYTHON=python3\n' && false)
4150897e0abSPatrick Sanan	@if [ ! -d  "${PETSC_SPHINX_ENV}" ]; then \
4160897e0abSPatrick Sanan        ${PYTHON} -m venv ${PETSC_SPHINX_ENV}; \
4170897e0abSPatrick Sanan        . ${PETSC_SPHINX_ENV}/bin/activate; \
4180897e0abSPatrick Sanan        pip install -r src/docs/sphinx_docs/requirements.txt; \
4190897e0abSPatrick Sanan      fi
4200897e0abSPatrick Sanan	@. ${PETSC_SPHINX_ENV}/bin/activate && ${OMAKE} -C ${PETSC_SPHINX_ROOT} html
4210897e0abSPatrick Sanan
4220897e0abSPatrick Sanansphinx-docs-clean:
4230897e0abSPatrick Sanan	${OMAKE} -C ${PETSC_SPHINX_ROOT} clean
4240897e0abSPatrick Sanan	${RM} -rf ${PETSC_SPHINX_ENV}
4250897e0abSPatrick Sanan
426753a1a87SJed Brownalldocclean: deletemanualpages allcleanhtml
427753a1a87SJed Brown
428753a1a87SJed Brown# Deletes man pages (HTML version)
429753a1a87SJed Browndeletemanualpages: chk_loc
430753a1a87SJed Brown	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
431753a1a87SJed Brown          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
432753a1a87SJed Brown          ${RM} ${LOC}/docs/exampleconcepts ;\
433753a1a87SJed Brown          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
434c3a89c15SBarry Smith          ${PYTHON} lib/petsc/bin/maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
435753a1a87SJed Brown        fi
436753a1a87SJed Brown
437753a1a87SJed Brownallcleanhtml:
4380e03b746SBarry Smith	-${OMAKE_SELF} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
439753a1a87SJed Brown
440753a1a87SJed Brownchk_concepts_dir: chk_loc
441753a1a87SJed Brown	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
442753a1a87SJed Brown	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
443753a1a87SJed Brown
444753a1a87SJed Brown###########################################################
445753a1a87SJed Brown# targets to build distribution and update docs
446753a1a87SJed Brown###########################################################
447753a1a87SJed Brown
448753a1a87SJed Brown# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
449753a1a87SJed Browndist:
450c3a89c15SBarry Smith	${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} master
451753a1a87SJed Brown
452753a1a87SJed Brown# This target works only if you can do 'ssh petsc@login.mcs.anl.gov'
453753a1a87SJed Brown# also copy the file over to ftp site.
454753a1a87SJed Brownweb-snapshot:
455cc5a9e26SSatish Balay	@if [ ! -f "${HOME}/petsc-master.tar.gz" ]; then \
456cc5a9e26SSatish Balay	    echo "~/petsc-master.tar.gz missing! cannot update petsc-master snapshot on mcs-web-site"; \
457753a1a87SJed Brown	  else \
458cc5a9e26SSatish Balay            echo "updating petsc-master snapshot on mcs-web-site"; \
459753a1a87SJed Brown	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
460cc5a9e26SSatish Balay	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-master.tar.gz; \
461cc5a9e26SSatish Balay	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-master/ \
462cc5a9e26SSatish Balay              petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-master ;\
463cc5a9e26SSatish Balay	    /bin/cp -f /home/petsc/petsc-master.tar.gz /mcs/ftp/pub/petsc/petsc-master.tar.gz;\
464753a1a87SJed Brown	    ${RM} -rf $${tmpdir} ;\
465753a1a87SJed Brown	  fi
466753a1a87SJed Brown
467cc5a9e26SSatish Balay# build the tarfile - and then update petsc-master snapshot on mcs-web-site
468753a1a87SJed Brownupdate-web-snapshot: dist web-snapshot
469753a1a87SJed Brown
470753a1a87SJed Brown# This target updates website main pages
471753a1a87SJed Brownupdate-web:
472753a1a87SJed Brown	@cd ${PETSC_DIR}/src/docs; make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
473753a1a87SJed Brown	/usr/bin/rsync -az -C --exclude=documentation/index.html \
474753a1a87SJed Brown          --exclude=documentation/installation.html --exclude=download/index.html \
475753a1a87SJed Brown	  ${PETSC_DIR}/src/docs/website/ petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc
47692df35d2SSatish Balay	@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
477753a1a87SJed Brown
478753a1a87SJed Brown###########################################################
479753a1a87SJed Brown#
480753a1a87SJed Brown#  See script for details
481753a1a87SJed Brown#
482753a1a87SJed Browngcov:
4839fbb52e5SScott Kruger	-@$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py --run_gcov --petsc_arch ${PETSC_ARCH}
484753a1a87SJed Brown
485753a1a87SJed Brownmergegcov:
486b0e5478fSScott Kruger	-@$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py --merge_gcov --loc=${LOC} --petsc_arch ${PETSC_ARCH}
487b0e5478fSScott Kruger
488753a1a87SJed Brown
4899eed5432SKarl Rupp########################
490235fd6e6SBarry Smith#
4919eed5432SKarl Rupp# Create the include dependency graph (requires graphviz to be available)
4929eed5432SKarl Rupp#
4939eed5432SKarl Ruppincludegraph:
4949eed5432SKarl Rupp	-@${PETSC_DIR}/src/contrib/style/include-graph.sh includegraph.pdf
4959eed5432SKarl Rupp	-@echo Include dependency graph written to includegraph.pdf
496235fd6e6SBarry Smith
497753a1a87SJed Brown#
498753a1a87SJed Brown# -------------------------------------------------------------------------------
499753a1a87SJed Brown#
500753a1a87SJed Brown# Some macros to check if the fortran interface is up-to-date.
501753a1a87SJed Brown#
502753a1a87SJed Browncountfortranfunctions:
503753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
504753a1a87SJed Brown	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
505753a1a87SJed Brown	sed "s/_$$//" | sort > /tmp/countfortranfunctions
506753a1a87SJed Brown
507753a1a87SJed Browncountcfunctions:
508068711b4SBarry Smith	-@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h  | grep "(" | tr -s ' ' | \
509753a1a87SJed Brown	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
510068711b4SBarry Smith	tr 'A-Z' 'a-z' |  sort | uniq > /tmp/countcfunctions
511753a1a87SJed Brown
512753a1a87SJed Browndifffortranfunctions: countfortranfunctions countcfunctions
513753a1a87SJed Brown	-@echo -------------- Functions missing in the fortran interface ---------------------
514753a1a87SJed Brown	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
515753a1a87SJed Brown	-@echo ----------------- Functions missing in the C interface ------------------------
516753a1a87SJed Brown	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
517753a1a87SJed Brown	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
518753a1a87SJed Brown
519753a1a87SJed Browncheckbadfortranstubs:
520753a1a87SJed Brown	-@echo "========================================="
521753a1a87SJed Brown	-@echo "Functions with MPI_Comm as an Argument"
522753a1a87SJed Brown	-@echo "========================================="
523753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
524753a1a87SJed Brown	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
525753a1a87SJed Brown	-@echo "========================================="
526753a1a87SJed Brown	-@echo "Functions with a String as an Argument"
527753a1a87SJed Brown	-@echo "========================================="
528753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
529753a1a87SJed Brown	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
530753a1a87SJed Brown	-@echo "========================================="
531753a1a87SJed Brown	-@echo "Functions with Pointers to PETSc Objects as Argument"
532753a1a87SJed Brown	-@echo "========================================="
533753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; \
534753a1a87SJed Brown	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
535753a1a87SJed Brown	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
536753a1a87SJed Brown	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
537753a1a87SJed Brown	for OBJ in $$_p_OBJ; do \
538753a1a87SJed Brown	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
539753a1a87SJed Brown	cut -d'(' -f1 | cut -d' ' -f1,3; \
540753a1a87SJed Brown	done
541a3269974SBarry Smith
542a3269974SBarry Smithcheckpackagetests:
543a3269974SBarry Smith	-@echo "Missing package tests"
544a3269974SBarry 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
545a3269974SBarry Smith	-@echo "Missing download package tests"
546a3269974SBarry 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
547a3269974SBarry Smith
548dc0529c6SBarry Smith.PHONY: info info_h all deletelibs allclean update \
549753a1a87SJed Brown        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
550dc0529c6SBarry Smith        allhtml allcleanhtml  countfortranfunctions \
551416ff897SSatish Balay        start_configure configure_petsc configure_clean matlabbin install
552