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