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