xref: /petsc/makefile (revision f1b97656f5355c1550c55f6f45aadd5df55e69a0)
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
13# next line defines PETSC_DIR and PETSC_ARCH if they are not set
14include ./${PETSC_ARCH}/conf/petscvariables
15include ${PETSC_DIR}/conf/variables
16include ${PETSC_DIR}/conf/rules
17include ${PETSC_DIR}/conf/test
18
19#
20# Basic targets to build PETSc libraries.
21# all: builds the c, fortran, and f90 libraries
22all:
23	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} chkpetsc_dir
24	@if [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \
25           echo "Building PETSc using CMake with ${MAKE_NP} build threads"; \
26	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-cmake; \
27	 else \
28	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-legacy; \
29	 fi
30	-@ln -sf ${PETSC_ARCH}/conf/make.log make.log
31	-@egrep -i "( error | error: |no such file or directory)" ${PETSC_ARCH}/conf/make.log > /dev/null; if [ "$$?" = "0" ]; then \
32           echo "********************************************************************" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
33           echo "  Error during compile, check ${PETSC_ARCH}/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
34           echo "  Send it and ${PETSC_ARCH}/conf/configure.log to petsc-maint@mcs.anl.gov" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log;\
35           echo "********************************************************************" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
36           exit 1; \
37	 else \
38	  ${OMAKE} shared_install PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log ;\
39	 fi
40
41all-cmake:
42	@${OMAKE} -j ${MAKE_NP} -C ${PETSC_DIR}/${PETSC_ARCH} VERBOSE=1 2>&1 | tee ${PETSC_ARCH}/conf/make.log \
43	          | egrep -v '( --check-build-system |cmake -E | -o CMakeFiles/petsc[[:lower:]]*.dir/| -o lib/libpetsc|CMakeFiles/petsc[[:lower:]]*\.dir/(build|depend|requires)|-f CMakeFiles/Makefile2|Dependee .* is newer than depender |provides\.build. is up to date)'
44
45all-legacy:
46	-@${OMAKE} all_build PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} 2>&1  | tee ${PETSC_ARCH}/conf/make.log
47
48all_build: chk_petsc_dir chklib_dir info deletelibs deletemods build shared_nomesg mpi4py petsc4py
49#
50# Prints information about the system and version of PETSc being compiled
51#
52info:
53	-@echo "=========================================="
54	-@echo " "
55	-@echo "See documentation/faq.html and documentation/bugreporting.html"
56	-@echo "for help with installation problems. Please send EVERYTHING"
57	-@echo "printed out below when reporting problems"
58	-@echo " "
59	-@echo "To subscribe to the PETSc announcement list, send mail to "
60	-@echo "majordomo@mcs.anl.gov with the message: "
61	-@echo "subscribe petsc-announce"
62	-@echo " "
63	-@echo "To subscribe to the PETSc users mailing list, send mail to "
64	-@echo "majordomo@mcs.anl.gov with the message: "
65	-@echo "subscribe petsc-users"
66	-@echo " "
67	-@echo "=========================================="
68	-@echo On `date` on `hostname`
69	-@echo Machine characteristics: `uname -a`
70	-@echo "-----------------------------------------"
71	-@echo "Using PETSc directory: ${PETSC_DIR}"
72	-@echo "Using PETSc arch: ${PETSC_ARCH}"
73	-@echo "-----------------------------------------"
74	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
75	-@echo "-----------------------------------------"
76	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
77	-@echo "Using configuration flags:"
78	-@grep "\#define " ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h
79	-@echo "-----------------------------------------"
80	-@echo "Using C/C++ include paths: ${PETSC_CC_INCLUDES}"
81	-@echo "Using C/C++ compiler: ${PCC} ${PCC_FLAGS} ${COPTFLAGS} ${CFLAGS}"
82	-@if [ "${FC}" != "" ]; then \
83	   echo "Using Fortran include/module paths: ${PETSC_FC_INCLUDES}";\
84	   echo "Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}";\
85         fi
86	-@echo "-----------------------------------------"
87	-@echo "Using C/C++ linker: ${PCC_LINKER}"
88	-@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}"
89	-@if [ "${FC}" != "" ]; then \
90	   echo "Using Fortran linker: ${FC_LINKER}";\
91	   echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\
92         fi
93	-@echo "-----------------------------------------"
94	-@echo "Using libraries: ${PETSC_LIB}"
95	-@echo "------------------------------------------"
96	-@echo "Using mpiexec: ${MPIEXEC}"
97	-@echo "=========================================="
98
99#
100# Builds the PETSc libraries
101# This target also builds fortran77 and f90 interface
102# files and compiles .F files
103#
104build:
105	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
106	-@echo "========================================="
107	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
108	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}  > tmpf 2>&1 ; ${GREP} -v "has no symbols" tmpf; ${RM} tmpf;
109	-@echo "Completed building libraries"
110	-@echo "========================================="
111#
112#
113# Builds PETSc test examples for a given architecture
114#
115test:
116	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} test_build 2>&1 | tee ./${PETSC_ARCH}/conf/test.log
117testx11:
118	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testx11_build 2>&1 | tee ./${PETSC_ARCH}/conf/testx11.log
119test_build:
120	-@echo "Running test examples to verify correct installation"
121	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
122	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
123	@if [ "${FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
124	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
125	-@echo "Completed test examples"
126testx11_build:
127	-@echo "Running graphics test example to verify correct X11 installation"
128	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
129	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testx11ex19
130	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
131	-@echo "Completed graphics test example"
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} -rf ${PETSC_LIB_DIR}/libpetsc*.*
184deletemods:
185	-${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod
186
187# Cleans up build
188allclean: deletelibs deletemods
189	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
190
191
192#
193# Check if PETSC_DIR variable specified is valid
194#
195chk_petsc_dir:
196	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
197	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
198	  echo "You need to use / to separate directories, not \\!"; \
199	  echo "Aborting build"; \
200	  false; fi
201#
202#
203install:
204	@${PYTHON} ./config/install.py -destDir=${DESTDIR}
205
206newall:
207	-@cd src/sys;  @${PYTHON} ${PETSC_DIR}/config/builder.py
208	-@cd src/vec;  @${PYTHON} ${PETSC_DIR}/config/builder.py
209	-@cd src/mat;  @${PYTHON} ${PETSC_DIR}/config/builder.py
210	-@cd src/dm;   @${PYTHON} ${PETSC_DIR}/config/builder.py
211	-@cd src/ksp;  @${PYTHON} ${PETSC_DIR}/config/builder.py
212	-@cd src/snes; @${PYTHON} ${PETSC_DIR}/config/builder.py
213	-@cd src/ts;   @${PYTHON} ${PETSC_DIR}/config/builder.py
214
215streams:
216	cd src/benchmarks/streams; ${OMAKE} test
217# ------------------------------------------------------------------
218#
219# All remaining actions are intended for PETSc developers only.
220# PETSc users should not generally need to use these commands.
221#
222#  See the users manual for how the tags files may be used from Emacs and Vi/Vim
223#
224alletags:
225	-@${PYTHON} bin/maint/generateetags.py
226	-@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
227
228allfortranstubs:
229	-@${RM} -rf include/finclude/ftn-auto/*-tmpdir
230	-@${PYTHON} bin/maint/generatefortranstubs.py ${BFORT}  ${VERBOSE}
231	-@${PYTHON} bin/maint/generatefortranstubs.py -merge  ${VERBOSE}
232	-@${RM} -rf include/finclude/ftn-auto/*-tmpdir
233deletefortranstubs:
234	-@find . -type d -name ftn-auto | xargs rm -rf
235#
236# These are here for the target allci and allco, and etags
237#
238
239BMAKEFILES = conf/variables conf/rules conf/test bmake/adic.init bmake/adicmf.init
240SCRIPTS    = bin/maint/builddist  bin/maint/wwwman bin/maint/xclude bin/maint/bugReport.py bin/maint/buildconfigtest bin/maint/builddistlite \
241             bin/maint/buildtest bin/maint/checkBuilds.py bin/maint/copylognightly bin/maint/copylognightly.tao bin/maint/countfiles bin/maint/findbadfiles \
242             bin/maint/fixinclude bin/maint/getexlist bin/maint/getpdflabels.py bin/maint/helpindex.py bin/maint/hosts.local bin/maint/hosts.solaris  \
243             bin/maint/lex.py  bin/maint/mapnameslatex.py bin/maint/startnightly bin/maint/startnightly.tao bin/maint/submitPatch.py \
244             bin/maint/update-docs.py  bin/maint/wwwindex.py bin/maint/xcludebackup bin/maint/xcludecblas bin/maint/zap bin/maint/zapall \
245             config/PETSc/Configure.py config/PETSc/Options.py \
246             config/PETSc/packages/*.py config/PETSc/utilities/*.py
247
248
249# Builds all the documentation - should be done every night
250alldoc: alldoc1 alldoc2 alldoc3
251
252# Build everything that goes into 'doc' dir except html sources
253alldoc1: chk_loc deletemanualpages chk_concepts_dir
254	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
255	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
256	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
257	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
258	-cd src/docs/tex/manual; ${OMAKE} developers.pdf LOC=${LOC}
259	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
260	-${PYTHON} bin/maint/wwwindex.py ${PETSC_DIR} ${LOC}
261	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
262	-${OMAKE} manconcepts LOC=${LOC}
263	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
264	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
265	-${PYTHON} bin/maint/helpindex.py ${PETSC_DIR} ${LOC}
266	-grep -h Polymorphic include/*.h | grep -v '#define ' | sed "s?PetscPolymorphic[a-zA-Z]*(??g" | cut -f1 -d"{" > tmppoly
267	-${PYTHON} bin/maint/processpoly.py ${PETSC_DIR} ${LOC}
268	-${RM} tmppoly
269
270# Builds .html versions of the source
271# html overwrites some stuff created by update-docs - hence this is done later.
272alldoc2: chk_loc
273	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
274	-${PYTHON} bin/maint/update-docs.py ${PETSC_DIR} ${LOC}
275#
276# Builds HTML versions of Matlab scripts
277alldoc3: chk_loc
278	if  [ "${MATLAB_COMMAND}" != "" ]; then\
279          export MATLABPATH=${MATLABPATH}:${PETSC_DIR}/bin/matlab; \
280          cd ${PETSC_DIR}/bin/matlab; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
281          cd classes; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
282          cd examples/tutorials; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
283        fi
284
285alldocclean: deletemanualpages allcleanhtml
286
287# Deletes man pages (HTML version)
288deletemanualpages: chk_loc
289	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
290          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
291          ${RM} ${LOC}/docs/exampleconcepts ;\
292          ${RM} ${LOC}/docs/manconcepts ;\
293          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
294          ${PYTHON} bin/maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
295        fi
296
297allcleanhtml:
298	-${RM} include/adic/*.h.html
299	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
300
301chk_concepts_dir: chk_loc
302	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
303	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
304
305###########################################################
306# targets to build distribution and update docs
307###########################################################
308
309# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
310dist:
311	${PETSC_DIR}/bin/maint/builddist ${PETSC_DIR}
312
313# This target works only if you can do 'ssh petsc@login.mcs.anl.gov'
314# also copy the file over to ftp site.
315web-snapshot:
316	@if [ ! -f "${HOME}/petsc-dev.tar.gz" ]; then \
317	    echo "~/petsc-dev.tar.gz missing! cannot update petsc-dev snapshot on mcs-web-site"; \
318	  else \
319            echo "updating petsc-dev snapshot on mcs-web-site"; \
320	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
321	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-dev.tar.gz; \
322	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-dev/ \
323              petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-as/snapshots/petsc-dev ;\
324	    /bin/cp -f /home/petsc/petsc-dev.tar.gz /mcs/ftp/pub/petsc/petsc-dev.tar.gz;\
325	    ${RM} -rf $${tmpdir} ;\
326	  fi
327
328# build the tarfile - and then update petsc-dev snapshot on mcs-web-site
329update-web-snapshot: dist web-snapshot
330
331# This target updates website main pages
332update-web:
333	@cd ${PETSC_DIR}/src/docs; make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
334	/usr/bin/rsync -az -C --exclude=documentation/index.html --exclude=documentation/installation.html \
335	  ${PETSC_DIR}/src/docs/website/ petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-as
336	@cd ${PETSC_DIR}/docs; /usr/bin/rsync -az developers.pdf petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-as/developers/
337
338#
339#  builds a single list of files for each PETSc library so they may all be built in parallel
340#  without a recursive set of make calls
341createfastbuild:
342	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
343
344###########################################################
345#
346#  See script for details
347#
348gcov:
349	-@${PETSC_DIR}/bin/maint/gcov.py -run_gcov
350
351mergegcov:
352	-@${PETSC_DIR}/bin/maint/gcov.py -merge_gcov ${LOC} *.tar.gz
353
354# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
355allrcslabel:
356	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
357#
358#   The commands below are for generating ADIC versions of the code;
359# they are not currently used.
360#
361alladicignore:
362	-@${RM} ${INSTALL_LIB_DIR}/adicignore
363	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
364
365alladic:
366	-@echo "Beginning to compile ADIC source code in all directories"
367	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
368	-@echo "========================================="
369	-@cd include ; \
370           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petscsys.h
371	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
372
373alladiclib:
374	-@echo "Beginning to compile ADIC libraries in all directories"
375	-@echo "Using compiler: ${PCC} ${COPTFLAGS}"
376	-@echo "-----------------------------------------"
377	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
378	-@echo "-----------------------------------------"
379	-@echo "Using configuration flags:"
380	-@grep "define " ${PETSC_ARCH}/include/petscconf.h
381	-@echo "-----------------------------------------"
382	-@echo "Using include paths: ${CC_PETSC_INCLUDE}"
383	-@echo "-----------------------------------------"
384	-@echo "Using PETSc directory: ${PETSC_DIR}"
385	-@echo "Using PETSc arch: ${PETSC_ARCH}"
386	-@echo "========================================="
387	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${AR_LIB_SUFFIX}
388	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
389	-@cd src/adic/src ; \
390            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} lib
391
392# -------------------------------------------------------------------------------
393#
394# Some macros to check if the fortran interface is up-to-date.
395#
396countfortranfunctions:
397	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
398	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
399	sed "s/_$$//" | sort > /tmp/countfortranfunctions
400
401countcfunctions:
402	-@grep extern ${PETSC_DIR}/include/*.h  | grep "(" | tr -s ' ' | \
403	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
404	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
405
406difffortranfunctions: countfortranfunctions countcfunctions
407	-@echo -------------- Functions missing in the fortran interface ---------------------
408	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
409	-@echo ----------------- Functions missing in the C interface ------------------------
410	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
411	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
412
413checkbadfortranstubs:
414	-@echo "========================================="
415	-@echo "Functions with MPI_Comm as an Argument"
416	-@echo "========================================="
417	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
418	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
419	-@echo "========================================="
420	-@echo "Functions with a String as an Argument"
421	-@echo "========================================="
422	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
423	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
424	-@echo "========================================="
425	-@echo "Functions with Pointers to PETSc Objects as Argument"
426	-@echo "========================================="
427	-@cd ${PETSC_DIR}/src/fortran/auto; \
428	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
429	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
430	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
431	for OBJ in $$_p_OBJ; do \
432	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
433	cut -d'(' -f1 | cut -d' ' -f1,3; \
434	done
435#
436# Automatically generates PETSc exercises in html from the tutorial examples.
437#
438# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
439#  (used also in introductions to the manual pages)
440# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
441# The list of exercises is from TUTORIALS in each directory's makefile
442#
443# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
444# The pagemaker rule is in the file conf (at the bottom)
445#
446# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
447#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
448#
449exercises:
450	-@echo "========================================="
451	-@echo "Generating HTML tutorial exercises"
452	-@${RM} docs/pageform.txt
453	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
454	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
455	-@echo "access_format=short"                        >> docs/pageform.txt
456	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
457	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
458	-@echo "Generating HTML for individual directories"
459	-@echo "========================================="
460	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
461	-@echo "Completed HTML for individual directories"
462	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
463	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
464	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
465	-@echo "========================================="
466
467.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
468        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
469        allhtml allcleanhtml  allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
470        start_configure configure_petsc configure_clean
471
472petscao : petscmat petscao.f90.h
473petscdm : petscksp petscdm.f90.h
474petscdraw : petsc petscdraw.f90.h
475petscis : petsc petscis.f90.h
476petscksp : petscpc  petscksp.f90.h
477petsclog : petsc petsclog.f90.h
478petscmat : petscvec petscmat.f90.h
479petscmg : petscksp petscmg.f90.h
480petscpc : petscmat petscpc.f90.h
481petscsnes : petscksp petscsnes.f90.h
482petscsys : petsc petscsys.f90.h
483petscts : petscsnes petscts.f90.h
484petsc : petsc.f90.h
485petscvec : petscis petscvec.f90.h
486petscviewer : petsc petscviewer.f90.h
487petscmesh : petsc petscmesh.f90.h
488modules : petscao petscdm petscdraw petscis petscksp petsclog petscmat petscmg petscpc petscsnes petscsys petscts petsc petscvec petscviewer petscmesh
489