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