xref: /petsc/makefile (revision 000e7ae39bfc97192f514518b0dadcfe7b458034)
1# $Id: makefile,v 1.353 2001/08/28 19:43:38 balay Exp $
2#
3# This is the makefile for installing PETSc. See the file
4# docs/installation.html for directions on installing PETSc.
5# See also bmake/common for additional commands.
6#
7ALL: all
8LOCDIR = .
9DIRS   = src include docs
10
11include ${PETSC_DIR}/bmake/common/base
12include ${PETSC_DIR}/bmake/common/test
13
14
15
16#
17# Basic targets to build PETSc libraries.
18# all     : builds the c, fortran, and f90 libraries
19all       : chk_petsc_dir info info_h chklib_dir deletelibs build shared
20all_lt    : chk_petsc_dir info info_h chklib_dir deletelibs build_lt shared
21#
22# Prints information about the system and version of PETSc being compiled
23#
24info:
25	-@echo "=========================================="
26	-@echo " "
27	-@echo "See docs/troubleshooting.html and docs/bugreporting.html"
28	-@echo "for help with installation problems. Please send EVERYTHING"
29	-@echo "printed out below when reporting problems"
30	-@echo " "
31	-@echo "To subscribe to the PETSc users mailing list, send mail to "
32	-@echo "majordomo@mcs.anl.gov with the message: "
33	-@echo "subscribe petsc-users"
34	-@echo " "
35	-@echo "=========================================="
36	-@echo On `date` on `hostname`
37	-@echo Machine characteristics: `uname -a`
38	-@echo "-----------------------------------------"
39	-@echo "Using C compiler: ${CC} ${COPTFLAGS} ${CCPPFLAGS}"
40	-@if [ -n "${C_CCV}" -a "${C_CCV}" != "unknown" ] ; then \
41	  echo "C Compiler version:" ; ${C_CCV} ; fi ; true
42	-@if [ -n "${CXX_CCV}" -a "${CXX_CCV}" != "unknown" ] ; then \
43	  echo "C++ Compiler version:" ; ${CXX_CCV} ; fi; true
44	-@echo "Using Fortran compiler: ${FC} ${FOPTFLAGS} ${FCPPFLAGS}"
45	-@if [ -n "${C_FCV}" -a "${C_FCV}" != "unknown" ] ; then \
46	  echo "Fortran Compiler version:" ; ${C_FCV} ; fi; true
47	-@echo "-----------------------------------------"
48	-@grep PETSC_VERSION_NUMBER ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
49	-@echo "-----------------------------------------"
50	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
51	-@echo "-----------------------------------------"
52	-@echo "Using configuration flags:"
53	-@grep "define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
54	-@echo "-----------------------------------------"
55	-@echo "Using include paths: ${PETSC_INCLUDE}"
56	-@echo "-----------------------------------------"
57	-@echo "Using PETSc directory: ${PETSC_DIR}"
58	-@echo "Using PETSc arch: ${PETSC_ARCH}"
59	-@echo "------------------------------------------"
60	-@echo "Using C linker: ${CLINKER}"
61	-@echo "Using Fortran linker: ${FLINKER}"
62	-@echo "Using libraries: ${PETSC_LIB}"
63	-@echo "=========================================="
64#
65#
66MINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
67info_h:
68	-@$(RM) -f MINFO ${MINFO}
69	-@echo  "static char *petscmachineinfo = \"  " >> MINFO
70	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
71	-@echo  Machine characteristics: `uname -a` "" >> MINFO
72	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
73	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
74	-@echo  "-----------------------------------------\"; " >> MINFO
75	-@echo  "static char *petsccompilerinfo = \"  " >> MINFO
76	-@echo  "Using C compiler: ${CC} ${COPTFLAGS} ${CCPPFLAGS} " >> MINFO
77	-@if [  "${C_CCV}" -a "${C_CCV}" != "unknown" ] ; then \
78	  echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1; fi ; true
79	-@if [  "${CXX_CCV}" -a "${CXX_CCV}" != "unknown" ] ; then \
80	  echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; fi ; true
81	-@echo  "Using Fortran compiler: ${FC} ${FOPTFLAGS} ${FCPPFLAGS}" >> MINFO
82	-@if [  "${C_FCV}" -a "${C_FCV}" != "unknown" ] ; then \
83	  echo  "Fortran Compiler version:" >> MINFO ; ${C_FCV} >> MINFO 2>&1 ; fi ; true
84	-@echo  "-----------------------------------------\"; " >> MINFO
85	-@echo  "static char *petsccompilerflagsinfo = \"  " >> MINFO
86	-@echo  "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" >> MINFO
87	-@echo  "-----------------------------------------" >> MINFO
88	-@echo  "Using configuration flags:" >> MINFO
89	-@echo  "-----------------------------------------" >> MINFO
90	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
91	-@echo  "------------------------------------------\"; " >> MINFO
92	-@echo  "static char *petsclinkerinfo = \"  " >> MINFO
93	-@echo  "Using C linker: ${CLINKER}" >> MINFO
94	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
95	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
96	-@cat MINFO | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}
97	-@chmod g+w ${MINFO}
98	-@$(RM) MINFO
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} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
108	${RANLIB} ${PETSC_LIB_DIR}/*.a
109	-@chmod g+w  ${PETSC_LIB_DIR}/*.a
110	-@echo "Completed building libraries"
111	-@echo "========================================="
112#
113# Builds the PETSc libraries
114# This target is the same as 'build', but uses the 'lib' target instead
115#
116build_lt:
117	-@echo "BEGINNING TO COMPILE LIBTOOL LIBRARIES IN ALL DIRECTORIES"
118	-@echo "========================================="
119	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=lib tree
120	-@echo "Completed building libraries"
121	-@echo "========================================="
122#
123# Builds PETSc test examples for a given BOPT and architecture
124#
125testexamples: info chkopts
126	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
127	-@echo "Due to different numerical round-off on certain"
128	-@echo "machines some of the numbers may not match exactly."
129	-@echo "========================================="
130	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_1  tree
131	-@echo "Completed compiling and running test examples"
132	-@echo "========================================="
133testfortran: info chkopts
134	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
135	-@echo "========================================="
136	-@echo "Due to different numerical round-off on certain"
137	-@echo "machines or the way Fortran formats numbers"
138	-@echo "some of the results may not match exactly."
139	-@echo "========================================="
140	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3  tree
141	-@echo "Completed compiling and running Fortran test examples"
142	-@echo "========================================="
143testexamples_uni: info chkopts
144	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
145	-@echo "Due to different numerical round-off on certain"
146	-@echo "machines some of the numbers may not match exactly."
147	-@echo "========================================="
148	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_4  tree
149	-@echo "Completed compiling and running uniprocessor test examples"
150	-@echo "========================================="
151testfortran_uni: info chkopts
152	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
153	-@echo "Due to different numerical round-off on certain"
154	-@echo "machines some of the numbers may not match exactly."
155	-@echo "========================================="
156	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree
157	-@echo "Completed compiling and running uniprocessor fortran test examples"
158	-@echo "========================================="
159
160# Ranlib on the libraries
161ranlib:
162	${RANLIB} ${PETSC_LIB_DIR}/*.a
163
164# Deletes PETSc libraries
165deletelibs: chkopts_basic
166	-${RM} -f ${PETSC_LIB_DIR}/*
167
168# Cleans up build
169allclean: deletelibs
170	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
171
172#
173#   Updates your PETSc version to the latest set of patches
174#
175update:
176	-@bin/petscupdate
177
178#
179# Check if PETSC_DIR variable specified is valid
180#
181chk_petsc_dir:
182	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
183	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
184	  echo "You need to use / to separate directories, not \\!"; \
185	  echo "Aborting build"; \
186	  false; fi
187
188# ------------------------------------------------------------------
189#
190# All remaining actions are intended for PETSc developers only.
191# PETSc users should not generally need to use these commands.
192#
193
194# To access the tags in EMACS, type M-x visit-tags-table and specify
195# the file petsc/TAGS.
196# 1) To move to where a PETSc function is defined, enter M-. and the
197#     function name.
198# 2) To search for a string and move to the first occurrence,
199#     use M-x tags-search and the string.
200#     To locate later occurrences, use M-,
201# Builds all etags files
202alletags:
203	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags
204	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_complete
205	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_noexamples
206	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_examples
207	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_makefiles
208# Builds the basic etags file.	This should be employed by most users.
209etags:
210	-${RM} ${TAGSDIR}/TAGS
211	-touch ${TAGSDIR}/TAGS
212	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcec alltree
213	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcej alltree
214	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourceh alltree
215	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcef alltree
216	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesc alltree
217	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesf alltree
218	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesch alltree
219	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesfh alltree
220	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_makefile alltree
221	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS etags_bmakefiles
222	-chmod g+w TAGS
223# Builds complete etags list; only for PETSc developers.
224etags_complete:
225	-${RM} ${TAGSDIR}/TAGS_COMPLETE
226	-touch ${TAGSDIR}/TAGS_COMPLETE
227	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_sourcec alltree
228	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_sourcej alltree
229	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_sourceh alltree
230	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_sourcef alltree
231	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_examplesc alltree
232	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_examplesf alltree
233	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_examplesch alltree
234	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_examplesfh alltree
235	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_makefile alltree
236	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE etags_bmakefiles
237	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_docs alltree
238	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_scripts alltree
239	-chmod g+w TAGS_COMPLETE
240# Builds the etags file that excludes the examples directories
241etags_noexamples:
242	-${RM} ${TAGSDIR}/TAGS_NO_EXAMPLES
243	-touch ${TAGSDIR}/TAGS_NO_EXAMPLES
244	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcec alltree
245	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcej alltree
246	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourceh alltree
247	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcef alltree
248	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_makefile alltree
249	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES etags_bmakefiles
250	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_docs alltree
251	-chmod g+w TAGS_NO_EXAMPLES
252# Builds the etags file for makefiles
253etags_makefiles:
254	-${RM} ${TAGSDIR}/TAGS_MAKEFILES
255	-touch ${TAGSDIR}/TAGS_MAKEFILES
256	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES ACTION=etags_makefile alltree
257	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES etags_bmakefiles
258	-chmod g+w TAGS_MAKEFILES
259# Builds the etags file for examples
260etags_examples:
261	-${RM} ${TAGSDIR}/TAGS_EXAMPLES
262	-touch ${TAGSDIR}/TAGS_EXAMPLES
263	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesc alltree
264	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesch alltree
265	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesf alltree
266	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
267	-chmod g+w TAGS_EXAMPLES
268etags_fexamples:
269	-${RM} ${TAGSDIR}/TAGS_FEXAMPLES
270	-touch ${TAGSDIR}/TAGS_FEXAMPLES
271	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_FEXAMPLES ACTION=etags_examplesf alltree
272	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
273	-chmod g+w TAGS_FEXAMPLES
274#
275# These are here for the target allci and allco, and etags
276#
277
278BMAKEFILES = bmake/common/base bmake/common/rules_win32 bmake/common/test \
279	     bmake/common/bopt* bmake/*/rules bmake/*/variables bmake/*/packages \
280	     bmake/*/petscconf.h bmake/*/petscfix.h bmake/win32/makefile.dos bmake/config/*.in \
281             bmake/*/buildtest bmake/adic.init bmake/adicmf.init
282DOCS	   = bmake/readme bmake/petscconf.defs
283SCRIPTS    = maint/addlinks maint/builddist maint/buildlinks maint/wwwman \
284	     maint/xclude maint/crontab  \
285	     maint/autoftp include/foldinclude/generateincludes
286
287updatewebdocs:
288	-chmod -R ug+w /mcs/tmp/petsc-tmp
289	-chgrp -R petsc /mcs/tmp/petsc-tmp
290	-/bin/rm -rf /mcs/tmp/petscdocs
291	-/bin/cp -r /mcs/tmp/petsc-tmp/docs /mcs/tmp/petscdocs
292	-maint/update-docs.py /mcs/tmp/petscdocs
293	-find /mcs/tmp/petscdocs -type d -name "*" -exec chmod g+w {} \;
294	-/bin/cp -r /mcs/tmp/petscdocs/* ${PETSC_DIR}/docs
295	-/bin/rm -rf /mcs/tmp/petscdocs
296
297# Builds all the documentation - should be done every night
298alldoc: allmanualpages
299	cd docs/tex/manual; ${OMAKE} manual.dvi manual.ps manual.html splitmanual.html
300
301# Deletes man pages (HTML version)
302deletemanualpages:
303	${RM} -f ${LOC}/docs/manualpages/*/*.html \
304                 ${LOC}/docs/manualpages/manualpages.cit
305
306# Builds all versions of the man pages
307allmanualpages: deletemanualpages
308	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
309	-${OMAKE} ACTION=manualpages tree_basic  LOC=${LOC}
310	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
311	-${OMAKE} ACTION=manexamples tree  LOC=${LOC}
312	-${OMAKE} manconcepts  LOC=${LOC}
313	-${OMAKE} ACTION=getexlist tree LOC=${LOC}
314	-${OMAKE} ACTION=exampleconcepts tree LOC=${LOC}
315	-maint/helpindex.py ${PETSC_DIR} ${LOC}
316	-@chmod g+w ${LOC}/docs/manualpages/*/*.html
317
318# Builds .html versions of the source
319allhtml:
320	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} tree LOC=${LOC}
321
322allcleanhtml:
323	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} tree
324
325# Builds Fortran stub files
326allfortranstubs:
327	-@include/foldinclude/generateincludes
328	-@${RM} -f src/fortran/auto/*.c
329	-${OMAKE} ACTION=fortranstubs tree_basic
330	-@cd src/fortran/auto; ${OMAKE} fixfortran
331	chmod g+w src/fortran/auto/*.c
332
333allci:
334	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
335
336allco:
337	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
338
339# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
340allrcslabel:
341	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
342#
343#   The commands below are for generating ADIC versions of the code;
344# they are not currently used.
345#
346alladicignore:
347	-@${RM} ${INSTALL_LIB_DIR}/adicignore
348	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
349
350alladic:
351	-@echo "Beginning to compile ADIC source code in all directories"
352	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
353	-@echo "========================================="
354	-@cd include ; \
355           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
356	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
357	-@cd src/inline ; \
358            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic
359	-@cd src/blaslapack ; \
360            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
361
362alladiclib:
363	-@echo "Beginning to compile ADIC libraries in all directories"
364	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
365	-@echo "-----------------------------------------"
366	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
367	-@echo "-----------------------------------------"
368	-@echo "Using configuration flags:"
369	-@grep "define " bmake/${PETSC_ARCH}/petscconf.h
370	-@echo "-----------------------------------------"
371	-@echo "Using include paths: ${PETSC_INCLUDE}"
372	-@echo "-----------------------------------------"
373	-@echo "Using PETSc directory: ${PETSC_DIR}"
374	-@echo "Using PETSc arch: ${PETSC_ARCH}"
375	-@echo "========================================="
376	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.a
377	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
378	-@cd src/blaslapack ; \
379            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
380	-@cd src/adic/src ; \
381            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib
382
383# -------------------------------------------------------------------------------
384#
385# Some macros to check if the fortran interface is up-to-date.
386#
387countfortranfunctions:
388	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
389	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
390	sed "s/_$$//" | sort > /tmp/countfortranfunctions
391
392countcfunctions:
393	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
394	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
395	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
396
397difffortranfunctions: countfortranfunctions countcfunctions
398	-@echo -------------- Functions missing in the fortran interface ---------------------
399	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
400	-@echo ----------------- Functions missing in the C interface ------------------------
401	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
402	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
403
404checkbadfortranstubs:
405	-@echo "========================================="
406	-@echo "Functions with MPI_Comm as an Argument"
407	-@echo "========================================="
408	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
409	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
410	-@echo "========================================="
411	-@echo "Functions with a String as an Argument"
412	-@echo "========================================="
413	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
414	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
415	-@echo "========================================="
416	-@echo "Functions with Pointers to PETSc Objects as Argument"
417	-@echo "========================================="
418	-@cd ${PETSC_DIR}/src/fortran/auto; \
419	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
420	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
421	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
422	for OBJ in $$_p_OBJ; do \
423	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
424	cut -d'(' -f1 | cut -d' ' -f1,3; \
425	done
426# Builds noise routines (not yet publically available)
427# Note:	 libfast cannot run on .F files on certain machines, so we
428# use lib and check for errors here.
429noise: info chklib_dir
430	-@echo "Beginning to compile noise routines"
431	-@echo "========================================="
432	-@cd src/snes/interface/noise; \
433	  ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib > trashz 2>&1; \
434	  grep -v clog trashz | grep -v "information sections" | \
435	  egrep -i '(Error|warning|Can)' >> /dev/null;\
436	  if [ "$$?" != 1 ]; then \
437	  cat trashz ; fi; ${RM} trashz
438	${RANLIB} ${INSTALL_LIB_DIR}/libpetscsnes.a
439	-@chmod g+w  ${INSTALL_LIB_DIR}/libpetscsnes.a
440	-@echo "Completed compiling noise routines"
441	-@echo "========================================="
442
443#
444# Automatically generates PETSc exercises in html from the tutorial examples.
445#
446# The introduction for each section is obtained from docs/manualpages/bop.${MANSEC} is under RCS and may be edited
447#  (used also in introductions to the manual pages)
448# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
449# The list of exercises is from TUTORIALS in each directory's makefile
450#
451# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
452# The pagemaker rule is in the file bmake/common (at the bottom)
453#
454# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
455#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
456#
457exercises:
458	-@echo "========================================="
459	-@echo "Generating HTML tutorial exercises"
460	-@${RM} docs/pageform.txt
461	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
462	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
463	-@echo "access_format=short"                        >> docs/pageform.txt
464	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
465	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
466	-@echo "Generating HTML for individual directories"
467	-@echo "========================================="
468	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
469	-@echo "Completed HTML for individual directories"
470	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
471	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
472	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
473	-@echo "========================================="
474
475.PHONY: info info_h build build_lt testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
476        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples updatewebdocs alldoc allmanualpages \
477        allhtml allcleanhtml allfortranstubs allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
478        countcfunctions difffortranfunctions checkbadfortranstubs noise exercises