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