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