xref: /petsc/makefile (revision ede33fe4114a5e3d960b79b0d11d75894956a123)
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
26753a1a87SJed Brown#
27753a1a87SJed Brown# Basic targets to build PETSc libraries.
28dc0529c6SBarry Smith#
29dd8585cdSJed Brownall:
30dd8585cdSJed Brown	+@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} chk_petscdir chk_upgrade | tee ${PETSC_ARCH}/lib/petsc/conf/make.log
31af0996ceSBarry Smith	@ln -sf ${PETSC_ARCH}/lib/petsc/conf/make.log make.log
32dc0529c6SBarry Smith	+@${OMAKE_PRINTDIR} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-local 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;
33af0996ceSBarry 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
34dd8585cdSJed Brown	+@if test -s ${PETSC_ARCH}/lib/petsc/conf/error.log; then \
35af0996ceSBarry Smith           printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \
36af0996ceSBarry Smith           echo "  Error during compile, check ${PETSC_ARCH}/lib/petsc/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \
37af0996ceSBarry 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;\
38af0996ceSBarry Smith           printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\
39*ede33fe4SSatish Balay	 else \
40*ede33fe4SSatish Balay	  ${OMAKE} print_mesg_after_build PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log ;\
41753a1a87SJed Brown        fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below
424dcdf380SSatish Balay	@echo "Finishing make run at `date +'%a, %d %b %Y %H:%M:%S %z'`" >> ${PETSC_ARCH}/lib/petsc/conf/make.log
43af0996ceSBarry Smith	@if test -s ${PETSC_ARCH}/lib/petsc/conf/error.log; then exit 1; fi
44753a1a87SJed Brown
45dc0529c6SBarry Smithall-local: info libs matlabbin mpi4py-build petsc4py-build libmesh-build slepc-build mfem-build
46fa2665b1SJed Brown
47753a1a87SJed Brown#
48753a1a87SJed Brown# Prints information about the system and version of PETSc being compiled
49753a1a87SJed Brown#
50dd8585cdSJed Browninfo:
51753a1a87SJed Brown	-@echo "=========================================="
52753a1a87SJed Brown	-@echo " "
53753a1a87SJed Brown	-@echo "See documentation/faq.html and documentation/bugreporting.html"
54753a1a87SJed Brown	-@echo "for help with installation problems.  Please send EVERYTHING"
55bc10b077SJed Brown	-@echo "printed out below when reporting problems.  Please check the"
56bc10b077SJed Brown	-@echo "mailing list archives and consider subscribing."
57753a1a87SJed Brown	-@echo " "
58bc10b077SJed Brown	-@echo "  http://www.mcs.anl.gov/petsc/miscellaneous/mailing-lists.html"
59753a1a87SJed Brown	-@echo " "
60753a1a87SJed Brown	-@echo "=========================================="
614dcdf380SSatish Balay	-@echo Starting make run on `hostname` at `date +'%a, %d %b %Y %H:%M:%S %z'`
62753a1a87SJed Brown	-@echo Machine characteristics: `uname -a`
63753a1a87SJed Brown	-@echo "-----------------------------------------"
64753a1a87SJed Brown	-@echo "Using PETSc directory: ${PETSC_DIR}"
65753a1a87SJed Brown	-@echo "Using PETSc arch: ${PETSC_ARCH}"
66753a1a87SJed Brown	-@echo "-----------------------------------------"
67753a1a87SJed Brown	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
68753a1a87SJed Brown	-@echo "-----------------------------------------"
69753a1a87SJed Brown	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
70753a1a87SJed Brown	-@echo "Using configuration flags:"
717cab4194SSatish Balay	-@grep "\#define " ${PETSCCONF_H}
72753a1a87SJed Brown	-@echo "-----------------------------------------"
737c934407SBarry Smith	-@echo "Using C compile: ${PETSC_COMPILE}"
747c934407SBarry Smith	-@if [  "${MPICC_SHOW}" != "" ]; then \
75fd0cdb26SSatish Balay             printf  "mpicc -show: %b\n" "${MPICC_SHOW}";\
767c934407SBarry Smith          fi; \
777c934407SBarry Smith          printf  "C compiler version: %b\n" "${C_VERSION}"; \
787c934407SBarry Smith	  if [ "${CXX}" != "" ]; then \
797c934407SBarry Smith	   echo "Using C++ compile: ${PETSC_CXXCOMPILE}";\
807c934407SBarry Smith	    if [ "${MPICXX_SHOW}" != "" ]; then \
81fd0cdb26SSatish Balay               printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \
827c934407SBarry Smith            fi;\
837c934407SBarry Smith            printf  "C++ compiler version: %b\n" "${Cxx_VERSION}"; \
847c934407SBarry Smith          fi
85753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
86da0b7683SSatish Balay	   echo "Using Fortran compile: ${PETSC_FCOMPILE}";\
87607e78e0SSatish Balay           if [ "${MPIFC_SHOW}" != "" ]; then \
88fd0cdb26SSatish Balay             printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \
89607e78e0SSatish Balay           fi; \
907c934407SBarry Smith             printf  "Fortran compiler version: %b\n" "${FC_VERSION}"; \
91da0b7683SSatish Balay         fi
92da0b7683SSatish Balay	-@if [ "${CUDAC}" != "" ]; then \
93da0b7683SSatish Balay	   echo "Using CUDA compile: ${PETSC_CUCOMPILE}";\
94753a1a87SJed Brown         fi
95753a1a87SJed Brown	-@echo "-----------------------------------------"
96753a1a87SJed Brown	-@echo "Using C/C++ linker: ${PCC_LINKER}"
97753a1a87SJed Brown	-@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}"
98753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
99753a1a87SJed Brown	   echo "Using Fortran linker: ${FC_LINKER}";\
100753a1a87SJed Brown	   echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\
101753a1a87SJed Brown         fi
102753a1a87SJed Brown	-@echo "-----------------------------------------"
1031d2d58a3SSatish Balay	-@echo "Using system modules: ${LOADEDMODULES}"
104d1f8d238SSatish Balay	-@if [ "${MPI_IS_MPIUNI}" = "1" ]; then \
105d1f8d238SSatish Balay           echo Using mpi.h: mpiuni; \
106d1f8d238SSatish Balay        else \
107d1f8d238SSatish Balay           TESTDIR=`mktemp -q -d -t petscmpi-XXXXXXXX` && \
10842a47be2SSatish Balay           echo '#include <mpi.h>' > $${TESTDIR}/mpitest.c && \
10942a47be2SSatish Balay           BUF=`${CPP} ${PETSC_CCPPFLAGS} $${TESTDIR}/mpitest.c |grep 'mpi\.h' | ( head -1 ; cat > /dev/null )` && \
110d1f8d238SSatish Balay           echo Using mpi.h: $${BUF}; ${RM} -rf $${TESTDIR}; \
111d1f8d238SSatish Balay        fi
1121d2d58a3SSatish Balay	-@echo "-----------------------------------------"
113753a1a87SJed Brown	-@echo "Using libraries: ${PETSC_LIB}"
114753a1a87SJed Brown	-@echo "------------------------------------------"
115753a1a87SJed Brown	-@echo "Using mpiexec: ${MPIEXEC}"
1164e2e1449SJed Brown	-@echo "------------------------------------------"
117d7e70f41SSatish Balay	-@echo "Using MAKEFLAGS: -j$(MAKE_NP) -l$(MAKE_LOAD) $(MAKEFLAGS)"
118753a1a87SJed Brown	-@echo "=========================================="
119753a1a87SJed Brown
120753a1a87SJed Brown#
121d2b3add8SSatish Balay# Build MatLab binaries
122d2b3add8SSatish Balay#
123d2b3add8SSatish Balaymatlabbin:
1244242cbabSBarry Smith	-@if [ "${MATLAB_MEX}" != "" -a "${MATLAB_SOCKET}" != "" -a "${PETSC_SCALAR}" = "real" -a "${PETSC_PRECISION}" = "double" ]; then \
125d2b3add8SSatish Balay          echo "BEGINNING TO COMPILE MATLAB INTERFACE"; \
126d2b3add8SSatish Balay            if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc" ] ; then ${MKDIR}  ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc; fi; \
127d2b3add8SSatish Balay            if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab" ] ; then ${MKDIR}  ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab; fi; \
128d2b3add8SSatish Balay            cd src/sys/classes/viewer/impls/socket/matlab && ${OMAKE} matlabcodes PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR}; \
129d2b3add8SSatish Balay            echo "========================================="; \
130d2b3add8SSatish Balay        fi
131753a1a87SJed Brown#
132753a1a87SJed Brown# Builds PETSc test examples for a given architecture
133753a1a87SJed Brown#
1343cfc63a1SBarry Smithtest_install: test
13556879a31SBarry Smithcheck: test
136753a1a87SJed Browntest:
13745ee4180SJed Brown	-+@${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
138753a1a87SJed Browntestx:
139af0996ceSBarry Smith	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testx_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/testx.log
140753a1a87SJed Browntest_build:
141753a1a87SJed Brown	-@echo "Running test examples to verify correct installation"
142753a1a87SJed Brown	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
14345ee4180SJed Brown	+@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
14445ee4180SJed Brown	+@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
14545ee4180SJed Brown	+@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
146c3a89c15SBarry Smith          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; \
147e5d08945SBarry Smith         fi;
14845ee4180SJed Brown	+@if [ "${MUMPS_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
149c3a89c15SBarry Smith          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; \
150e5d08945SBarry Smith         fi;
15145ee4180SJed Brown	+@if [ "${SUPERLU_DIST_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
152c3a89c15SBarry Smith          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; \
153e5d08945SBarry Smith         fi;
15445ee4180SJed Brown	+@if ( [ "${ML_LIB}" != "" ] ||  [ "${TRILINOS_LIB}" != "" ] ) && [ "${PETSC_WITH_BATCH}" = "" ]; then \
155c3a89c15SBarry Smith          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; \
156e5d08945SBarry Smith         fi;
15745ee4180SJed Brown	+@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ex19.rm
15845ee4180SJed Brown	+@if [ "${PETSC4PY}" = "yes" ]; then \
159b39f6a28SSatish Balay          cd src/ksp/ksp/examples/tutorials >/dev/null; \
160b39f6a28SSatish Balay          ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean; \
161b39f6a28SSatish Balay          ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex100; \
162b39f6a28SSatish Balay          ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean; \
1635061939cSBarry Smith         fi;
16445ee4180SJed Brown	+@egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \
165cb297985SSatish Balay         if test -s .ftn.log; then \
166cb297985SSatish Balay          cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; \
167cb297985SSatish Balay         fi; ${RM} .ftn.log;
16845ee4180SJed Brown	+@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
169753a1a87SJed Brown	-@echo "Completed test examples"
170753a1a87SJed Browntestx_build:
171753a1a87SJed Brown	-@echo "Running graphics test example to verify correct X11 installation"
172753a1a87SJed Brown	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
173227c2ee5SSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
174227c2ee5SSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testxex19
175227c2ee5SSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
176753a1a87SJed Brown	-@echo "Completed graphics test example"
177b752486dSSatish Balaytest_usermakefile:
178b752486dSSatish Balay	-@echo "Testing compile with user makefile"
179b752486dSSatish Balay	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
180b752486dSSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex19
181b752486dSSatish Balay	@egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \
182b752486dSSatish Balay         if test -s .ftn.log; then \
183b752486dSSatish Balay          cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} -f ${PETSC_DIR}/share/petsc/Makefile.user ex5f; \
184b752486dSSatish Balay         fi; ${RM} .ftn.log;
185b752486dSSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
186b752486dSSatish Balay	-@echo "Completed compile with user makefile"
187753a1a87SJed Brown
1883d33ad60SJunchao Zhang# Compare ABI/API of two versions of PETSc library with the old one defined by PETSC_{DIR,ARCH}_ABI_OLD
1893d33ad60SJunchao Zhangabitest:
1903d33ad60SJunchao Zhang	@if [ "${PETSC_DIR_ABI_OLD}" == "" ] || [ "${PETSC_ARCH_ABI_OLD}" == "" ]; \
1913d33ad60SJunchao Zhang		then printf "You must set environment variables PETSC_DIR_ABI_OLD and PETSC_ARCH_ABI_OLD to run abitest\n"; \
1923d33ad60SJunchao Zhang		exit 1; \
1933d33ad60SJunchao Zhang	fi;
1943d33ad60SJunchao Zhang	-@echo "Comparing ABI/API of the following two PETSc versions (you must have already configured and built them using GCC and with -g):"
1953d33ad60SJunchao Zhang	-@echo "========================================================================================="
1963d33ad60SJunchao Zhang	-@echo "    Old: PETSC_DIR_ABI_OLD  = ${PETSC_DIR_ABI_OLD}"
1973d33ad60SJunchao Zhang	-@echo "         PETSC_ARCH_ABI_OLD = ${PETSC_ARCH_ABI_OLD}"
1987b444a09SBarry Smith	-@pushd ${PETSC_DIR_ABI_OLD} >> /dev/null ; echo "         Branch             = "`git rev-parse --abbrev-ref HEAD`
1993d33ad60SJunchao Zhang	-@echo "    New: PETSC_DIR          = ${PETSC_DIR}"
2003d33ad60SJunchao Zhang	-@echo "         PETSC_ARCH         = ${PETSC_ARCH}"
2017b444a09SBarry Smith	-@echo "         Branch             = "`git rev-parse --abbrev-ref HEAD`
2023d33ad60SJunchao Zhang	-@echo "========================================================================================="
203454c5dfcSJunchao 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
2043d33ad60SJunchao Zhang
2057b444a09SBarry Smith# Compare ABI/API of current PETSC_ARCH/PETSC_DIR with a previous branch
2067b444a09SBarry Smithabitestcomplete:
2077b444a09SBarry Smith	-@if [[ -f "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/configure.log" ]]; then \
2087b444a09SBarry 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"` ;\
2097b444a09SBarry Smithecho $${OPTIONS} ;\
2107b444a09SBarry Smith        fi ; \
2117b444a09SBarry Smith        if [[ "${PETSC_DIR_ABI_OLD}" != "" ]]; then \
2127b444a09SBarry Smith          PETSC_DIR_OLD=${PETSC_DIR_ABI_OLD}; \
2137b444a09SBarry Smith        else \
2147b444a09SBarry Smith          PETSC_DIR_OLD=${PETSC_DIR}/../petsc-abi; \
2157b444a09SBarry Smith        fi ; \
2167b444a09SBarry Smith        echo "=================================================================================================" ;\
2177b444a09SBarry Smith        echo "Doing ABI/API comparison between" ${branch} " and " `git rev-parse --abbrev-ref HEAD` "using " $${OPTIONS} ;\
2187b444a09SBarry Smith        echo "=================================================================================================" ;\
2197b444a09SBarry Smith        if [[ ! -d $${PETSC_DIR_OLD} ]]; then \
2207b444a09SBarry Smith          git clone ${PETSC_DIR} $${PETSC_DIR_OLD} ; \
2217b444a09SBarry Smith        else \
2227b444a09SBarry Smith          cd $${PETSC_DIR_OLD} ; \
2237b444a09SBarry Smith          git pull ; \
2247b444a09SBarry Smith        fi ; \
2257b444a09SBarry Smith        cd $${PETSC_DIR_OLD} ; \
2267b444a09SBarry Smith        git checkout ${branch} ; \
2277b444a09SBarry Smith        PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` ./configure $${OPTIONS} ; \
2287b444a09SBarry Smith        PETSC_DIR=`pwd` PETSC_ARCH=arch-branch-`git rev-parse ${branch}` make all test ; \
2297b444a09SBarry Smith        cd ${PETSC_DIR} ; \
2307b444a09SBarry Smith        ./configure $${OPTIONS}; \
2317b444a09SBarry Smith        make all test ; \
2327b444a09SBarry Smith        PETSC_DIR_ABI_OLD=$${PETSC_DIR_OLD} PETSC_ARCH_ABI_OLD=arch-branch-`git rev-parse ${branch}` make abitest
2337b444a09SBarry Smith
234753a1a87SJed Brown# Deletes PETSc libraries
235dd8585cdSJed Browndeletelibs:
236753a1a87SJed Brown	-${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.*
237dd8585cdSJed Browndeletemods:
238753a1a87SJed Brown	-${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod
239753a1a87SJed Brown
24058080eacSSatish Balayallclean:
241dc0529c6SBarry Smith	-@${OMAKE} -f gmakefile clean
24259d63732SSatish Balay
24359d63732SSatish Balayclean:: allclean
24459d63732SSatish Balay
24559d63732SSatish Balaydistclean: chk_petscdir
246af0996ceSBarry Smith	@if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then \
247af0996ceSBarry Smith	  echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***"; \
248af0996ceSBarry Smith          mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/; fi
24959d63732SSatish Balay	@echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***"
25059d63732SSatish Balay	-${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/
25159d63732SSatish Balay
25259d63732SSatish Balay
253753a1a87SJed Brown#
254753a1a87SJed Brownreconfigure:
2554d5cfbf7SSatish Balay	@unset MAKEFLAGS && ${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py
256753a1a87SJed Brown#
257753a1a87SJed Browninstall:
2580ee81e68SLisandro Dalcin	@${PYTHON} ./config/install.py -destDir=${DESTDIR}
25995086454SStefano Zampini	+${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} mpi4py-install petsc4py-install libmesh-install slepc-install mfem-install
260753a1a87SJed Brown
261753a1a87SJed Brownstreams:
262fc5166cbSSatish Balay	-@echo "running streams in src/benchmarks/streams"
263fc5166cbSSatish Balay	+@cd src/benchmarks/streams; ${OMAKE} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} streams
2645fabf859SBarry Smith
2655fabf859SBarry Smithstream:
266fc5166cbSSatish Balay	-@echo "running stream in src/benchmarks/streams"
267fc5166cbSSatish Balay	+@cd src/benchmarks/streams; ${OMAKE} PATH="${PETSC_DIR}/${PETSC_ARCH}/lib:${PATH}" PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} stream
268fc5166cbSSatish Balay
269753a1a87SJed Brown# ------------------------------------------------------------------
270753a1a87SJed Brown#
271753a1a87SJed Brown# All remaining actions are intended for PETSc developers only.
272753a1a87SJed Brown# PETSc users should not generally need to use these commands.
273753a1a87SJed Brown#
274753a1a87SJed Brown#  See the users manual for how the tags files may be used from Emacs and Vi/Vim
275753a1a87SJed Brown#
276753a1a87SJed Brownalletags:
277c3a89c15SBarry Smith	-@${PYTHON} lib/petsc/bin/maint/generateetags.py
278753a1a87SJed Brown	-@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
279753a1a87SJed Brown
280762ef373SBarry Smith# obtain gtags from http://www.gnu.org/s/global/
281762ef373SBarry Smithallgtags:
282a4ae4b6dSToby Isaac	-@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 -
283762ef373SBarry Smith
284753a1a87SJed Brownallfortranstubs:
2851b266c99SBarry Smith	-@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir
286c3a89c15SBarry Smith	@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py ${BFORT}  ${VERBOSE}
287c3a89c15SBarry Smith	-@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py -merge  ${VERBOSE}
288a318115bSBarry Smith	-@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir
289753a1a87SJed Browndeletefortranstubs:
290753a1a87SJed Brown	-@find . -type d -name ftn-auto | xargs rm -rf
291753a1a87SJed Brown
292753a1a87SJed Brown# Builds all the documentation - should be done every night
293fb3ce96aSSatish Balayalldoc: allcite allpdf alldoc1 alldoc2 docsetdate
294753a1a87SJed Brown
295f4da3331SVáclav Hapla# Build just citations
296f4da3331SVáclav Haplaallcite: chk_loc deletemanualpages
297c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/countpetsccits.py
298753a1a87SJed Brown	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
299753a1a87SJed Brown	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
300753a1a87SJed Brown	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
301f4da3331SVáclav Hapla
302f4da3331SVáclav Hapla# Build just PDF manuals + prerequisites
303f4da3331SVáclav Haplaallpdf: chk_loc allcite
304753a1a87SJed Brown	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
305753a1a87SJed Brown	-cd src/docs/tex/manual; ${OMAKE} developers.pdf LOC=${LOC}
306f5b986e4SVáclav Hapla	-cd src/docs/tao_tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
307f4da3331SVáclav Hapla
308f4da3331SVáclav Hapla# Build just manual pages + prerequisites
309f4da3331SVáclav Haplaallmanpages: chk_loc allcite
310753a1a87SJed Brown	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
311f4da3331SVáclav Hapla
312f4da3331SVáclav Hapla# Build just manual examples + prerequisites
313f4da3331SVáclav Haplaallmanexamples: chk_loc allmanpages
314753a1a87SJed Brown	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
315f4da3331SVáclav Hapla
316f4da3331SVáclav Hapla# Build everything that goes into 'doc' dir except html sources
317f4da3331SVáclav Haplaalldoc1: chk_loc chk_concepts_dir allcite allmanpages allmanexamples
31821fcc2ddSBarry Smith	-${OMAKE} manimplementations LOC=${LOC}
319c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/wwwindex.py ${PETSC_DIR} ${LOC}
320753a1a87SJed Brown	-${OMAKE} manconcepts LOC=${LOC}
321753a1a87SJed Brown	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
322753a1a87SJed Brown	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
323c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/helpindex.py ${PETSC_DIR} ${LOC}
324753a1a87SJed Brown
325753a1a87SJed Brown# Builds .html versions of the source
326753a1a87SJed Brown# html overwrites some stuff created by update-docs - hence this is done later.
327753a1a87SJed Brownalldoc2: chk_loc
3287070facaSSatish Balay	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
329c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/update-docs.py ${PETSC_DIR} ${LOC}
330753a1a87SJed Brown#
331d9dc08c3SBarry Smith# Makes links for all manual pages in $LOC/docs/manualpages/all
332d9dc08c3SBarry Smithallman:
333d9dc08c3SBarry 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 \;
334d9dc08c3SBarry Smith
335de86d973SSatish 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
336f304b780SSatish Balay
337753a1a87SJed Brown# modify all generated html files and add in version number, date, canonical URL info.
338ad5c76d5SBarry Smithdocsetdate: chk_petscdir
339753a1a87SJed Brown	@echo "Updating generated html files with petsc version, date, canonical URL info";\
340753a1a87SJed Brown        version_release=`grep '^#define PETSC_VERSION_RELEASE ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
341753a1a87SJed Brown        version_major=`grep '^#define PETSC_VERSION_MAJOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
342753a1a87SJed Brown        version_minor=`grep '^#define PETSC_VERSION_MINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
343e4643290SSatish Balay        version_subminor=`grep '^#define PETSC_VERSION_SUBMINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
344753a1a87SJed Brown        if  [ $${version_release} = 0 ]; then \
345cc5a9e26SSatish Balay          petscversion=petsc-master; \
346753a1a87SJed Brown          export petscversion; \
347753a1a87SJed Brown        elif [ $${version_release} = 1 ]; then \
348e4643290SSatish Balay          petscversion=petsc-$${version_major}.$${version_minor}.$${version_subminor}; \
349753a1a87SJed Brown          export petscversion; \
350753a1a87SJed Brown        else \
351753a1a87SJed Brown          echo "Unknown PETSC_VERSION_RELEASE: $${version_release}"; \
352753a1a87SJed Brown          exit; \
353753a1a87SJed Brown        fi; \
3549c5cad75SSatish Balay        datestr=`git log -1 --pretty=format:%ci | cut -d ' ' -f 1`; \
355753a1a87SJed Brown        export datestr; \
3562c3da995SSatish Balay        gitver=`git describe --match "v*"`; \
3573408a366SSatish Balay        export gitver; \
358dc0529c6SBarry Smith        find * -type d -wholename src/docs/website \
359dc0529c6SBarry Smith          -prune -o -type d -wholename src/benchmarks/results \
360dc0529c6SBarry Smith          -prune -o -type d -wholename config/BuildSystem/docs/website \
361dc0529c6SBarry Smith          -prune -o -type d -wholename include/web \
362dc0529c6SBarry Smith          -prune -o -type d -wholename 'arch-*' \
363dc0529c6SBarry Smith          -prune -o -type d -wholename lib/petsc/bin/maint \
364dc0529c6SBarry Smith          -prune -o -type d -wholename externalpackages \
365dc0529c6SBarry Smith          -prune ${DOCSETDATE_PRUNE_LIST} -o -type f -name \*.html \
3663408a366SSatish 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' {} \; \
367753a1a87SJed Brown          -exec perl -pi -e 's^(<head>)^$$1 <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/{}" />^i' {} \; ; \
368753a1a87SJed Brown        echo "Done fixing version number, date, canonical URL info"
369753a1a87SJed Brown
370753a1a87SJed Brownalldocclean: deletemanualpages allcleanhtml
371753a1a87SJed Brown
372753a1a87SJed Brown# Deletes man pages (HTML version)
373753a1a87SJed Browndeletemanualpages: chk_loc
374753a1a87SJed Brown	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
375753a1a87SJed Brown          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
376753a1a87SJed Brown          ${RM} ${LOC}/docs/exampleconcepts ;\
377753a1a87SJed Brown          ${RM} ${LOC}/docs/manconcepts ;\
378753a1a87SJed Brown          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
379c3a89c15SBarry Smith          ${PYTHON} lib/petsc/bin/maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
380753a1a87SJed Brown        fi
381753a1a87SJed Brown
382753a1a87SJed Brownallcleanhtml:
383753a1a87SJed Brown	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
384753a1a87SJed Brown
385753a1a87SJed Brownchk_concepts_dir: chk_loc
386753a1a87SJed Brown	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
387753a1a87SJed Brown	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
388753a1a87SJed Brown
389753a1a87SJed Brown###########################################################
390753a1a87SJed Brown# targets to build distribution and update docs
391753a1a87SJed Brown###########################################################
392753a1a87SJed Brown
393753a1a87SJed Brown# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
394753a1a87SJed Browndist:
395c3a89c15SBarry Smith	${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} master
396753a1a87SJed Brown
397753a1a87SJed Brown# This target works only if you can do 'ssh petsc@login.mcs.anl.gov'
398753a1a87SJed Brown# also copy the file over to ftp site.
399753a1a87SJed Brownweb-snapshot:
400cc5a9e26SSatish Balay	@if [ ! -f "${HOME}/petsc-master.tar.gz" ]; then \
401cc5a9e26SSatish Balay	    echo "~/petsc-master.tar.gz missing! cannot update petsc-master snapshot on mcs-web-site"; \
402753a1a87SJed Brown	  else \
403cc5a9e26SSatish Balay            echo "updating petsc-master snapshot on mcs-web-site"; \
404753a1a87SJed Brown	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
405cc5a9e26SSatish Balay	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-master.tar.gz; \
406cc5a9e26SSatish Balay	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-master/ \
407cc5a9e26SSatish Balay              petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-master ;\
408cc5a9e26SSatish Balay	    /bin/cp -f /home/petsc/petsc-master.tar.gz /mcs/ftp/pub/petsc/petsc-master.tar.gz;\
409753a1a87SJed Brown	    ${RM} -rf $${tmpdir} ;\
410753a1a87SJed Brown	  fi
411753a1a87SJed Brown
412cc5a9e26SSatish Balay# build the tarfile - and then update petsc-master snapshot on mcs-web-site
413753a1a87SJed Brownupdate-web-snapshot: dist web-snapshot
414753a1a87SJed Brown
415753a1a87SJed Brown# This target updates website main pages
416753a1a87SJed Brownupdate-web:
417753a1a87SJed Brown	@cd ${PETSC_DIR}/src/docs; make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
418753a1a87SJed Brown	/usr/bin/rsync -az -C --exclude=documentation/index.html \
419753a1a87SJed Brown          --exclude=documentation/installation.html --exclude=download/index.html \
420753a1a87SJed Brown	  ${PETSC_DIR}/src/docs/website/ petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc
421753a1a87SJed Brown	@cd ${PETSC_DIR}/docs; /usr/bin/rsync -az developers.pdf petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/developers/
42292df35d2SSatish 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
423753a1a87SJed Brown
424753a1a87SJed Brown###########################################################
425753a1a87SJed Brown#
426753a1a87SJed Brown#  See script for details
427753a1a87SJed Brown#
428753a1a87SJed Browngcov:
4294344ef9dSJed Brown	-@$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py -run_gcov
430753a1a87SJed Brown
431753a1a87SJed Brownmergegcov:
4324344ef9dSJed Brown	-@$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py -merge_gcov ${LOC} *.tar.gz
433753a1a87SJed Brown
4349eed5432SKarl Rupp########################
435235fd6e6SBarry Smith#
4369eed5432SKarl Rupp# Create the include dependency graph (requires graphviz to be available)
4379eed5432SKarl Rupp#
4389eed5432SKarl Ruppincludegraph:
4399eed5432SKarl Rupp	-@${PETSC_DIR}/src/contrib/style/include-graph.sh includegraph.pdf
4409eed5432SKarl Rupp	-@echo Include dependency graph written to includegraph.pdf
441235fd6e6SBarry Smith
442753a1a87SJed Brown#
443753a1a87SJed Brown# -------------------------------------------------------------------------------
444753a1a87SJed Brown#
445753a1a87SJed Brown# Some macros to check if the fortran interface is up-to-date.
446753a1a87SJed Brown#
447753a1a87SJed Browncountfortranfunctions:
448753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
449753a1a87SJed Brown	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
450753a1a87SJed Brown	sed "s/_$$//" | sort > /tmp/countfortranfunctions
451753a1a87SJed Brown
452753a1a87SJed Browncountcfunctions:
453068711b4SBarry Smith	-@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h  | grep "(" | tr -s ' ' | \
454753a1a87SJed Brown	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
455068711b4SBarry Smith	tr 'A-Z' 'a-z' |  sort | uniq > /tmp/countcfunctions
456753a1a87SJed Brown
457753a1a87SJed Browndifffortranfunctions: countfortranfunctions countcfunctions
458753a1a87SJed Brown	-@echo -------------- Functions missing in the fortran interface ---------------------
459753a1a87SJed Brown	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
460753a1a87SJed Brown	-@echo ----------------- Functions missing in the C interface ------------------------
461753a1a87SJed Brown	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
462753a1a87SJed Brown	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
463753a1a87SJed Brown
464753a1a87SJed Browncheckbadfortranstubs:
465753a1a87SJed Brown	-@echo "========================================="
466753a1a87SJed Brown	-@echo "Functions with MPI_Comm as an Argument"
467753a1a87SJed Brown	-@echo "========================================="
468753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
469753a1a87SJed Brown	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
470753a1a87SJed Brown	-@echo "========================================="
471753a1a87SJed Brown	-@echo "Functions with a String as an Argument"
472753a1a87SJed Brown	-@echo "========================================="
473753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
474753a1a87SJed Brown	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
475753a1a87SJed Brown	-@echo "========================================="
476753a1a87SJed Brown	-@echo "Functions with Pointers to PETSc Objects as Argument"
477753a1a87SJed Brown	-@echo "========================================="
478753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; \
479753a1a87SJed Brown	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
480753a1a87SJed Brown	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
481753a1a87SJed Brown	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
482753a1a87SJed Brown	for OBJ in $$_p_OBJ; do \
483753a1a87SJed Brown	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
484753a1a87SJed Brown	cut -d'(' -f1 | cut -d' ' -f1,3; \
485753a1a87SJed Brown	done
486a3269974SBarry Smith
487a3269974SBarry Smithcheckpackagetests:
488a3269974SBarry Smith	-@echo "Missing package tests"
489a3269974SBarry 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
490a3269974SBarry Smith	-@echo "Missing download package tests"
491a3269974SBarry 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
492a3269974SBarry Smith
493753a1a87SJed Brown#
494753a1a87SJed Brown# Automatically generates PETSc exercises in html from the tutorial examples.
495753a1a87SJed Brown#
4961b266c99SBarry Smith# The introduction for each section is obtained from docs/manualpages-cite/header_${MANSEC} may be edited
497753a1a87SJed Brown#  (used also in introductions to the manual pages)
498753a1a87SJed Brown#
4991b266c99SBarry Smith# DO NOT EDIT the *.htm files generated since they will be automatically replaced.
500753a1a87SJed Brown#
501753a1a87SJed Brown# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
502753a1a87SJed Brown#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
503753a1a87SJed Brown#
504753a1a87SJed Brownexercises:
505753a1a87SJed Brown	-@echo "========================================="
506753a1a87SJed Brown	-@echo "Generating HTML tutorial exercises"
507753a1a87SJed Brown	-@${RM} docs/pageform.txt
508753a1a87SJed Brown	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
509753a1a87SJed Brown	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
510753a1a87SJed Brown	-@echo "access_format=short"                        >> docs/pageform.txt
511753a1a87SJed Brown	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
512753a1a87SJed Brown	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
513753a1a87SJed Brown	-@echo "Generating HTML for individual directories"
514753a1a87SJed Brown	-@echo "========================================="
515753a1a87SJed Brown	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
516753a1a87SJed Brown	-@echo "Completed HTML for individual directories"
517753a1a87SJed Brown	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
518753a1a87SJed Brown	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
519753a1a87SJed Brown	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
520753a1a87SJed Brown	-@echo "========================================="
521753a1a87SJed Brown
522dc0529c6SBarry Smith.PHONY: info info_h all deletelibs allclean update \
523753a1a87SJed Brown        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
524dc0529c6SBarry Smith        allhtml allcleanhtml  countfortranfunctions \
525416ff897SSatish Balay        start_configure configure_petsc configure_clean matlabbin install
526