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