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