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