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