xref: /petsc/makefile (revision 4e2e14493ddd01943e3797b7a4a9301fc71777d6)
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	 = ./
8e5c64ceaSJed BrownDIRS	 = src include tutorials interfaces
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
18af0996ceSBarry Smithinclude ${PETSC_DIR}/lib/petsc/conf/test
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.
28753a1a87SJed Brown# all: builds the c, fortran, and f90 libraries
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
32dd8585cdSJed Brown	+@if [ "${MAKE_IS_GNUMAKE}" != "" ]; then \
33af0996ceSBarry Smith	   ${OMAKE_PRINTDIR} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-gnumake-local 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \
349481793eSSatish Balay	elif [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \
35af0996ceSBarry Smith	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-cmake-local 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log \
36753a1a87SJed Brown		| 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)'; \
37753a1a87SJed Brown	 else \
38af0996ceSBarry Smith	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-legacy-local 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log \
39753a1a87SJed Brown                | ${GREP} -v "has no symbols"; \
40753a1a87SJed Brown	 fi
41af0996ceSBarry 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
42dd8585cdSJed Brown	+@if test -s ${PETSC_ARCH}/lib/petsc/conf/error.log; then \
43af0996ceSBarry Smith           printf ${PETSC_TEXT_HILIGHT}"**************************ERROR*************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \
44af0996ceSBarry Smith           echo "  Error during compile, check ${PETSC_ARCH}/lib/petsc/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log; \
45af0996ceSBarry Smith           echo "  Send it and ${PETSC_ARCH}/lib/petsc/conf/configure.log to petsc-maint@mcs.anl.gov" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\
46af0996ceSBarry Smith           printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log;\
47753a1a87SJed Brown	 else \
48af0996ceSBarry Smith	  ${OMAKE} shared_install PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} 2>&1 | tee -a ${PETSC_ARCH}/lib/petsc/conf/make.log ;\
49753a1a87SJed Brown        fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below
50af0996ceSBarry Smith	@echo "Finishing at: `date`" >> ${PETSC_ARCH}/lib/petsc/conf/make.log
51af0996ceSBarry Smith	@if test -s ${PETSC_ARCH}/lib/petsc/conf/error.log; then exit 1; fi
52753a1a87SJed Brown
539481793eSSatish Balayall-gnumake:
54ac1d0f13SJed Brown	@if [ "${MAKE_IS_GNUMAKE}" != "" ]; then \
55227c2ee5SSatish Balay          ${OMAKE_PRINTDIR}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} PETSC_BUILD_USING_CMAKE="" all;\
569481793eSSatish Balay        else printf ${PETSC_TEXT_HILIGHT}"Build not configured for GNUMAKE. Quiting"${PETSC_TEXT_NORMAL}"\n"; exit 1; fi
579481793eSSatish Balay
584252f254SSatish Balayall-cmake:
594252f254SSatish Balay	@if [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \
60ac1d0f13SJed Brown          ${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} MAKE_IS_GNUMAKE="" all;\
615484e79dSBarry Smith        else printf ${PETSC_TEXT_HILIGHT}"Build not configured for CMAKE. Quiting"${PETSC_TEXT_NORMAL}"\n"; exit 1; fi
62753a1a87SJed Brown
634252f254SSatish Balayall-legacy:
64ac1d0f13SJed Brown	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} PETSC_BUILD_USING_CMAKE="" MAKE_IS_GNUMAKE="" all
659481793eSSatish Balay
66dd8585cdSJed Brownall-gnumake-local: info gnumake matlabbin mpi4py-build petsc4py-build libmesh-build slepc-build
674252f254SSatish Balay
68dd8585cdSJed Brownall-cmake-local: info cmakegen cmake matlabbin mpi4py-build petsc4py-build
694252f254SSatish Balay
70dd8585cdSJed Brownall-legacy-local: chklib_dir info deletelibs deletemods build matlabbin shared_nomesg mpi4py-build petsc4py-build
71fa2665b1SJed Brown
72753a1a87SJed Brown#
73753a1a87SJed Brown# Prints information about the system and version of PETSc being compiled
74753a1a87SJed Brown#
75dd8585cdSJed Browninfo:
76753a1a87SJed Brown	-@echo "=========================================="
77753a1a87SJed Brown	-@echo " "
78753a1a87SJed Brown	-@echo "See documentation/faq.html and documentation/bugreporting.html"
79753a1a87SJed Brown	-@echo "for help with installation problems.  Please send EVERYTHING"
80bc10b077SJed Brown	-@echo "printed out below when reporting problems.  Please check the"
81bc10b077SJed Brown	-@echo "mailing list archives and consider subscribing."
82753a1a87SJed Brown	-@echo " "
83bc10b077SJed Brown	-@echo "  http://www.mcs.anl.gov/petsc/miscellaneous/mailing-lists.html"
84753a1a87SJed Brown	-@echo " "
85753a1a87SJed Brown	-@echo "=========================================="
8644d0de36SSatish Balay	-@echo Starting on `hostname` at `date`
87753a1a87SJed Brown	-@echo Machine characteristics: `uname -a`
88753a1a87SJed Brown	-@echo "-----------------------------------------"
89753a1a87SJed Brown	-@echo "Using PETSc directory: ${PETSC_DIR}"
90753a1a87SJed Brown	-@echo "Using PETSc arch: ${PETSC_ARCH}"
91753a1a87SJed Brown	-@echo "-----------------------------------------"
92753a1a87SJed Brown	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
93753a1a87SJed Brown	-@echo "-----------------------------------------"
94753a1a87SJed Brown	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
95753a1a87SJed Brown	-@echo "Using configuration flags:"
967cab4194SSatish Balay	-@grep "\#define " ${PETSCCONF_H}
97753a1a87SJed Brown	-@echo "-----------------------------------------"
98da0b7683SSatish Balay	-@echo "Using C/C++ compile: ${PETSC_COMPILE}"
99607e78e0SSatish Balay	-@if [ "${PETSC_LANGUAGE}" = "CONLY" -a "${MPICC_SHOW}" != "" ]; then \
100fd0cdb26SSatish Balay             printf  "mpicc -show: %b\n" "${MPICC_SHOW}"; \
101607e78e0SSatish Balay	  elif [ "${PETSC_LANGUAGE}" = "CXXONLY" -a "${MPICXX_SHOW}" != "" ]; then \
102fd0cdb26SSatish Balay             printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \
103607e78e0SSatish Balay          fi;
104753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
105da0b7683SSatish Balay	   echo "Using Fortran compile: ${PETSC_FCOMPILE}";\
106607e78e0SSatish Balay           if [ "${MPIFC_SHOW}" != "" ]; then \
107fd0cdb26SSatish Balay             printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \
108607e78e0SSatish Balay           fi; \
109da0b7683SSatish Balay         fi
110da0b7683SSatish Balay	-@if [ "${CUDAC}" != "" ]; then \
111da0b7683SSatish Balay	   echo "Using CUDA compile: ${PETSC_CUCOMPILE}";\
112753a1a87SJed Brown         fi
113753a1a87SJed Brown	-@echo "-----------------------------------------"
114753a1a87SJed Brown	-@echo "Using C/C++ linker: ${PCC_LINKER}"
115753a1a87SJed Brown	-@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}"
116753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
117753a1a87SJed Brown	   echo "Using Fortran linker: ${FC_LINKER}";\
118753a1a87SJed Brown	   echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\
119753a1a87SJed Brown         fi
120753a1a87SJed Brown	-@echo "-----------------------------------------"
1211d2d58a3SSatish Balay	-@echo "Using system modules: ${LOADEDMODULES}"
122ac8fb971SBarry Smith	-@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 )`
1231d2d58a3SSatish Balay	-@echo "-----------------------------------------"
124753a1a87SJed Brown	-@echo "Using libraries: ${PETSC_LIB}"
125753a1a87SJed Brown	-@echo "------------------------------------------"
126753a1a87SJed Brown	-@echo "Using mpiexec: ${MPIEXEC}"
127*4e2e1449SJed Brown	-@echo "------------------------------------------"
128*4e2e1449SJed Brown	-@echo "Using MAKEFLAGS: -j$(MAKE_NP) $(MAKEFLAGS)"
129753a1a87SJed Brown	-@echo "=========================================="
130753a1a87SJed Brown
131753a1a87SJed Brown#
132753a1a87SJed Brown# Builds the PETSc libraries
133753a1a87SJed Brown# This target also builds fortran77 and f90 interface
134753a1a87SJed Brown# files and compiles .F files
135753a1a87SJed Brown#
136dd8585cdSJed Brownbuild:
137753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
138753a1a87SJed Brown	-@echo "========================================="
139753a1a87SJed Brown	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
140753a1a87SJed Brown	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}  > tmpf 2>&1 ; ${GREP} -v "has no symbols" tmpf; ${RM} tmpf;
141753a1a87SJed Brown	-@echo "Completed building libraries"
142753a1a87SJed Brown	-@echo "========================================="
143753a1a87SJed Brown#
144d2b3add8SSatish Balay# Build MatLab binaries
145d2b3add8SSatish Balay#
146d2b3add8SSatish Balaymatlabbin:
14726e98103SSatish Balay	-@if [ "${MATLAB_MEX}" != "" -a "${PETSC_SCALAR}" = "real" -a "${PETSC_PRECISION}" = "double" ]; then \
148d2b3add8SSatish Balay          echo "BEGINNING TO COMPILE MATLAB INTERFACE"; \
149d2b3add8SSatish Balay            if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc" ] ; then ${MKDIR}  ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc; fi; \
150d2b3add8SSatish Balay            if [ ! -d "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab" ] ; then ${MKDIR}  ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/matlab; fi; \
151d2b3add8SSatish Balay            cd src/sys/classes/viewer/impls/socket/matlab && ${OMAKE} matlabcodes PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR}; \
152d2b3add8SSatish Balay            echo "========================================="; \
153d2b3add8SSatish Balay        fi
154753a1a87SJed Brown#
155753a1a87SJed Brown# Builds PETSc test examples for a given architecture
156753a1a87SJed Brown#
1573cfc63a1SBarry Smithtest_install: test
15856879a31SBarry Smithcheck: test
159753a1a87SJed Browntest:
160de3d9997SSatish Balay	-@${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
1615f6f18d4SSatish Balay	-@if [ "${PETSC_WITH_BATCH}" = "" ]; then \
1625f6f18d4SSatish Balay          printf "=========================================\n"; \
1635f6f18d4SSatish Balay          printf "Now to evaluate the computer systems you plan use - do:\n"; \
164dc32dc79SSatish Balay          printf "make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} streams\n"; \
1655f6f18d4SSatish Balay        fi
166753a1a87SJed Browntestx:
167af0996ceSBarry Smith	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testx_build 2>&1 | tee ./${PETSC_ARCH}/lib/petsc/conf/testx.log
168753a1a87SJed Browntest_build:
169753a1a87SJed Brown	-@echo "Running test examples to verify correct installation"
170753a1a87SJed Brown	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
171227c2ee5SSatish Balay	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
172227c2ee5SSatish Balay	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
173e5d08945SBarry Smith	@if [ "${HYPRE_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
174c3a89c15SBarry 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; \
175e5d08945SBarry Smith         fi;
176e5d08945SBarry Smith	@if [ "${MUMPS_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
177c3a89c15SBarry 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; \
178e5d08945SBarry Smith         fi;
179e5d08945SBarry Smith	@if [ "${SUPERLU_DIST_LIB}" != "" ] && [ "${PETSC_WITH_BATCH}" = "" ]; then \
180c3a89c15SBarry 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; \
181e5d08945SBarry Smith         fi;
182e5d08945SBarry Smith	@if ( [ "${ML_LIB}" != "" ] ||  [ "${TRILINOS_LIB}" != "" ] ) && [ "${PETSC_WITH_BATCH}" = "" ]; then \
183c3a89c15SBarry 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; \
184e5d08945SBarry Smith         fi;
185e5d08945SBarry Smith	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ex19.rm
1865061939cSBarry Smith	@if [ "${PETSC4PY}" = "yes" ]; then \
1879c049d36SBarry Smith          cd src/ksp/ksp/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex100; \
1885061939cSBarry Smith         fi;
1897cab4194SSatish Balay	@egrep "^#define PETSC_HAVE_FORTRAN 1" ${PETSCCONF_H} | tee .ftn.log > /dev/null; \
190cb297985SSatish Balay         if test -s .ftn.log; then \
191cb297985SSatish Balay          cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; \
192cb297985SSatish Balay         fi; ${RM} .ftn.log;
193227c2ee5SSatish Balay	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
194753a1a87SJed Brown	-@echo "Completed test examples"
195753a1a87SJed Browntestx_build:
196753a1a87SJed Brown	-@echo "Running graphics test example to verify correct X11 installation"
197753a1a87SJed Brown	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
198227c2ee5SSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
199227c2ee5SSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testxex19
200227c2ee5SSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
201753a1a87SJed Brown	-@echo "Completed graphics test example"
202753a1a87SJed Brown
203753a1a87SJed Browntestexamples: info
204753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
205753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
206753a1a87SJed Brown	-@echo "machines some of the numbers may not match exactly."
207753a1a87SJed Brown	-@echo "========================================="
208753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C  tree
209753a1a87SJed Brown	-@echo "Completed compiling and running test examples"
210753a1a87SJed Brown	-@echo "========================================="
211753a1a87SJed Browntestfortran: info
212753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
213753a1a87SJed Brown	-@echo "========================================="
214753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
215753a1a87SJed Brown	-@echo "machines or the way Fortran formats numbers"
216753a1a87SJed Brown	-@echo "some of the results may not match exactly."
217753a1a87SJed Brown	-@echo "========================================="
218753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
219753a1a87SJed Brown            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran tree; \
220753a1a87SJed Brown            echo "Completed compiling and running Fortran test examples"; \
221753a1a87SJed Brown          else \
222753a1a87SJed Brown            echo "Error: No FORTRAN compiler available"; \
223753a1a87SJed Brown          fi
224753a1a87SJed Brown	-@echo "========================================="
225753a1a87SJed Browntestexamples_uni: info
226753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
227753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
228753a1a87SJed Brown	-@echo "machines some of the numbers may not match exactly."
229753a1a87SJed Brown	-@echo "========================================="
230753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C_X_MPIUni  tree
231753a1a87SJed Brown	-@echo "Completed compiling and running uniprocessor test examples"
232753a1a87SJed Brown	-@echo "========================================="
233753a1a87SJed Browntestfortran_uni: info
234753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
235753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
236753a1a87SJed Brown	-@echo "machines some of the numbers may not match exactly."
237753a1a87SJed Brown	-@echo "========================================="
238753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
239753a1a87SJed Brown            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran_MPIUni  tree; \
240753a1a87SJed Brown            echo "Completed compiling and running uniprocessor fortran test examples"; \
241753a1a87SJed Brown          else \
242753a1a87SJed Brown            echo "Error: No FORTRAN compiler available"; \
243753a1a87SJed Brown          fi
244753a1a87SJed Brown	-@
245753a1a87SJed Brown	-@echo "========================================="
246753a1a87SJed Brown
247753a1a87SJed Brown# Ranlib on the libraries
248753a1a87SJed Brownranlib:
249753a1a87SJed Brown	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
250753a1a87SJed Brown
251753a1a87SJed Brown# Deletes PETSc libraries
252dd8585cdSJed Browndeletelibs:
253753a1a87SJed Brown	-${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.*
254dd8585cdSJed Browndeletemods:
255753a1a87SJed Brown	-${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod
256753a1a87SJed Brown
257753a1a87SJed Brown# Cleans up build
25858080eacSSatish Balayallclean-legacy: deletelibs deletemods
25959d63732SSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean-legacy tree
26058080eacSSatish Balayallclean-cmake:
26158080eacSSatish Balay	-@cd ${PETSC_ARCH} && ${OMAKE} clean
26258080eacSSatish Balayallclean-gnumake:
26358080eacSSatish Balay	-@${OMAKE} -f gmakefile clean
26458080eacSSatish Balay
26558080eacSSatish Balayallclean:
26658080eacSSatish Balay	@if [ "${MAKE_IS_GNUMAKE}" != "" ]; then \
26758080eacSSatish Balay	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} allclean-gnumake; \
26858080eacSSatish Balay	elif [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \
26958080eacSSatish Balay	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} allclean-cmake; \
27058080eacSSatish Balay	else \
27158080eacSSatish Balay	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} allclean-legacy; \
27258080eacSSatish Balay	fi
27359d63732SSatish Balay
27459d63732SSatish Balayclean:: allclean
27559d63732SSatish Balay
27659d63732SSatish Balaydistclean: chk_petscdir
277af0996ceSBarry Smith	@if [ -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ]; then \
278af0996ceSBarry Smith	  echo "*** Preserving ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py in ${PETSC_DIR} ***"; \
279af0996ceSBarry Smith          mv -f ${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py ${PETSC_DIR}/; fi
28059d63732SSatish Balay	@echo "*** Deleting all build files in ${PETSC_DIR}/${PETSC_ARCH} ***"
28159d63732SSatish Balay	-${RM} -rf ${PETSC_DIR}/${PETSC_ARCH}/
28259d63732SSatish Balay
28359d63732SSatish Balay
284753a1a87SJed Brown#
285753a1a87SJed Brownreconfigure:
286af0996ceSBarry Smith	@${PYTHON} ${PETSC_ARCH}/lib/petsc/conf/reconfigure-${PETSC_ARCH}.py
287753a1a87SJed Brown#
288753a1a87SJed Browninstall:
2890ee81e68SLisandro Dalcin	@${PYTHON} ./config/install.py -destDir=${DESTDIR}
29050a4861cSBarry Smith	${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} mpi4py-install petsc4py-install libmesh-install slepc-install
291753a1a87SJed Brown
292753a1a87SJed Brownnewall:
293753a1a87SJed Brown	-@cd src/sys;  @${PYTHON} ${PETSC_DIR}/config/builder.py
294753a1a87SJed Brown	-@cd src/vec;  @${PYTHON} ${PETSC_DIR}/config/builder.py
295753a1a87SJed Brown	-@cd src/mat;  @${PYTHON} ${PETSC_DIR}/config/builder.py
296753a1a87SJed Brown	-@cd src/dm;   @${PYTHON} ${PETSC_DIR}/config/builder.py
297753a1a87SJed Brown	-@cd src/ksp;  @${PYTHON} ${PETSC_DIR}/config/builder.py
298753a1a87SJed Brown	-@cd src/snes; @${PYTHON} ${PETSC_DIR}/config/builder.py
299753a1a87SJed Brown	-@cd src/ts;   @${PYTHON} ${PETSC_DIR}/config/builder.py
300753a1a87SJed Brown
301753a1a87SJed Brownstreams:
302bfc31b0fSJed Brown	cd src/benchmarks/streams; ${OMAKE} PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} streams
3035fabf859SBarry Smith
3045fabf859SBarry Smithstream:
305bfc31b0fSJed Brown	cd src/benchmarks/streams; ${OMAKE} PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} stream
306753a1a87SJed Brown# ------------------------------------------------------------------
307753a1a87SJed Brown#
308753a1a87SJed Brown# All remaining actions are intended for PETSc developers only.
309753a1a87SJed Brown# PETSc users should not generally need to use these commands.
310753a1a87SJed Brown#
311753a1a87SJed Brown#  See the users manual for how the tags files may be used from Emacs and Vi/Vim
312753a1a87SJed Brown#
313753a1a87SJed Brownalletags:
314c3a89c15SBarry Smith	-@${PYTHON} lib/petsc/bin/maint/generateetags.py
315753a1a87SJed Brown	-@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
316753a1a87SJed Brown
317762ef373SBarry Smith# obtain gtags from http://www.gnu.org/s/global/
318762ef373SBarry Smithallgtags:
319a4ae4b6dSToby 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 -
320762ef373SBarry Smith
321753a1a87SJed Brownallfortranstubs:
3221b266c99SBarry Smith	-@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir
323c3a89c15SBarry Smith	@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py ${BFORT}  ${VERBOSE}
324c3a89c15SBarry Smith	-@${PYTHON} lib/petsc/bin/maint/generatefortranstubs.py -merge  ${VERBOSE}
325a318115bSBarry Smith	-@${RM} -rf ${PETSC_ARCH}/include/petsc/finclude/ftn-auto/*-tmpdir
326753a1a87SJed Browndeletefortranstubs:
327753a1a87SJed Brown	-@find . -type d -name ftn-auto | xargs rm -rf
328753a1a87SJed Browncmakegen:
329753a1a87SJed Brown	-@${PYTHON} config/cmakegen.py
330753a1a87SJed Brown#
331753a1a87SJed Brown# These are here for the target allci and allco, and etags
332753a1a87SJed Brown#
333753a1a87SJed Brown
334bcaeba4dSBarry SmithBMAKEFILES = conf/variables conf/rules conf/test
335c3a89c15SBarry SmithSCRIPTS    = lib/petsc/bin/maint/builddist  lib/petsc/bin/maint/wwwman lib/petsc/bin/maint/xclude lib/petsc/bin/maint/bugReport.py lib/petsc/bin/maint/buildconfigtest lib/petsc/bin/maint/builddistlite \
336c3a89c15SBarry Smith             lib/petsc/bin/maint/buildtest lib/petsc/bin/maint/checkBuilds.py lib/petsc/bin/maint/copylognightly lib/petsc/bin/maint/copylognightly.tao lib/petsc/bin/maint/countfiles lib/petsc/bin/maint/findbadfiles \
337c3a89c15SBarry Smith             lib/petsc/bin/maint/fixinclude lib/petsc/bin/maint/getexlist lib/petsc/bin/maint/getpdflabels.py lib/petsc/bin/maint/helpindex.py lib/petsc/bin/maint/hosts.local lib/petsc/bin/maint/hosts.solaris  \
338c3a89c15SBarry Smith             lib/petsc/bin/maint/lex.py  lib/petsc/bin/maint/mapnameslatex.py lib/petsc/bin/maint/startnightly lib/petsc/bin/maint/startnightly.tao lib/petsc/bin/maint/submitPatch.py \
339c3a89c15SBarry Smith             lib/petsc/bin/maint/update-docs.py  lib/petsc/bin/maint/wwwindex.py lib/petsc/bin/maint/xcludebackup lib/petsc/bin/maint/xcludecblas lib/petsc/bin/maint/zap lib/petsc/bin/maint/zapall \
340753a1a87SJed Brown             config/PETSc/Configure.py config/PETSc/Options.py \
34106e08bc7SBarry Smith             config/PETSc/utilities/*.py
342753a1a87SJed Brown
343753a1a87SJed Brown
344753a1a87SJed Brown# Builds all the documentation - should be done every night
345f4da3331SVáclav Haplaalldoc: allcite allpdf alldoc1 alldoc2 alldoc3 docsetdate
346753a1a87SJed Brown
347f4da3331SVáclav Hapla# Build just citations
348f4da3331SVáclav Haplaallcite: chk_loc deletemanualpages
349c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/countpetsccits.py
350753a1a87SJed Brown	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
351753a1a87SJed Brown	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
352753a1a87SJed Brown	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
353f4da3331SVáclav Hapla
354f4da3331SVáclav Hapla# Build just PDF manuals + prerequisites
355f4da3331SVáclav Haplaallpdf: chk_loc allcite
356753a1a87SJed Brown	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
357753a1a87SJed Brown	-cd src/docs/tex/manual; ${OMAKE} developers.pdf LOC=${LOC}
358f5b986e4SVáclav Hapla	-cd src/docs/tao_tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
359f4da3331SVáclav Hapla
360f4da3331SVáclav Hapla# Build just manual pages + prerequisites
361f4da3331SVáclav Haplaallmanpages: chk_loc allcite
362753a1a87SJed Brown	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
363f4da3331SVáclav Hapla
364f4da3331SVáclav Hapla# Build just manual examples + prerequisites
365f4da3331SVáclav Haplaallmanexamples: chk_loc allmanpages
366753a1a87SJed Brown	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
367f4da3331SVáclav Hapla
368f4da3331SVáclav Hapla# Build everything that goes into 'doc' dir except html sources
369f4da3331SVáclav Haplaalldoc1: chk_loc chk_concepts_dir allcite allmanpages allmanexamples
37021fcc2ddSBarry Smith	-${OMAKE} manimplementations LOC=${LOC}
371c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/wwwindex.py ${PETSC_DIR} ${LOC}
372753a1a87SJed Brown	-${OMAKE} manconcepts LOC=${LOC}
373753a1a87SJed Brown	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
374753a1a87SJed Brown	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
375c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/helpindex.py ${PETSC_DIR} ${LOC}
376753a1a87SJed Brown
377753a1a87SJed Brown# Builds .html versions of the source
378753a1a87SJed Brown# html overwrites some stuff created by update-docs - hence this is done later.
379753a1a87SJed Brownalldoc2: chk_loc
3807070facaSSatish Balay	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
381c3a89c15SBarry Smith	-${PYTHON} lib/petsc/bin/maint/update-docs.py ${PETSC_DIR} ${LOC}
382753a1a87SJed Brown#
383753a1a87SJed Brown# Builds HTML versions of Matlab scripts
384753a1a87SJed Brownalldoc3: chk_loc
385753a1a87SJed Brown	if  [ "${MATLAB_COMMAND}" != "" ]; then\
386502b79f1SSatish Balay          export MATLABPATH=${MATLABPATH}:${PETSC_DIR}/share/petsc/matlab; \
387502b79f1SSatish Balay          cd ${PETSC_DIR}/share/petsc/matlab; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
388753a1a87SJed Brown        fi
389753a1a87SJed Brown
390d9dc08c3SBarry Smith#
391d9dc08c3SBarry Smith# Makes links for all manual pages in $LOC/docs/manualpages/all
392d9dc08c3SBarry Smithallman:
393d9dc08c3SBarry 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 \;
394d9dc08c3SBarry Smith
395de86d973SSatish 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
396f304b780SSatish Balay
397753a1a87SJed Brown# modify all generated html files and add in version number, date, canonical URL info.
398ad5c76d5SBarry Smithdocsetdate: chk_petscdir
399753a1a87SJed Brown	@echo "Updating generated html files with petsc version, date, canonical URL info";\
400753a1a87SJed Brown        version_release=`grep '^#define PETSC_VERSION_RELEASE ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
401753a1a87SJed Brown        version_major=`grep '^#define PETSC_VERSION_MAJOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
402753a1a87SJed Brown        version_minor=`grep '^#define PETSC_VERSION_MINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
403e4643290SSatish Balay        version_subminor=`grep '^#define PETSC_VERSION_SUBMINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
404753a1a87SJed Brown        if  [ $${version_release} = 0 ]; then \
405cc5a9e26SSatish Balay          petscversion=petsc-master; \
406753a1a87SJed Brown          export petscversion; \
407753a1a87SJed Brown        elif [ $${version_release} = 1 ]; then \
408e4643290SSatish Balay          petscversion=petsc-$${version_major}.$${version_minor}.$${version_subminor}; \
409753a1a87SJed Brown          export petscversion; \
410753a1a87SJed Brown        else \
411753a1a87SJed Brown          echo "Unknown PETSC_VERSION_RELEASE: $${version_release}"; \
412753a1a87SJed Brown          exit; \
413753a1a87SJed Brown        fi; \
4149c5cad75SSatish Balay        datestr=`git log -1 --pretty=format:%ci | cut -d ' ' -f 1`; \
415753a1a87SJed Brown        export datestr; \
4162c3da995SSatish Balay        gitver=`git describe --match "v*"`; \
4173408a366SSatish Balay        export gitver; \
418753a1a87SJed Brown        find * -type d -wholename src/docs/website -prune -o -type d -wholename src/benchmarks/results -prune -o \
419e6b20741SSatish Balay          -type d -wholename config/BuildSystem/docs/website -prune -o -type d -wholename include/web -prune -o \
420f304b780SSatish Balay          -type d -wholename 'arch-*' -prune -o -type d -wholename src/tops -prune -o -type d -wholename externalpackages -prune ${DOCSETDATE_PRUNE_LIST} -o \
421536d436eSSatish Balay          -type f -name \*.html \
4223408a366SSatish 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' {} \; \
423753a1a87SJed Brown          -exec perl -pi -e 's^(<head>)^$$1 <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/{}" />^i' {} \; ; \
424753a1a87SJed Brown        echo "Done fixing version number, date, canonical URL info"
425753a1a87SJed Brown
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/manconcepts ;\
434753a1a87SJed Brown          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
435c3a89c15SBarry Smith          ${PYTHON} lib/petsc/bin/maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
436753a1a87SJed Brown        fi
437753a1a87SJed Brown
438753a1a87SJed Brownallcleanhtml:
439753a1a87SJed Brown	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
440753a1a87SJed Brown
441753a1a87SJed Brownchk_concepts_dir: chk_loc
442753a1a87SJed Brown	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
443753a1a87SJed Brown	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
444753a1a87SJed Brown
445753a1a87SJed Brown###########################################################
446753a1a87SJed Brown# targets to build distribution and update docs
447753a1a87SJed Brown###########################################################
448753a1a87SJed Brown
449753a1a87SJed Brown# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
450753a1a87SJed Browndist:
451c3a89c15SBarry Smith	${PETSC_DIR}/lib/petsc/bin/maint/builddist ${PETSC_DIR} master
452753a1a87SJed Brown
453753a1a87SJed Brown# This target works only if you can do 'ssh petsc@login.mcs.anl.gov'
454753a1a87SJed Brown# also copy the file over to ftp site.
455753a1a87SJed Brownweb-snapshot:
456cc5a9e26SSatish Balay	@if [ ! -f "${HOME}/petsc-master.tar.gz" ]; then \
457cc5a9e26SSatish Balay	    echo "~/petsc-master.tar.gz missing! cannot update petsc-master snapshot on mcs-web-site"; \
458753a1a87SJed Brown	  else \
459cc5a9e26SSatish Balay            echo "updating petsc-master snapshot on mcs-web-site"; \
460753a1a87SJed Brown	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
461cc5a9e26SSatish Balay	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-master.tar.gz; \
462cc5a9e26SSatish Balay	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-master/ \
463cc5a9e26SSatish Balay              petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-master ;\
464cc5a9e26SSatish Balay	    /bin/cp -f /home/petsc/petsc-master.tar.gz /mcs/ftp/pub/petsc/petsc-master.tar.gz;\
465753a1a87SJed Brown	    ${RM} -rf $${tmpdir} ;\
466753a1a87SJed Brown	  fi
467753a1a87SJed Brown
468cc5a9e26SSatish Balay# build the tarfile - and then update petsc-master snapshot on mcs-web-site
469753a1a87SJed Brownupdate-web-snapshot: dist web-snapshot
470753a1a87SJed Brown
471753a1a87SJed Brown# This target updates website main pages
472753a1a87SJed Brownupdate-web:
473753a1a87SJed Brown	@cd ${PETSC_DIR}/src/docs; make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
474753a1a87SJed Brown	/usr/bin/rsync -az -C --exclude=documentation/index.html \
475753a1a87SJed Brown          --exclude=documentation/installation.html --exclude=download/index.html \
476753a1a87SJed Brown	  ${PETSC_DIR}/src/docs/website/ petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc
477753a1a87SJed Brown	@cd ${PETSC_DIR}/docs; /usr/bin/rsync -az developers.pdf petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/developers/
47892df35d2SSatish 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
479753a1a87SJed Brown
480753a1a87SJed Brown#
481753a1a87SJed Brown#  builds a single list of files for each PETSc library so they may all be built in parallel
482753a1a87SJed Brown#  without a recursive set of make calls
483753a1a87SJed Browncreatefastbuild:
4842d507118SSatish Balay	cd src/vec; ${RM} -f files; /bin/echo -n "SOURCEC = " > files; make tree ACTION=sourcelist BASE_DIR=${PETSC_DIR}/src/vec
485753a1a87SJed Brown
486753a1a87SJed Brown###########################################################
487753a1a87SJed Brown#
488753a1a87SJed Brown#  See script for details
489753a1a87SJed Brown#
490753a1a87SJed Browngcov:
4914344ef9dSJed Brown	-@$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py -run_gcov
492753a1a87SJed Brown
493753a1a87SJed Brownmergegcov:
4944344ef9dSJed Brown	-@$(PYTHON) ${PETSC_DIR}/lib/petsc/bin/maint/gcov.py -merge_gcov ${LOC} *.tar.gz
495753a1a87SJed Brown
4969eed5432SKarl Rupp########################
497235fd6e6SBarry Smith#
4989eed5432SKarl Rupp# Create the include dependency graph (requires graphviz to be available)
4999eed5432SKarl Rupp#
5009eed5432SKarl Ruppincludegraph:
5019eed5432SKarl Rupp	-@${PETSC_DIR}/src/contrib/style/include-graph.sh includegraph.pdf
5029eed5432SKarl Rupp	-@echo Include dependency graph written to includegraph.pdf
503235fd6e6SBarry Smith
504753a1a87SJed Brown#
505753a1a87SJed Brown# -------------------------------------------------------------------------------
506753a1a87SJed Brown#
507753a1a87SJed Brown# Some macros to check if the fortran interface is up-to-date.
508753a1a87SJed Brown#
509753a1a87SJed Browncountfortranfunctions:
510753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
511753a1a87SJed Brown	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
512753a1a87SJed Brown	sed "s/_$$//" | sort > /tmp/countfortranfunctions
513753a1a87SJed Brown
514753a1a87SJed Browncountcfunctions:
515068711b4SBarry Smith	-@grep PETSC_EXTERN ${PETSC_DIR}/include/*.h  | grep "(" | tr -s ' ' | \
516753a1a87SJed Brown	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
517068711b4SBarry Smith	tr 'A-Z' 'a-z' |  sort | uniq > /tmp/countcfunctions
518753a1a87SJed Brown
519753a1a87SJed Browndifffortranfunctions: countfortranfunctions countcfunctions
520753a1a87SJed Brown	-@echo -------------- Functions missing in the fortran interface ---------------------
521753a1a87SJed Brown	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
522753a1a87SJed Brown	-@echo ----------------- Functions missing in the C interface ------------------------
523753a1a87SJed Brown	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
524753a1a87SJed Brown	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
525753a1a87SJed Brown
526753a1a87SJed Browncheckbadfortranstubs:
527753a1a87SJed Brown	-@echo "========================================="
528753a1a87SJed Brown	-@echo "Functions with MPI_Comm as an Argument"
529753a1a87SJed Brown	-@echo "========================================="
530753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
531753a1a87SJed Brown	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
532753a1a87SJed Brown	-@echo "========================================="
533753a1a87SJed Brown	-@echo "Functions with a String as an Argument"
534753a1a87SJed Brown	-@echo "========================================="
535753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
536753a1a87SJed Brown	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
537753a1a87SJed Brown	-@echo "========================================="
538753a1a87SJed Brown	-@echo "Functions with Pointers to PETSc Objects as Argument"
539753a1a87SJed Brown	-@echo "========================================="
540753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; \
541753a1a87SJed Brown	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
542753a1a87SJed Brown	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
543753a1a87SJed Brown	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
544753a1a87SJed Brown	for OBJ in $$_p_OBJ; do \
545753a1a87SJed Brown	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
546753a1a87SJed Brown	cut -d'(' -f1 | cut -d' ' -f1,3; \
547753a1a87SJed Brown	done
548a3269974SBarry Smith
549a3269974SBarry Smithcheckpackagetests:
550a3269974SBarry Smith	-@echo "Missing package tests"
551a3269974SBarry 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
552a3269974SBarry Smith	-@echo "Missing download package tests"
553a3269974SBarry 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
554a3269974SBarry Smith
555753a1a87SJed Brown#
556753a1a87SJed Brown# Automatically generates PETSc exercises in html from the tutorial examples.
557753a1a87SJed Brown#
5581b266c99SBarry Smith# The introduction for each section is obtained from docs/manualpages-cite/header_${MANSEC} may be edited
559753a1a87SJed Brown#  (used also in introductions to the manual pages)
560753a1a87SJed Brown#
5611b266c99SBarry Smith# DO NOT EDIT the *.htm files generated since they will be automatically replaced.
562753a1a87SJed Brown#
563753a1a87SJed Brown# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
564753a1a87SJed Brown#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
565753a1a87SJed Brown#
566753a1a87SJed Brownexercises:
567753a1a87SJed Brown	-@echo "========================================="
568753a1a87SJed Brown	-@echo "Generating HTML tutorial exercises"
569753a1a87SJed Brown	-@${RM} docs/pageform.txt
570753a1a87SJed Brown	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
571753a1a87SJed Brown	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
572753a1a87SJed Brown	-@echo "access_format=short"                        >> docs/pageform.txt
573753a1a87SJed Brown	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
574753a1a87SJed Brown	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
575753a1a87SJed Brown	-@echo "Generating HTML for individual directories"
576753a1a87SJed Brown	-@echo "========================================="
577753a1a87SJed Brown	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
578753a1a87SJed Brown	-@echo "Completed HTML for individual directories"
579753a1a87SJed Brown	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
580753a1a87SJed Brown	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
581753a1a87SJed Brown	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
582753a1a87SJed Brown	-@echo "========================================="
583753a1a87SJed Brown
584753a1a87SJed Brown.PHONY: info info_h all build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update \
585753a1a87SJed Brown        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
586bcaeba4dSBarry Smith        allhtml allcleanhtml  allci allco allrcslabel countfortranfunctions \
587416ff897SSatish Balay        start_configure configure_petsc configure_clean matlabbin install
588753a1a87SJed Brown
589753a1a87SJed Brownpetscao : petscmat petscao.f90.h
590753a1a87SJed Brownpetscdm : petscksp petscdm.f90.h
591753a1a87SJed Brownpetscdraw : petsc petscdraw.f90.h
592753a1a87SJed Brownpetscis : petsc petscis.f90.h
593753a1a87SJed Brownpetscksp : petscpc  petscksp.f90.h
594753a1a87SJed Brownpetsclog : petsc petsclog.f90.h
595753a1a87SJed Brownpetscmat : petscvec petscmat.f90.h
596753a1a87SJed Brownpetscmg : petscksp petscmg.f90.h
597753a1a87SJed Brownpetscpc : petscmat petscpc.f90.h
598753a1a87SJed Brownpetscsnes : petscksp petscsnes.f90.h
599753a1a87SJed Brownpetscsys : petsc petscsys.f90.h
600753a1a87SJed Brownpetscts : petscsnes petscts.f90.h
601753a1a87SJed Brownpetsc : petsc.f90.h
602753a1a87SJed Brownpetscvec : petscis petscvec.f90.h
603753a1a87SJed Brownpetscviewer : petsc petscviewer.f90.h
604753a1a87SJed Brownpetscmesh : petsc petscmesh.f90.h
605753a1a87SJed Brownmodules : petscao petscdm petscdraw petscis petscksp petsclog petscmat petscmg petscpc petscsnes petscsys petscts petsc petscvec petscviewer petscmesh
606