xref: /petsc/makefile (revision 66341c5d82590c1abea31a9b2b364ca66f0f507e)
1# $Id: makefile,v 1.180 1997/08/19 15:46:31 bsmith Exp balay $
2#
3# This is the makefile for installing PETSc. See the file
4# Installation for directions on installing PETSc.
5# See also bmake/common for additional commands.
6#
7
8CFLAGS	 =
9SOURCEC	 =
10SOURCEF	 =
11DOCS	 = Changes Machines Readme maint/addlinks \
12	   maint/builddist FAQ Installation BugReporting\
13	   maint/buildlinks maint/wwwman maint/xclude maint/crontab\
14	   bmake/common bmake/*/base* maint/autoftp docs/www/sec/* \
15           include/finclude/generateincludes bin/petscviewinfo.text \
16           bin/petscoptsinfo.text
17OBJSC	 =
18OBJSF	 =
19LIBBASE	 = libpetscvec
20DIRS	 = src include docs
21
22include $(PETSC_DIR)/bmake/$(PETSC_ARCH)/base
23
24# Builds PETSc libraries for a given BOPT and architecture
25all: chkpetsc_dir
26	-$(RM) -f $(PDIR)/*
27	-@echo "Beginning to compile libraries in all directories"
28	-@echo On `date` on `hostname`
29	-@echo Machine characteristics: `uname -a`
30	-@echo "Using compiler: $(CC) $(COPTFLAGS)"
31	-@echo "-----------------------------------------"
32	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
33	-@echo "-----------------------------------------"
34	-@echo "Using configuration flags: $(CONF)"
35	-@echo "-----------------------------------------"
36	-@echo "Using include paths: $(PETSC_INCLUDE)"
37	-@echo "-----------------------------------------"
38	-@echo "Using PETSc directory: $(PETSC_DIR)"
39	-@echo "Using PETSc arch: $(PETSC_ARCH)"
40	-@echo "========================================="
41	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
42	   ACTION=libfast  tree
43	-@cd $(PETSC_DIR)/src/sys/src ; \
44	$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) rs6000_time
45	$(RANLIB) $(PDIR)/*.a
46	-@chmod g+w  $(PDIR)/*.a
47	-@echo "Completed building libraries"
48	-@echo "========================================="
49
50# Builds PETSc test examples for a given BOPT and architecture
51testexamples: chkopts
52	-@echo "Beginning to compile and run test examples"
53	-@echo On `date` on `hostname`
54	-@echo "Using compiler: $(CC) $(COPTFLAGS)"
55	-@echo "-----------------------------------------"
56	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
57	-@echo "-----------------------------------------"
58	-@echo "Using include paths: $(PETSC_INCLUDE)"
59	-@echo "-----------------------------------------"
60	-@echo "Using PETSc directory: $(PETSC_DIR)"
61	-@echo "Using PETSc arch: $(PETSC_ARCH)"
62	-@echo "------------------------------------------"
63	-@echo "Using linker: $(CLINKER)"
64	-@echo "Using libraries: $(PETSC_LIB)"
65	-@echo "------------------------------------------"
66	-@echo "Due to different numerical round-off on certain"
67	-@echo "machines some of the numbers may not match exactly."
68	-@echo "========================================="
69	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
70	   ACTION=testexamples_1  tree
71	-@echo "Completed compiling and running test examples"
72	-@echo "========================================="
73
74# Builds PETSc test examples for a given BOPT and architecture
75testexamples_uni: chkopts
76	-@echo "Beginning to compile and run uniprocessor test examples"
77	-@echo On `date` on `hostname`
78	-@echo "Using compiler: $(CC) $(COPTFLAGS)"
79	-@echo "Using linker: $(CLINKER)"
80	-@echo "------------------------------------------"
81	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
82	-@echo "------------------------------------------"
83	-@echo "Using include paths: $(PETSC_INCLUDE)"
84	-@echo "------------------------------------------"
85	-@echo "Using PETSc directory: $(PETSC_DIR)"
86	-@echo "Using PETSc arch: $(PETSC_ARCH)"
87	-@echo "------------------------------------------"
88	-@echo "Using linker: $(CLINKER)"
89	-@echo "Using libraries: $(PETSC_LIB)"
90	-@echo "------------------------------------------"
91	-@echo "Due to different numerical round-off on certain"
92	-@echo "machines some of the numbers may not match exactly."
93	-@echo "========================================="
94	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
95	   ACTION=testexamples_4  tree
96	-@echo "Completed compiling and running uniprocessor test examples"
97	-@echo "========================================="
98
99#
100# Builds PETSc Fortran interface libary
101# Note:	 libfast cannot run on .F files on certain machines, so we
102# use lib and check for errors here.
103fortran: chkpetsc_dir
104	-$(RM) -f $(PDIR)/libpetscfortran.*
105	-@echo "Beginning to compile Fortran interface library"
106	-@echo On `date` on `hostname`
107	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
108	-@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)"
109	-@echo "------------------------------------------"
110	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
111	-@echo "------------------------------------------"
112	-@echo "Using configuration flags: $(CONF)"
113	-@echo "------------------------------------------"
114	-@echo "Using include paths: $(PETSC_INCLUDE)"
115	-@echo "------------------------------------------"
116	-@echo "Using PETSc directory: $(PETSC_DIR)"
117	-@echo "Using PETSc arch: $(PETSC_ARCH)"
118	-@echo "========================================="
119	-@cd src/fortran/custom; \
120	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
121	  grep -v clog trashz | grep -v "information sections" | \
122	  egrep -i '(Error|warning|Can)' >> /dev/null;\
123	  if [ "$$?" != 1 ]; then \
124	  cat trashz ; fi; $(RM) trashz
125	-@cd src/fortran/auto; \
126	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
127	$(RANLIB) $(PDIR)/libpetscfortran.a
128	-@chmod g+w  $(PDIR)/*.a
129	-@echo "Completed compiling Fortran interface library"
130	-@echo "========================================="
131
132# Builds PETSc test examples for a given BOPT and architecture
133testfortran: chkopts
134	-@echo "Beginning to compile and run Fortran test examples"
135	-@echo On `date` on `hostname`
136	-@echo "Using compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
137	-@echo "Using linker: $(FLINKER)"
138	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
139	-@echo "------------------------------------------"
140	-@echo "Using PETSc directory: $(PETSC_DIR)"
141	-@echo "Using PETSc arch: $(PETSC_ARCH)"
142	-@echo "------------------------------------------"
143	-@echo "Using linker: $(FLINKER)"
144	-@echo "Using libraries: $(PETSC_FORTRAN_LIB) $(PETSC_LIB)"
145	-@echo "========================================="
146	-@echo "Due to different numerical round-off on certain"
147	-@echo "machines or the way Fortran formats numbers"
148	-@echo "some of the results may not match exactly."
149	-@echo "========================================="
150	-@echo "On some machines you may get messages of the form"
151	-@echo "PetscScalarAddressToFortran:C and Fortran arrays are"
152	-@echo "not commonly aligned or are too far apart to be indexed"
153	-@echo "by an integer. Locations: C xxxc Fortran xxxf"
154	-@echo "Locations/sizeof(Scalar): C yyc Fortran yyf"
155	-@echo "This indicates that you may not be able to use the"
156	-@echo "PETSc routines VecGetArray() and MatGetArray() from Fortran"
157	-@echo "========================================="
158	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
159	   ACTION=testexamples_3  tree
160	-@echo "Completed compiling and running Fortran test examples"
161	-@echo "========================================="
162#
163# Builds PETSc Fortran90 interface libary
164# Note:	 libfast cannot run on .F files on certain machines, so we
165# use lib and check for errors here.
166# Note: F90 interface currently only supported in NAG F90 compiler
167fortran90: chkpetsc_dir fortran
168	-@echo "Beginning to compile Fortran90 interface library"
169	-@echo On `date` on `hostname`
170	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
171	-@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)"
172	-@echo "------------------------------------------"
173	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
174	-@echo "------------------------------------------"
175	-@echo "Using configuration flags: $(CONF)"
176	-@echo "------------------------------------------"
177	-@echo "Using include paths: $(PETSC_INCLUDE)"
178	-@echo "------------------------------------------"
179	-@echo "Using PETSc directory: $(PETSC_DIR)"
180	-@echo "Using PETSc arch: $(PETSC_ARCH)"
181	-@echo "========================================="
182	-@cd src/fortran/f90; \
183	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
184	  grep -v clog trashz | grep -v "information sections" | \
185	  egrep -i '(Error|warning|Can)' >> /dev/null;\
186	  if [ "$$?" != 1 ]; then \
187	  cat trashz ; fi; $(RM) trashz
188	$(RANLIB) $(PDIR)/libpetscfortran.a
189	-@chmod g+w  $(PDIR)/*.a
190	-@echo "Completed compiling Fortran90 interface library"
191	-@echo "========================================="
192
193# Builds noise routines (not yet publically available)
194# Note:	 libfast cannot run on .F files on certain machines, so we
195# use lib and check for errors here.
196noise: chkpetsc_dir
197	-@echo "Beginning to compile noise routines"
198	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
199	-@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)"
200	-@echo "------------------------------------------"
201	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
202	-@echo "------------------------------------------"
203	-@echo "Using configuration flags: $(CONF)"
204	-@echo "------------------------------------------"
205	-@echo "Using include paths: $(PETSC_INCLUDE)"
206	-@echo "------------------------------------------"
207	-@echo "Using PETSc directory: $(PETSC_DIR)"
208	-@echo "Using PETSc arch: $(PETSC_ARCH)"
209	-@echo "========================================="
210	-@cd src/snes/interface/noise; \
211	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
212	  grep -v clog trashz | grep -v "information sections" | \
213	  egrep -i '(Error|warning|Can)' >> /dev/null;\
214	  if [ "$$?" != 1 ]; then \
215	  cat trashz ; fi; $(RM) trashz
216	$(RANLIB) $(PDIR)/libpetscsnes.a
217	-@chmod g+w  $(PDIR)/libpetscsnes.a
218	-@echo "Completed compiling noise routines"
219	-@echo "========================================="
220
221petscblas: chkpetsc_dir
222	-$(RM) -f $(PDIR)/libpetscblas.*
223	-@echo "Beginning to compile CBLAS and CLAPACK"
224	-@echo On `date` on `hostname`
225	-@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)"
226	-@echo "------------------------------------------"
227	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
228	-@echo "------------------------------------------"
229	-@echo "Using configuration flags: $(CONF)"
230	-@echo "------------------------------------------"
231	-@echo "Using include paths: $(PETSC_INCLUDE)"
232	-@echo "------------------------------------------"
233	-@echo "Using PETSc directory: $(PETSC_DIR)"
234	-@echo "Using PETSc arch: $(PETSC_ARCH)"
235	-@echo "========================================="
236	-@cd src/adic/blas; \
237	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
238	-@cd src/adic/lapack; \
239	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=libfast tree
240	$(RANLIB) $(PDIR)/libpetscblas.a
241	-@chmod g+w  $(PDIR)/*.a
242	-@echo "Completed compiling CBLAS and CLAPACK"
243	-@echo "========================================="
244
245
246ranlib:
247	$(RANLIB) $(PDIR)/*.a
248
249# Deletes PETSc libraries
250deletelibs:
251	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
252
253# Deletes man pages (HTML version)
254deletewwwpages:
255	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit \
256	         $(PETSC_DIR)/docs/www/man*.html
257
258# Deletes man pages (LaTeX version)
259deletelatexpages:
260	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
261
262# To access the tags in emacs, type M-x visit-tags-table and specify
263# the file petsc/TAGS.	Then, to move to where a PETSc function is
264# defined, enter M-. and the function name.  To search for a string
265# and move to the first occurrence, use M-x tags-search and the string.
266# To locate later occurrences, use M-,
267
268TAGS_INCLUDE_FILES  = include/*.h include/pinclude/*.h include/FINCLUDE/*.h
269TAGS_BMAKE_FILES    = bmake/common bmake/*/base*
270TAGS_EXAMPLE_FILES  = src/*/examples/*/*.[c,h,F,f] src/*/examples/*/*/*.[c,h,F,f] \
271                      src/benchmarks/*.c src/contrib/*/examples/*/*.[c,h,F,f]
272TAGS_DOC_FILES      = docs/tex/manual/routin.tex docs/tex/manual/manual.tex \
273                      docs/tex/manual/manual_tex.tex docs/tex/manual/intro.tex \
274                      docs/tex/manual/part1.tex docs/tex/manual/part2.tex
275TAGS_SRC_FILES      = src/*/*.[c,h] src/*/interface/*.[c,h] src/*/src/*.[c,h] \
276                      src/*/utils/*.[c,h] \
277                      src/*/impls/*.[c,h] src/*/impls/*/*.[c,h] src/*/impls/*/*/*.[c,h] \
278                      src/gvec/impls/*/*/*/*/*.[c,h] src/contrib/*/*.[c,h] \
279                      src/contrib/*/src/*.[c,h] src/fortran/custom/*.[c,h,F]
280TAGS_MAKEFILE_FILES = include/makefile include/*/makefile \
281                      makefile \
282                      src/makefile src/*/makefile src/*/src/makefile \
283                      src/*/interface/makefile \
284                      src/*/utils/makefile \
285                      src/*/impls/makefile src/*/impls/*/makefile src/*/impls/*/*/makefile \
286                      src/*/examples/makefile src/*/examples/*/makefile src/*/examples/*/*/makefile \
287                      src/gvec/impls/*/*/*/*/makefile src/gvec/impls/*/*/*/makefile \
288                      src/fortran/*/makefile \
289                      src/contrib/*/makefile src/contrib/*/src/makefile \
290                      src/contrib/*/examples/makefile src/contrib/*/examples/*/makefile \
291                      docs/makefile
292
293# Builds all etags files
294alletags:
295	-make etags_complete
296	-make etags
297	-make etags_noexamples
298	-make etags_makefiles
299
300# Builds the basic etags file.	This should be employed by most users.
301etags:
302	$(RM) TAGS
303	etags -f TAGS $(TAGS_INCLUDE_FILES)
304	etags -a -f TAGS $(TAGS_SRC_FILES)
305	etags -a -f TAGS $(TAGS_EXAMPLE_FILES)
306	etags -a -f TAGS $(TAGS_MAKEFILE_FILES)
307	etags -a -f TAGS $(TAGS_BMAKE_FILES)
308	chmod g+w TAGS
309
310# Builds complete etags list; only for PETSc developers.
311etags_complete:
312	$(RM) TAGS_COMPLETE
313	etags -f TAGS_COMPLETE $(TAGS_SRC_FILES)
314	etags -a -f TAGS_COMPLETE $(TAGS_INCLUDE_FILES)
315	etags -a -f TAGS_COMPLETE $(TAGS_EXAMPLE_FILES)
316	etags -a -f TAGS_COMPLETE $(TAGS_MAKEFILE_FILES)
317	etags -a -f TAGS_COMPLETE $(TAGS_BMAKE_FILES)
318	etags -a -f TAGS_COMPLETE $(TAGS_DOC_FILES)
319	chmod g+w TAGS_COMPLETE
320
321# Builds the etags file that excludes the examples directories
322etags_noexamples:
323	$(RM) TAGS_NO_EXAMPLES
324	etags -f TAGS_NO_EXAMPLES $(TAGS_SRC_FILES)
325	etags -a -f TAGS_NO_EXAMPLES $(TAGS_INCLUDE_FILES)
326	etags -a -f TAGS_NO_EXAMPLES $(TAGS_MAKEFILE_FILES)
327	etags -a -f TAGS_NO_EXAMPLES $(TAGS_BMAKE_FILES)
328	etags -a -f TAGS_NO_EXAMPLES $(TAGS_DOC_FILES)
329	chmod g+w TAGS_NO_EXAMPLES
330
331# Builds the etags file for makefiles
332etags_makefiles:
333	$(RM) TAGS_MAKEFILES
334	etags -f TAGS_MAKEFILES $(TAGS_MAKEFILE_FILES)
335	etags -a -f TAGS_MAKEFILES $(TAGS_BMAKE_FILES)
336	chmod g+w TAGS_MAKEFILES
337
338#
339# ctags builds the tags file required for VI.
340# To use the tags file do the following:
341# 1. within vi invole the command - :set tags=/home/bsmith/petsc/tags
342#    or add  the command to your ~/.exrc file - set tags=/home/bsmith/petsc/tags
343# 2. now to go to a tag do - :tag TAGNAME for eg - :tag MatCreate
344#
345ctags:
346	$(RM) tags
347	ctags -w -f tags $(TAGS_INCLUDE_FILES)
348	ctags -w -a -f tags $(TAGS_SRC_FILES)
349	ctags -w -a -f tags $(TAGS_EXAMPLE_FILES)
350	ctags -w -a -f tags $(TAGS_MAKEFILE_FILES)
351	ctags -w -a -f tags $(TAGS_BMAKE_FILES)
352	chmod g+w tags
353
354# ------------------------------------------------------------------
355#
356# All remaining actions are intended for PETSc developers only.
357# PETSc users should not generally need to use these commands.
358#
359
360# Builds all versions of the man pages
361allmanpages: allwwwpages alllatexpages
362allwwwpages: deletewwwpages
363	-make ACTION=wwwpages_buildcite tree
364	-cd src/fortran/custom; make wwwpages_buildcite
365	-cd src/fortran/custom; make wwwpages
366	-make ACTION=wwwpages tree
367	-maint/wwwman
368	-maint/examplesindex.tcl -www
369	-maint/htmlkeywords.tcl
370	-@chmod g+w docs/www/man*/*
371
372#This is similar to allwwwpages except -www -> -wwwhome
373#The wwwmanpages built this way can pe placed at PETSc Home Page
374allwwwhomepages: deletewwwpages
375	-make ACTION=wwwpages_buildcite tree
376	-cd src/fortran/custom; make wwwpages_buildcite
377	-cd src/fortran/custom; make wwwpages
378	-make ACTION=wwwpages tree
379	-maint/wwwman
380	-maint/examplesindex.tcl -wwwhome
381	-maint/htmlkeywords.tcl -wwwhome
382	-@chmod g+w docs/www/man*/*
383
384alllatexpages: deletelatexpages
385	-make ACTION=latexpages tree
386	-cd src/fortran/custom; make latexpages
387	-@chmod g+w docs/tex/rsum/*
388
389# Builds Fortran stub files
390allfortranstubs:
391	-@include/finclude/generateincludes
392	-@$(RM) -f src/fortran/auto/*.c
393	-make ACTION=fortranstubs tree
394	chmod g+w src/fortran/auto/*.c
395
396allci:
397	-@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) ci
398	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=ci  tree
399
400allco:
401	-@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) co
402	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=co  tree
403
404#
405#   The commands below are for generating ADIC versions of the code;
406# they are not currently used.
407#
408CFLAGS   =  $(CPPFLAGS) $(CONF)
409alladicignore:
410	-@$(RM) $(PDIR)/adicignore
411	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adicignore  tree
412
413alladic:
414	-@echo "Beginning to compile ADIC source code in all directories"
415	-@echo "Using ADIC compiler: $(ADIC_CC) $(CFLAGS)"
416	-@echo "========================================="
417	-@cd include ; \
418           $(ADIC_CC) -s -f 1 $(CFLAGS) petsc.h
419	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adic  tree
420	-@cd src/inline ; \
421            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic
422	-@cd src/adic/blas ; \
423            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic
424	-@cd src/adic/lapack ; \
425            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adic  tree
426
427alladiclib:
428	-@echo "Beginning to compile ADIC libraries in all directories"
429	-@echo "Using compiler: $(CC) $(COPTFLAGS)"
430	-@echo "-----------------------------------------"
431	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
432	-@echo "-----------------------------------------"
433	-@echo "Using configuration flags: $(CONF)"
434	-@echo "-----------------------------------------"
435	-@echo "Using include paths: $(PETSC_INCLUDE)"
436	-@echo "-----------------------------------------"
437	-@echo "Using PETSc directory: $(PETSC_DIR)"
438	-@echo "Using PETSc arch: $(PETSC_ARCH)"
439	-@echo "========================================="
440	-@$(RM) -f  $(PDIR)/*adic.a
441	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adiclib  tree
442	-@cd src/adic/blas ; \
443            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adiclib
444	-@cd src/adic/lapack ; \
445            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adiclib  tree
446	-@cd src/adic/src ; \
447            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib
448
449# -------------------------------------------------------------------------------
450#
451# Some macros to check if the fortran interface is up-to-date.
452#
453countfortranfunctions:
454	-@cd $(PETSC_DIR)/src/fortran; egrep '^void' custom/*.c auto/*.c | \
455	cut -d'(' -f1 | tr -s '' ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
456	sed "s/_$$//" | sort > /tmp/countfortranfunctions
457
458countcfunctions:
459	-@ grep extern $(PETSC_DIR)/include/*.h *.h | grep "(" | tr -s '' ' ' | \
460	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '' '\012' |  \
461	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
462
463difffortranfunctions: countfortranfunctions countcfunctions
464	-@echo -------------- Functions missing in the fortran interface ---------------------
465	-@diff /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
466	-@echo ----------------- Functions missing in the C interface ------------------------
467	-@diff /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
468	-@$(RM)  /tmp/countcfunctions /tmp/countfortranfunctions
469
470checkbadfortranstubs:
471	-@echo "========================================="
472	-@echo "Functions with MPI_Comm as an Argument"
473	-@echo "========================================="
474	-@cd $(PETSC_DIR)/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
475	tr -s '' ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
476	-@echo "========================================="
477	-@echo "Functions with a String as an Argument"
478	-@echo "========================================="
479	-@cd $(PETSC_DIR)/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
480	tr -s '' ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
481	-@echo "========================================="
482	-@echo "Functions with Pointers to PETSc Objects as Argument"
483	-@echo "========================================="
484	-@cd $(PETSC_DIR)/src/fortran/auto; \
485	_p_OBJ=`grep _p_ $(PETSC_DIR)/include/*.h | tr -s '' ' ' | \
486	cut -d' ' -f 3 | tr -s '' '\012' | grep -v '{' | cut -d'*' -f1 | \
487	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
488	for OBJ in $$_p_OBJ; do \
489	grep "$$OBJ \*" *.c | tr -s '' ' ' | tr -s ':' ' ' | \
490	cut -d'(' -f1 | cut -d' ' -f1,3; \
491	done
492