xref: /petsc/makefile (revision 107894f0d00392eea4e3b2c6b4603801d6fae008)
1#
2# This is the makefile for compiling PETSc. See
3# http://www.mcs.anl.gov/petsc/petsc-as/documentation/installation.html for directions on installing PETSc.
4# See also bmake/common for additional commands.
5#
6ALL: all
7LOCDIR	 = ./
8DIRS	 = src include
9CFLAGS	 =
10FFLAGS	 =
11
12include ${PETSC_DIR}/bmake/common/base
13include ${PETSC_DIR}/bmake/common/test
14
15#
16# Basic targets to build PETSc libraries.
17# all: builds the c, fortran, and f90 libraries
18all:
19	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  chkpetsc_dir
20	-@${OMAKE} all_build 2>&1 | tee make_log_${PETSC_ARCH}
21	-@egrep -i "( error | error:)" make_log_${PETSC_ARCH} > /dev/null; if [ "$$?" = "0" ]; then \
22           echo "********************************************************************"; \
23           echo "  Error during compile, check make_log_${PETSC_ARCH}"; \
24           echo "  Send it and configure.log to petsc-maint@mcs.anl.gov";\
25           echo "********************************************************************"; \
26           exit 1; fi
27
28all_build: chk_petsc_dir chklib_dir info info_h deletelibs  build shared
29#
30# Prints information about the system and version of PETSc being compiled
31#
32info:
33	-@echo "=========================================="
34	-@echo " "
35	-@echo "See documentation/faq.html and documentation/bugreporting.html"
36	-@echo "for help with installation problems. Please send EVERYTHING"
37	-@echo "printed out below when reporting problems"
38	-@echo " "
39	-@echo "To subscribe to the PETSc announcement list, send mail to "
40	-@echo "majordomo@mcs.anl.gov with the message: "
41	-@echo "subscribe petsc-announce"
42	-@echo " "
43	-@echo "To subscribe to the PETSc users mailing list, send mail to "
44	-@echo "majordomo@mcs.anl.gov with the message: "
45	-@echo "subscribe petsc-users"
46	-@echo " "
47	-@echo "=========================================="
48	-@echo On `date` on `hostname`
49	-@echo Machine characteristics: `uname -a`
50	-@echo "-----------------------------------------"
51	-@echo "Using PETSc directory: ${PETSC_DIR}"
52	-@echo "Using PETSc arch: ${PETSC_ARCH}"
53	-@echo "-----------------------------------------"
54	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
55	-@echo "-----------------------------------------"
56	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
57	-@echo "Using configuration flags:"
58	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
59	-@echo "-----------------------------------------"
60	-@echo "Using include paths: ${PETSC_INCLUDE}"
61	-@echo "------------------------------------------"
62	-@echo "Using C/C++ compiler: ${PCC} ${PCC_FLAGS} ${COPTFLAGS} ${CFLAGS}"
63	-@echo "C/C++ Compiler version: " `${CCV}`
64	-@if [ "${FC}" != "" ]; then \
65	   echo "Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}";\
66	   echo "Fortran Compiler version: " `${FCV}`;\
67         fi
68	-@echo "-----------------------------------------"
69	-@echo "Using C/C++ linker: ${CC_LINKER}"
70	-@if [ "${FC}" != "" ]; then \
71	   echo "Using Fortran linker: ${FC_LINKER}";\
72         fi
73	-@echo "-----------------------------------------"
74	-@echo "Using libraries: ${PETSC_LIB}"
75	-@echo "------------------------------------------"
76	-@echo "Using mpirun: ${MPIRUN}"
77	-@echo "=========================================="
78#
79#
80MINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
81info_h:
82	-@$(RM) -f ${MINFO} MINFO
83	-@echo  "static const char *petscmachineinfo = \"\__n__\"" >> MINFO
84	-@echo  "\"-----------------------------------------\__n__\"" >> MINFO
85	-@echo  "\"Libraries compiled on `date` on `hostname` \__n__\"" >> MINFO
86	-@echo  "\"Machine characteristics: `uname -a` \__n__\"" >> MINFO
87	-@echo  "\"Using PETSc directory: ${PETSC_DIR}\__n__\"" >> MINFO
88	-@echo  "\"Using PETSc arch: ${PETSC_ARCH}\__n__\"" >> MINFO
89	-@echo  "\"-----------------------------------------\"; " >> MINFO
90	-@echo  "static const char *petsccompilerinfo = \"\__n__\"" >> MINFO
91	-@echo  "\"Using C compiler: ${PCC} ${PCC_FLAGS} ${COPTFLAGS} ${CFLAGS}\__n__\"" >> MINFO
92	-@echo  "\"Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}\__n__\"" >> MINFO
93	-@echo  "\"-----------------------------------------\"; " >> MINFO
94	-@echo  "static const char *petsccompilerflagsinfo = \"\__n__\"" >> MINFO
95	-@echo  "\"Using include paths: ${PETSC_INCLUDE}\__n__\"" >> MINFO
96	-@echo  "\"------------------------------------------\"; " >> MINFO
97	-@echo  "static const char *petsclinkerinfo = \"\__n__\"" >> MINFO
98	-@echo  "\"Using C linker: ${CLINKER}\__n__\"" >> MINFO
99	-@echo  "\"Using Fortran linker: ${FLINKER}\__n__\"" >> MINFO
100	-@echo  "\"Using libraries: ${PETSC_LIB} \__n__\"" >> MINFO
101	-@echo  "\"------------------------------------------\"; " >> MINFO
102	-@cat MINFO | ${SED} -e 's/\\ /\\\\ /g' | ${SED} -e 's/__n__/n/g' > ${MINFO}
103	-@ if [ -f /usr/bin/cygcheck.exe ]; then /usr/bin/dos2unix ${MINFO} 2> /dev/null; fi
104	-@$(RM) -f MINFO
105
106#
107# Builds the PETSc libraries
108# This target also builds fortran77 and f90 interface
109# files and compiles .F files
110#
111build:
112	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
113	-@echo "========================================="
114	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
115	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
116	-@echo "Completed building libraries"
117	-@echo "========================================="
118#
119# Builds the Python wrappers
120python:
121	-@if [ -d "${PETSC_DIR}/src/python/PETSc" ]; then \
122	  echo "COMPILING PYTHON WRAPPERS"; \
123	  echo "========================================="; \
124	  PYTHONPATH=${PYTHONPATH}:${PETSC_DIR}/python/BuildSystem ./make.py --with-petsc-arch=${PETSC_ARCH} --ignoreWarnings 0; \
125	  echo "Completed building Python wrappers"; \
126	  echo "========================================="; \
127	fi
128#
129# Builds PETSc test examples for a given architecture
130#
131test:
132	-@echo "Running test examples to verify correct installation"
133	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
134	@if [ "${FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
135	-@echo "Completed test examples"
136
137testexamples: info
138	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
139	-@echo "Due to different numerical round-off on certain"
140	-@echo "machines some of the numbers may not match exactly."
141	-@echo "========================================="
142	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C  tree
143	-@echo "Completed compiling and running test examples"
144	-@echo "========================================="
145testfortran: info
146	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
147	-@echo "========================================="
148	-@echo "Due to different numerical round-off on certain"
149	-@echo "machines or the way Fortran formats numbers"
150	-@echo "some of the results may not match exactly."
151	-@echo "========================================="
152	-@if [ "${FC}" != "" ]; then \
153            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran tree; \
154            echo "Completed compiling and running Fortran test examples"; \
155          else \
156            echo "Error: No FORTRAN compiler available"; \
157          fi
158	-@echo "========================================="
159testexamples_uni: info
160	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
161	-@echo "Due to different numerical round-off on certain"
162	-@echo "machines some of the numbers may not match exactly."
163	-@echo "========================================="
164	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C_X11_MPIUni  tree
165	-@echo "Completed compiling and running uniprocessor test examples"
166	-@echo "========================================="
167testfortran_uni: info
168	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
169	-@echo "Due to different numerical round-off on certain"
170	-@echo "machines some of the numbers may not match exactly."
171	-@echo "========================================="
172	-@if [ "${FC}" != "" ]; then \
173            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran_MPIUni  tree; \
174            echo "Completed compiling and running uniprocessor fortran test examples"; \
175          else \
176            echo "Error: No FORTRAN compiler available"; \
177          fi
178	-@
179	-@echo "========================================="
180
181# Ranlib on the libraries
182ranlib:
183	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
184
185# Deletes PETSc libraries
186deletelibs:
187	-${RM} -f ${PETSC_LIB_DIR}/lib*.*
188
189# Cleans up build
190allclean: deletelibs
191	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
192
193
194#
195# Check if PETSC_DIR variable specified is valid
196#
197chk_petsc_dir:
198	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
199	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
200	  echo "You need to use / to separate directories, not \\!"; \
201	  echo "Aborting build"; \
202	  false; fi
203#
204#
205install:
206	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
207	  echo "Install directory is current directory; nothing needs to be done";\
208        else \
209	  echo Installing PETSc at ${INSTALL_DIR};\
210          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
211	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
212          fi;\
213          if [ ! -d ${INSTALL_DIR} ]; then \
214	    ${MKDIR} ${INSTALL_DIR} ; \
215          fi;\
216          cp -fr include ${INSTALL_DIR};\
217          if [ ! -d ${INSTALL_DIR}/bmake ]; then \
218	    ${MKDIR} ${INSTALL_DIR}/bmake ; \
219          fi;\
220          cp -f bmake/adic* bmake/petscconf ${INSTALL_DIR}/bmake ; \
221          cp -fr bmake/common ${INSTALL_DIR}/bmake;\
222          cp -fr bmake/${PETSC_ARCH} ${INSTALL_DIR}/bmake;\
223          cp -fr bin ${INSTALL_DIR};\
224          if [ ! -d ${INSTALL_DIR}/lib ]; then \
225	    ${MKDIR} ${INSTALL_DIR}/lib ; \
226          fi;\
227          if [ -d lib/${PETSC_ARCH} ]; then \
228            cp -fr lib/${PETSC_ARCH} ${INSTALL_DIR}/lib;\
229            ${RANLIB} ${INSTALL_DIR}/lib/${PETSC_ARCH}/*.a ;\
230            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${INSTALL_DIR} shared; \
231          fi;\
232          echo "sh/bash: PETSC_DIR="${INSTALL_DIR}"; export PETSC_DIR";\
233          echo "csh/tcsh: setenv PETSC_DIR "${INSTALL_DIR} ;\
234          echo "Then do make test to verify correct install";\
235        fi;
236
237install_src:
238	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
239	  echo "You did not set a directory to install to";\
240        else \
241	  echo Installing PETSc source at ${INSTALL_DIR};\
242          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
243	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
244          fi;\
245          if [ ! -d ${INSTALL_DIR} ]; then \
246	    ${MKDIR} ${INSTALL_DIR} ; \
247          fi;\
248          cp -fr src ${INSTALL_DIR};\
249        fi;
250
251install_docs:
252	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
253	  echo "You did not set a directory to install to";\
254        else \
255	  echo Installing PETSc documentation at ${INSTALL_DIR};\
256          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
257	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
258          fi;\
259          if [ ! -d ${INSTALL_DIR} ]; then \
260	    ${MKDIR} ${INSTALL_DIR} ; \
261          fi;\
262          cp -fr docs ${INSTALL_DIR};\
263          ${RM} -fr docs/tex;\
264        fi;
265# ------------------------------------------------------------------
266#
267# All remaining actions are intended for PETSc developers only.
268# PETSc users should not generally need to use these commands.
269#
270
271# To access the tags in EMACS, type M-x visit-tags-table and specify
272# the file petsc/TAGS.
273# 1) To move to where a PETSc function is defined, enter M-. and the
274#     function name.
275# 2) To search for a string and move to the first occurrence,
276#     use M-x tags-search and the string.
277#     To locate later occurrences, use M-,
278# Builds all etags files
279alletags:
280	-@maint/generateetags.py
281	-@find python -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
282
283allfortranstubs:
284	-@maint/generatefortranstubs.py ${BFORT}
285deletefortranstubs:
286	-@find . -type d -name ftn-auto | xargs rm -rf
287#
288# These are here for the target allci and allco, and etags
289#
290
291BMAKEFILES = bmake/common/base bmake/common/test bmake/adic.init bmake/adicmf.init
292DOCS	   = bmake/readme
293SCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/bugReport.py maint/buildconfigtest maint/builddistlite \
294             maint/buildtest maint/checkBuilds.py maint/copylognightly maint/copylognightly.tao maint/countfiles maint/findbadfiles \
295             maint/fixinclude maint/getexlist maint/getpdflabels.py maint/helpindex.py maint/hosts.local maint/hosts.solaris  \
296             maint/lex.py  maint/mapnameslatex.py maint/startnightly maint/startnightly.tao maint/submitPatch.py \
297             maint/update-docs.py  maint/wwwindex.py maint/xcludebackup maint/xcludecblas maint/zap maint/zapall \
298             python/PETSc/Configure.py python/PETSc/Options.py \
299             python/PETSc/packages/*.py python/PETSc/utilities/*.py
300
301
302# Builds all the documentation - should be done every night
303alldoc: alldoc1 alldoc2
304
305# Build everything that goes into 'doc' dir except html sources
306alldoc1: chk_loc deletemanualpages chk_concepts_dir
307	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
308	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
309	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
310	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
311	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
312	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
313	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
314	-${OMAKE} manconcepts LOC=${LOC}
315	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
316	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
317	-maint/helpindex.py ${PETSC_DIR} ${LOC}
318	-grep -h Polymorphic include/*.h | grep -v '#define ' | sed "s?PetscPolymorphic[a-zA-Z]*(??g" | cut -f1 -d"{" > tmppoly
319	-maint/processpoly.py ${PETSC_DIR} ${LOC}
320	-${RM} tmppoly
321
322# Builds .html versions of the source
323# html overwrites some stuff created by update-docs - hence this is done later.
324alldoc2: chk_loc
325	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
326	-maint/update-docs.py ${PETSC_DIR} ${LOC}
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          maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
338        fi
339
340allcleanhtml:
341	-${RM} include/adic/*.h.html
342	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
343
344chk_concepts_dir: chk_loc
345	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
346	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
347
348###########################################################
349# targets to build distribution and update docs
350###########################################################
351
352# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
353dist:
354	${PETSC_DIR}/maint/builddist ${PETSC_DIR}
355
356# This target works only if you can do 'ssh petsc@harley.mcs.anl.gov'
357# also copy the file over to ftp site.
358web-snapshot:
359	@if [ ! -f "${HOME}/petsc-dev.tar.gz" ]; then \
360	    echo "~/petsc-dev.tar.gz missing! cannot update petsc-dev snapshot on www-unix"; \
361	  else \
362            echo "updating petsc-dev snapshot on www-unix"; \
363	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
364	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-dev.tar.gz; \
365	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-dev/ \
366              petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as/snapshots/petsc-dev ;\
367	    /bin/cp -f /home/petsc/petsc-dev.tar.gz /nfs/ftp/pub/petsc/petsc-dev.tar.gz;\
368	    ${RM} -rf $${tmpdir} ;\
369	  fi
370
371# build the tarfile - and then update petsc-dev snapshot on www-unix
372update-web-snapshot: dist web-snapshot
373
374# This target updates website main pages
375update-web:
376	@cd ${PETSC_DIR}/src/docs; make PETSC_ARCH=docsonly PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
377	/usr/bin/rsync -az -C --exclude=BitKeeper --exclude=documentation/installation.html \
378	  ${PETSC_DIR}/src/docs/website/ petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as
379	@cd ${PETSC_DIR}/src/docs/tex/manual; make developers.pdf PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} LOC=${PETSC_DIR}; \
380	/usr/bin/rsync -az developers.pdf petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as/developers/
381
382###########################################################
383
384#
385#  makes .lines files for all source code
386#
387allgcov:
388	-@${RM} -rf /tmp/gcov
389	-@mkdir /tmp/gcov
390	-${OMAKE} ACTION=gcov PETSC_DIR=${PETSC_DIR} tree
391
392# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
393allrcslabel:
394	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
395#
396#   The commands below are for generating ADIC versions of the code;
397# they are not currently used.
398#
399alladicignore:
400	-@${RM} ${INSTALL_LIB_DIR}/adicignore
401	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
402
403alladic:
404	-@echo "Beginning to compile ADIC source code in all directories"
405	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
406	-@echo "========================================="
407	-@cd include ; \
408           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
409	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
410	-@cd src/inline ; \
411            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} adic
412
413alladiclib:
414	-@echo "Beginning to compile ADIC libraries in all directories"
415	-@echo "Using compiler: ${PCC} ${COPTFLAGS}"
416	-@echo "-----------------------------------------"
417	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
418	-@echo "-----------------------------------------"
419	-@echo "Using configuration flags:"
420	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
421	-@echo "-----------------------------------------"
422	-@echo "Using include paths: ${PETSC_INCLUDE}"
423	-@echo "-----------------------------------------"
424	-@echo "Using PETSc directory: ${PETSC_DIR}"
425	-@echo "Using PETSc arch: ${PETSC_ARCH}"
426	-@echo "========================================="
427	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${AR_LIB_SUFFIX}
428	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
429	-@cd src/adic/src ; \
430            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} lib
431
432# -------------------------------------------------------------------------------
433#
434# Some macros to check if the fortran interface is up-to-date.
435#
436countfortranfunctions:
437	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
438	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
439	sed "s/_$$//" | sort > /tmp/countfortranfunctions
440
441countcfunctions:
442	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
443	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
444	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
445
446difffortranfunctions: countfortranfunctions countcfunctions
447	-@echo -------------- Functions missing in the fortran interface ---------------------
448	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
449	-@echo ----------------- Functions missing in the C interface ------------------------
450	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
451	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
452
453checkbadfortranstubs:
454	-@echo "========================================="
455	-@echo "Functions with MPI_Comm as an Argument"
456	-@echo "========================================="
457	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
458	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
459	-@echo "========================================="
460	-@echo "Functions with a String as an Argument"
461	-@echo "========================================="
462	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
463	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
464	-@echo "========================================="
465	-@echo "Functions with Pointers to PETSc Objects as Argument"
466	-@echo "========================================="
467	-@cd ${PETSC_DIR}/src/fortran/auto; \
468	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
469	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
470	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
471	for OBJ in $$_p_OBJ; do \
472	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
473	cut -d'(' -f1 | cut -d' ' -f1,3; \
474	done
475#
476# Automatically generates PETSc exercises in html from the tutorial examples.
477#
478# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
479#  (used also in introductions to the manual pages)
480# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
481# The list of exercises is from TUTORIALS in each directory's makefile
482#
483# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
484# The pagemaker rule is in the file bmake/common (at the bottom)
485#
486# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
487#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
488#
489exercises:
490	-@echo "========================================="
491	-@echo "Generating HTML tutorial exercises"
492	-@${RM} docs/pageform.txt
493	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
494	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
495	-@echo "access_format=short"                        >> docs/pageform.txt
496	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
497	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
498	-@echo "Generating HTML for individual directories"
499	-@echo "========================================="
500	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
501	-@echo "Completed HTML for individual directories"
502	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
503	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
504	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
505	-@echo "========================================="
506
507# Make a tarball of all the Python code
508#   This is currently used to release to the Teragrid
509petscPython.tgz:
510	@tar cvzf $@ --exclude SCCS --exclude BitKeeper --dereference python/
511	-@scp $@ tg-login2.uc.teragrid.org:./
512
513.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
514        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
515        allhtml allcleanhtml  allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
516        start_configure configure_petsc configure_clean python
517
518getsigs:
519	-@if [ ! -d src/sigs ]; then mkdir -p sigs; fi
520	-@echo ${PETSC_INCLUDE} > sigs/petsc_include
521	-@echo "#include \"petscvec.h\"" > sigs/vec.sigs.h
522	-@grep -h "enum " include/petscsys.h include/petscvec.h >> sigs/vec.sigs.h
523	-@grep " Vec[a-zA-Z][a-zA-Z]*(Vec," include/petscvec.h | grep EXTERN | grep -v "(\*)" | grep -v IS |grep -v VecType | sed "s/EXTERN PetscErrorCode PETSCVEC_DLLEXPORT//g" >> sigs/vec.sigs.h
524	-@echo "#include \"petscmat.h\"" > sigs/mat.sigs.h
525	-@grep "enum " include/petscmat.h | grep } >> sigs/mat.sigs.h
526	-@grep " Mat[a-zA-Z][a-zA-Z]*(Mat," include/petscmat.h | grep EXTERN | grep -v "(\*)" | grep -v IS |grep -v MatType | sed "s/EXTERN PetscErrorCode PETSCMAT_DLLEXPORT//g" >> sigs/mat.sigs.h
527	-@echo "#include \"petscpc.h\"" > sigs/pc.sigs.h
528	-@grep "enum " include/petscpc.h | grep } >> sigs/pc.sigs.h
529	-@grep " PC[a-zA-Z][a-zA-Z]*(PC," include/petscpc.h | grep EXTERN | grep -v "(\*)" | grep -v "(\*\*)" | grep -v IS |grep -v PCType | sed "s/EXTERN PetscErrorCode PETSCKSP_DLLEXPORT//g" >> sigs/pc.sigs.h
530	-@echo "#include \"petscksp.h\"" > sigs/ksp.sigs.h
531	-@grep "enum " include/petscksp.h | grep } >> sigs/ksp.sigs.h
532	-@grep " KSP[a-zA-Z][a-zA-Z]*(KSP," include/petscksp.h | grep EXTERN | grep -v "(\*)" | grep -v "(\*\*)" | grep -v IS |grep -v KSPType | sed "s/EXTERN PetscErrorCode PETSCKSP_DLLEXPORT//g" >> sigs/ksp.sigs.h
533	-@echo "#include \"petscsnes.h\"" > sigs/snes.sigs.h
534	-@grep " SNES[a-zA-Z][a-zA-Z]*(SNES," include/petscsnes.h | grep EXTERN | grep -v "(\*)" | grep -v "(\*\*)" | grep -v IS |grep -v SNESType | sed "s/EXTERN PetscErrorCode PETSCSNES_DLLEXPORT//g" >> sigs/snes.sigs.h
535
536
537
538
539
540
541
542
543
544
545
546