xref: /petsc/makefile (revision b12e77b2dafe08a3135b110b3db60a43ac3be1c7)
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 docs/faq.html and docs/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 users mailing list, send mail to "
40	-@echo "majordomo@mcs.anl.gov with the message: "
41	-@echo "subscribe petsc-announce"
42	-@echo " "
43	-@echo "=========================================="
44	-@echo On `date` on `hostname`
45	-@echo Machine characteristics: `uname -a`
46	-@echo "-----------------------------------------"
47	-@echo "Using PETSc directory: ${PETSC_DIR}"
48	-@echo "Using PETSc arch: ${PETSC_ARCH}"
49	-@echo "-----------------------------------------"
50	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
51	-@echo "-----------------------------------------"
52	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
53	-@echo "Using configuration flags:"
54	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
55	-@echo "-----------------------------------------"
56	-@echo "Using include paths: ${PETSC_INCLUDE}"
57	-@echo "------------------------------------------"
58	-@echo "Using C/C++ compiler: ${CC} ${CC_FLAGS} ${COPTFLAGS} ${CFLAGS}"
59	-@echo "C/C++ Compiler version: " `${CCV}`
60	-@if [ "${FC}" != "" ]; then \
61	   echo "Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}";\
62	   echo "Fortran Compiler version: " `${FCV}`;\
63         fi
64	-@echo "-----------------------------------------"
65	-@echo "Using C/C++ linker: ${CC_LINKER}"
66	-@if [ "${FC}" != "" ]; then \
67	   echo "Using Fortran linker: ${FC_LINKER}";\
68         fi
69	-@echo "-----------------------------------------"
70	-@echo "Using libraries: ${PETSC_LIB}"
71	-@echo "------------------------------------------"
72	-@echo "Using mpirun: ${MPIRUN}"
73	-@echo "=========================================="
74#
75#
76MINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
77info_h:
78	-@$(RM) -f ${MINFO} MINFO
79	-@echo  "static const char *petscmachineinfo = \"\__n__\"" >> MINFO
80	-@echo  "\"-----------------------------------------\__n__\"" >> MINFO
81	-@echo  "\"Libraries compiled on `date` on `hostname` \__n__\"" >> MINFO
82	-@echo  "\"Machine characteristics: `uname -a` \__n__\"" >> MINFO
83	-@echo  "\"Using PETSc directory: ${PETSC_DIR}\__n__\"" >> MINFO
84	-@echo  "\"Using PETSc arch: ${PETSC_ARCH}\__n__\"" >> MINFO
85	-@echo  "\"-----------------------------------------\"; " >> MINFO
86	-@echo  "static const char *petsccompilerinfo = \"\__n__\"" >> MINFO
87	-@echo  "\"Using C compiler: ${CC} ${CC_FLAGS} ${COPTFLAGS} ${CFLAGS}\__n__\"" >> MINFO
88	-@echo  "\"Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}\__n__\"" >> MINFO
89	-@echo  "\"-----------------------------------------\"; " >> MINFO
90	-@echo  "static const char *petsccompilerflagsinfo = \"\__n__\"" >> MINFO
91	-@echo  "\"Using include paths: ${PETSC_INCLUDE}\__n__\"" >> MINFO
92	-@echo  "\"------------------------------------------\"; " >> MINFO
93	-@echo  "static const char *petsclinkerinfo = \"\__n__\"" >> MINFO
94	-@echo  "\"Using C linker: ${CLINKER}\__n__\"" >> MINFO
95	-@echo  "\"Using Fortran linker: ${FLINKER}\__n__\"" >> MINFO
96	-@echo  "\"Using libraries: ${PETSC_LIB} \__n__\"" >> MINFO
97	-@echo  "\"------------------------------------------\"; " >> MINFO
98	-@cat MINFO | ${SED} -e 's/\\ /\\\\ /g' | ${SED} -e 's/__n__/n/g' > ${MINFO}
99	-@ if [ -f /usr/bin/cygcheck.exe ]; then /usr/bin/dos2unix ${MINFO} 2> /dev/null; fi
100	-@$(RM) -f MINFO
101
102#
103# Builds the PETSc libraries
104# This target also builds fortran77 and f90 interface
105# files and compiles .F files
106#
107build:
108	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
109	-@echo "========================================="
110	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
111	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
112	-@echo "Completed building libraries"
113	-@echo "========================================="
114#
115# Builds the Python wrappers
116python:
117	-@if [ -d "${PETSC_DIR}/src/python/PETSc" ]; then \
118	  echo "COMPILING PYTHON WRAPPERS"; \
119	  echo "========================================="; \
120	  PYTHONPATH=${PYTHONPATH}:${PETSC_DIR}/python/BuildSystem ./make.py --with-petsc-arch=${PETSC_ARCH} --ignoreWarnings 0; \
121	  echo "Completed building Python wrappers"; \
122	  echo "========================================="; \
123	fi
124#
125# Builds PETSc test examples for a given architecture
126#
127test:
128	-@echo "Running test examples to verify correct installation"
129	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
130	@if [ "${FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
131	-@echo "Completed test examples"
132
133testexamples: info
134	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
135	-@echo "Due to different numerical round-off on certain"
136	-@echo "machines some of the numbers may not match exactly."
137	-@echo "========================================="
138	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C  tree
139	-@echo "Completed compiling and running test examples"
140	-@echo "========================================="
141testfortran: info
142	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
143	-@echo "========================================="
144	-@echo "Due to different numerical round-off on certain"
145	-@echo "machines or the way Fortran formats numbers"
146	-@echo "some of the results may not match exactly."
147	-@echo "========================================="
148	-@if [ "${FC}" != "" ]; then \
149            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran tree; \
150            echo "Completed compiling and running Fortran test examples"; \
151          else \
152            echo "Error: No FORTRAN compiler available"; \
153          fi
154	-@echo "========================================="
155testexamples_uni: info
156	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR 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_X11_MPIUni  tree
161	-@echo "Completed compiling and running uniprocessor test examples"
162	-@echo "========================================="
163testfortran_uni: info
164	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
165	-@echo "Due to different numerical round-off on certain"
166	-@echo "machines some of the numbers may not match exactly."
167	-@echo "========================================="
168	-@if [ "${FC}" != "" ]; then \
169            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran_MPIUni  tree; \
170            echo "Completed compiling and running uniprocessor fortran test examples"; \
171          else \
172            echo "Error: No FORTRAN compiler available"; \
173          fi
174	-@
175	-@echo "========================================="
176
177# Ranlib on the libraries
178ranlib:
179	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
180
181# Deletes PETSc libraries
182deletelibs:
183	-${RM} -f ${PETSC_LIB_DIR}/lib*.*
184
185# Cleans up build
186allclean: deletelibs
187	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
188
189
190#
191# Check if PETSC_DIR variable specified is valid
192#
193chk_petsc_dir:
194	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
195	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
196	  echo "You need to use / to separate directories, not \\!"; \
197	  echo "Aborting build"; \
198	  false; fi
199#
200#
201install:
202	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
203	  echo "Install directory is current directory; nothing needs to be done";\
204        else \
205	  echo Installing PETSc at ${INSTALL_DIR};\
206          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
207	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
208          fi;\
209          if [ ! -d ${INSTALL_DIR} ]; then \
210	    ${MKDIR} ${INSTALL_DIR} ; \
211          fi;\
212          cp -fr include ${INSTALL_DIR};\
213          if [ ! -d ${INSTALL_DIR}/bmake ]; then \
214	    ${MKDIR} ${INSTALL_DIR}/bmake ; \
215          fi;\
216          cp -f bmake/adic* bmake/petscconf ${INSTALL_DIR}/bmake ; \
217          cp -fr bmake/common ${INSTALL_DIR}/bmake;\
218          cp -fr bmake/${PETSC_ARCH} ${INSTALL_DIR}/bmake;\
219          cp -fr bin ${INSTALL_DIR};\
220          if [ ! -d ${INSTALL_DIR}/lib ]; then \
221	    ${MKDIR} ${INSTALL_DIR}/lib ; \
222          fi;\
223          if [ -d lib/${PETSC_ARCH} ]; then \
224            cp -fr lib/${PETSC_ARCH} ${INSTALL_DIR}/lib;\
225            ${RANLIB} ${INSTALL_DIR}/lib/${PETSC_ARCH}/*.a ;\
226            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${INSTALL_DIR} shared; \
227          fi;\
228          echo "sh/bash: PETSC_DIR="${INSTALL_DIR}"; export PETSC_DIR";\
229          echo "csh/tcsh: setenv PETSC_DIR "${INSTALL_DIR} ;\
230          echo "Then do make test to verify correct install";\
231        fi;
232
233install_src:
234	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
235	  echo "You did not set a directory to install to";\
236        else \
237	  echo Installing PETSc source at ${INSTALL_DIR};\
238          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
239	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
240          fi;\
241          if [ ! -d ${INSTALL_DIR} ]; then \
242	    ${MKDIR} ${INSTALL_DIR} ; \
243          fi;\
244          cp -fr src ${INSTALL_DIR};\
245        fi;
246
247install_docs:
248	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
249	  echo "You did not set a directory to install to";\
250        else \
251	  echo Installing PETSc documentation at ${INSTALL_DIR};\
252          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
253	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
254          fi;\
255          if [ ! -d ${INSTALL_DIR} ]; then \
256	    ${MKDIR} ${INSTALL_DIR} ; \
257          fi;\
258          cp -fr docs ${INSTALL_DIR};\
259          ${RM} -fr docs/tex;\
260        fi;
261# ------------------------------------------------------------------
262#
263# All remaining actions are intended for PETSc developers only.
264# PETSc users should not generally need to use these commands.
265#
266
267# To access the tags in EMACS, type M-x visit-tags-table and specify
268# the file petsc/TAGS.
269# 1) To move to where a PETSc function is defined, enter M-. and the
270#     function name.
271# 2) To search for a string and move to the first occurrence,
272#     use M-x tags-search and the string.
273#     To locate later occurrences, use M-,
274# Builds all etags files
275alletags:
276	-@maint/generateetags.py
277	-@find python -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
278
279allfortranstubs:
280	-@maint/generatefortranstubs.py ${BFORT}
281deletefortranstubs:
282	-@find . -type d -name ftn-auto | xargs rm -rf
283#
284# These are here for the target allci and allco, and etags
285#
286
287BMAKEFILES = bmake/common/base bmake/common/test bmake/adic.init bmake/adicmf.init
288DOCS	   = bmake/readme
289SCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/bugReport.py maint/buildconfigtest maint/builddistlite \
290             maint/buildtest maint/checkBuilds.py maint/copylognightly maint/copylognightly.tao maint/countfiles maint/findbadfiles \
291             maint/fixinclude maint/getexlist maint/getpdflabels.py maint/helpindex.py maint/hosts.local maint/hosts.solaris  \
292             maint/lex.py  maint/mapnameslatex.py maint/startnightly maint/startnightly.tao maint/submitPatch.py \
293             maint/update-docs.py  maint/wwwindex.py maint/xcludebackup maint/xcludecblas maint/zap maint/zapall \
294             python/PETSc/Configure.py python/PETSc/Options.py \
295             python/PETSc/packages/*.py python/PETSc/utilities/*.py
296
297chk_loc:
298	@if [ ${LOC}foo = foo ] ; then \
299	  echo "*********************** ERROR ************************" ; \
300	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
301	  echo "******************************************************";  false; fi
302	@${MKDIR} ${LOC}/docs/manualpages
303
304# Builds all the documentation - should be done every night
305alldoc: alldoc1 alldoc2
306
307# Build everything that goes into 'doc' dir except html sources
308alldoc1: chk_loc deletemanualpages chk_concepts_dir
309	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
310	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
311	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
312	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
313	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
314	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
315	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
316	-${OMAKE} manconcepts LOC=${LOC}
317	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
318	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
319	-maint/helpindex.py ${PETSC_DIR} ${LOC}
320	-grep -h Polymorphic include/*.h | grep -v '#define ' | sed "s?PetscPolymorphic[a-zA-Z]*(??g" | cut -f1 -d"{" > tmppoly
321	-maint/processpoly.py ${PETSC_DIR} ${LOC}
322	-${RM} tmppoly
323
324# Builds .html versions of the source
325# html overwrites some stuff created by update-docs - hence this is done later.
326alldoc2: chk_loc
327	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
328	-maint/update-docs.py ${PETSC_DIR} ${LOC}
329
330alldocclean: deletemanualpages allcleanhtml
331
332# Deletes man pages (HTML version)
333deletemanualpages: chk_loc
334	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
335          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
336          ${RM} ${LOC}/docs/exampleconcepts ;\
337          ${RM} ${LOC}/docs/manconcepts ;\
338          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
339          maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
340        fi
341
342allcleanhtml:
343	-${RM} include/adic/*.h.html
344	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
345
346chk_concepts_dir: chk_loc
347	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
348	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
349
350###########################################################
351# targets to build distribution and update docs
352###########################################################
353
354# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
355dist:
356	${PETSC_DIR}/maint/builddist ${PETSC_DIR} -dev
357
358# This target works only if you can do 'ssh petsc@harley.mcs.anl.gov'
359# also copy the file over to ftp site.
360web-snapshot:
361	@if [ ! -f "${HOME}/petsc-dev.tar.gz" ]; then \
362	    echo "~/petsc-dev.tar.gz missing! cannot update petsc-dev snapshot on www-unix"; \
363	  else \
364            echo "updating petsc-dev snapshot on www-unix"; \
365	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
366	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-dev.tar.gz; \
367	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-dev/ \
368              petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as/snapshots/petsc-dev ;\
369	    /bin/cp -f /home/petsc/petsc-dev.tar.gz /nfs/ftp/pub/petsc/petsc-dev.tar.gz;\
370	    ${RM} -rf $${tmpdir} ;\
371	  fi
372
373# build the tarfile - and then update petsc-dev snapshot on www-unix
374update-web-snapshot: dist web-snapshot
375
376# This target updates website main pages
377update-web:
378	@cd ${PETSC_DIR}/src/docs; make PETSC_ARCH=docsonly PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
379	/usr/bin/rsync -az -C --exclude=BitKeeper --exclude=documentation/installation.html \
380	  ${PETSC_DIR}/src/docs/website/ petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as
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: ${CC} ${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