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