xref: /petsc/makefile (revision 20f673ea8467a3a5412b008cdc853444b8124529)
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 configuration flags:"
53	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
54	-@echo "-----------------------------------------"
55	-@echo "Using include paths: ${PETSC_INCLUDE}"
56	-@echo "------------------------------------------"
57	-@echo "Using C/C++ compiler: ${CC} ${CC_FLAGS} ${COPTFLAGS} ${CFLAGS}"
58	-@echo "C/C++ Compiler version: " `${CCV}`
59	-@if [ "${FC}" != "" ]; then \
60	   echo "Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}";\
61	   echo "Fortran Compiler version: " `${FCV}`;\
62         fi
63	-@echo "-----------------------------------------"
64	-@echo "Using C/C++ linker: ${CC_LINKER}"
65	-@if [ "${FC}" != "" ]; then \
66	   echo "Using Fortran linker: ${FC_LINKER}";\
67         fi
68	-@echo "-----------------------------------------"
69	-@echo "Using libraries: ${PETSC_LIB}"
70	-@echo "------------------------------------------"
71	-@echo "Using mpirun: ${MPIRUN}"
72	-@echo "=========================================="
73#
74#
75MINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
76info_h:
77	-@$(RM) -f MINFO ${MINFO}
78	-@echo  "static const char *petscmachineinfo = \"  " >> MINFO
79	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
80	-@echo  Machine characteristics: `uname -a` "" >> MINFO
81	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
82	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
83	-@echo  "-----------------------------------------\"; " >> MINFO
84	-@echo  "static const char *petsccompilerinfo = \"  " >> MINFO
85	-@echo  "Using C compiler: ${CC} ${CC_FLAGS} ${COPTFLAGS} ${CFLAGS} " >> MINFO
86	-@echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1 ; true
87	-@echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; true
88	-@echo  "Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}" >> MINFO
89	-@echo  "Fortran Compiler version:" >> MINFO ; ${FCV} >> MINFO 2>&1 ; true
90	-@echo  "-----------------------------------------\"; " >> MINFO
91	-@echo  "static const char *petsccompilerflagsinfo = \"  " >> MINFO
92	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
93	-@echo  "------------------------------------------\"; " >> MINFO
94	-@echo  "static const char *petsclinkerinfo = \"  " >> MINFO
95	-@echo  "Using C linker: ${CLINKER}" >> MINFO
96	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
97	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
98	-@cat MINFO | ${SED} -e 's/\^M//g' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> MINFO_
99	-@cat MINFO_ | ${SED} -e 's/\^M//g'  > /dev/null; foobar=$$?; \
100          if [ "$$foobar" = "0" ]; then \
101	    cat MINFO_ | ${SED} -e 's/\^M//g' > ${MINFO}; \
102          else cat MINFO | ${SED} -e 's/\^M//g' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}; \
103          fi
104	-@$(RM) MINFO 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	  ./make.py --with-petsc-arch=${PETSC_ARCH}; \
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}
285#
286# These are here for the target allci and allco, and etags
287#
288
289BMAKEFILES = bmake/common/base bmake/common/test bmake/adic.init bmake/adicmf.init
290DOCS	   = bmake/readme
291SCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/bugReport.py maint/buildconfigtest maint/builddistlite \
292             maint/buildtest maint/checkBuilds.py maint/copylognightly maint/copylognightly.tao maint/countfiles maint/findbadfiles \
293             maint/fixinclude maint/getexlist maint/getpdflabels.py maint/helpindex.py maint/hosts.local maint/hosts.solaris  \
294             maint/lex.py  maint/mapnameslatex.py maint/startnightly maint/startnightly.tao maint/submitPatch.py \
295             maint/update-docs.py  maint/wwwindex.py maint/xcludebackup maint/xcludecblas maint/zap maint/zapall \
296             python/PETSc/Configure.py python/PETSc/Options.py \
297             python/PETSc/packages/*.py python/PETSc/utilities/*.py
298
299chk_loc:
300	@if [ ${LOC}foo = foo ] ; then \
301	  echo "*********************** ERROR ************************" ; \
302	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
303	  echo "******************************************************";  false; fi
304	@${MKDIR} ${LOC}/docs/manualpages
305
306# Builds all the documentation - should be done every night
307alldoc: alldoc1 alldoc2
308
309# Build everything that goes into 'doc' dir except html sources
310alldoc1: chk_loc deletemanualpages chk_concepts_dir
311	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
312	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
313	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
314	cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
315	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
316	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
317	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
318	-${OMAKE} manconcepts LOC=${LOC}
319	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
320	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
321	-maint/helpindex.py ${PETSC_DIR} ${LOC}
322	-grep -h Polymorphic include/*.h | grep -v '#define ' | sed "s?PetscPolymorphic[a-zA-Z]*(??g" | cut -f1 -d"{" > tmppoly
323	-maint/processpoly.py ${PETSC_DIR} ${LOC}
324	-${RM} tmppoly
325
326# Builds .html versions of the source
327# html overwrites some stuff created by update-docs - hence this is done later.
328alldoc2: chk_loc
329	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
330	-maint/update-docs.py ${PETSC_DIR} ${LOC}
331
332alldocclean: deletemanualpages allcleanhtml
333
334# Deletes man pages (HTML version)
335deletemanualpages: chk_loc
336	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
337          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
338          ${RM} ${LOC}/docs/exampleconcepts ;\
339          ${RM} ${LOC}/docs/manconcepts ;\
340          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
341          maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
342        fi
343
344allcleanhtml:
345	-${RM} include/adic/*.h.html
346	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
347
348chk_concepts_dir: chk_loc
349	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
350	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
351#
352#  makes .lines files for all source code
353#
354allgcov:
355	-@${RM} -rf /tmp/gcov
356	-@mkdir /tmp/gcov
357	-${OMAKE} ACTION=gcov PETSC_DIR=${PETSC_DIR} tree
358
359# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
360allrcslabel:
361	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
362#
363#   The commands below are for generating ADIC versions of the code;
364# they are not currently used.
365#
366alladicignore:
367	-@${RM} ${INSTALL_LIB_DIR}/adicignore
368	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
369
370alladic:
371	-@echo "Beginning to compile ADIC source code in all directories"
372	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
373	-@echo "========================================="
374	-@cd include ; \
375           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
376	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
377	-@cd src/inline ; \
378            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} adic
379
380alladiclib:
381	-@echo "Beginning to compile ADIC libraries in all directories"
382	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
383	-@echo "-----------------------------------------"
384	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
385	-@echo "-----------------------------------------"
386	-@echo "Using configuration flags:"
387	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
388	-@echo "-----------------------------------------"
389	-@echo "Using include paths: ${PETSC_INCLUDE}"
390	-@echo "-----------------------------------------"
391	-@echo "Using PETSc directory: ${PETSC_DIR}"
392	-@echo "Using PETSc arch: ${PETSC_ARCH}"
393	-@echo "========================================="
394	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${AR_LIB_SUFFIX}
395	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
396	-@cd src/adic/src ; \
397            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} lib
398
399# -------------------------------------------------------------------------------
400#
401# Some macros to check if the fortran interface is up-to-date.
402#
403countfortranfunctions:
404	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
405	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
406	sed "s/_$$//" | sort > /tmp/countfortranfunctions
407
408countcfunctions:
409	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
410	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
411	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
412
413difffortranfunctions: countfortranfunctions countcfunctions
414	-@echo -------------- Functions missing in the fortran interface ---------------------
415	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
416	-@echo ----------------- Functions missing in the C interface ------------------------
417	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
418	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
419
420checkbadfortranstubs:
421	-@echo "========================================="
422	-@echo "Functions with MPI_Comm as an Argument"
423	-@echo "========================================="
424	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
425	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
426	-@echo "========================================="
427	-@echo "Functions with a String as an Argument"
428	-@echo "========================================="
429	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
430	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
431	-@echo "========================================="
432	-@echo "Functions with Pointers to PETSc Objects as Argument"
433	-@echo "========================================="
434	-@cd ${PETSC_DIR}/src/fortran/auto; \
435	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
436	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
437	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
438	for OBJ in $$_p_OBJ; do \
439	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
440	cut -d'(' -f1 | cut -d' ' -f1,3; \
441	done
442#
443# Automatically generates PETSc exercises in html from the tutorial examples.
444#
445# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
446#  (used also in introductions to the manual pages)
447# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
448# The list of exercises is from TUTORIALS in each directory's makefile
449#
450# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
451# The pagemaker rule is in the file bmake/common (at the bottom)
452#
453# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
454#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
455#
456exercises:
457	-@echo "========================================="
458	-@echo "Generating HTML tutorial exercises"
459	-@${RM} docs/pageform.txt
460	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
461	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
462	-@echo "access_format=short"                        >> docs/pageform.txt
463	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
464	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
465	-@echo "Generating HTML for individual directories"
466	-@echo "========================================="
467	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
468	-@echo "Completed HTML for individual directories"
469	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
470	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
471	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
472	-@echo "========================================="
473
474# Make a tarball of all the Python code
475#   This is currently used to release to the Teragrid
476petscPython.tgz:
477	@tar cvzf $@ --exclude SCCS --exclude BitKeeper --dereference python/
478	-@scp $@ tg-login2.uc.teragrid.org:./
479
480.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
481        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
482        allhtml allcleanhtml  allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
483        start_configure configure_petsc configure_clean python
484
485