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