xref: /petsc/makefile (revision 4482741e5b2e2bbc854fb1f8dba65221386520f2)
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 chk_fortranstubs 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 const 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 const 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 const 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 const 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	-@if [ "${C_FC}" != "" ]; then \
160            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3 tree; \
161            echo "Completed compiling and running Fortran test examples"; \
162          else \
163            echo "Error: No FORTRAN compiler available"; \
164          fi
165	-@echo "========================================="
166testexamples_uni: info chkopts
167	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
168	-@echo "Due to different numerical round-off on certain"
169	-@echo "machines some of the numbers may not match exactly."
170	-@echo "========================================="
171	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_4  tree
172	-@echo "Completed compiling and running uniprocessor test examples"
173	-@echo "========================================="
174testfortran_uni: info chkopts
175	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
176	-@echo "Due to different numerical round-off on certain"
177	-@echo "machines some of the numbers may not match exactly."
178	-@echo "========================================="
179	-@if [ "${C_FC}" != "" ]; then \
180            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree; \
181            echo "Completed compiling and running uniprocessor fortran test examples"; \
182          else \
183            echo "Error: No FORTRAN compiler available"; \
184          fi
185	-@
186	-@echo "========================================="
187
188# Ranlib on the libraries
189ranlib:
190	${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
191
192# Deletes PETSc libraries
193deletelibs: chkopts_basic
194	-${RM} -f ${PETSC_LIB_DIR}/*
195
196# Cleans up build
197allclean: deletelibs
198	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
199
200
201#
202# Check if PETSC_DIR variable specified is valid
203#
204chk_petsc_dir:
205	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
206	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
207	  echo "You need to use / to separate directories, not \\!"; \
208	  echo "Aborting build"; \
209	  false; fi
210
211# ------------------------------------------------------------------
212#
213# All remaining actions are intended for PETSc developers only.
214# PETSc users should not generally need to use these commands.
215#
216
217# To access the tags in EMACS, type M-x visit-tags-table and specify
218# the file petsc/TAGS.
219# 1) To move to where a PETSc function is defined, enter M-. and the
220#     function name.
221# 2) To search for a string and move to the first occurrence,
222#     use M-x tags-search and the string.
223#     To locate later occurrences, use M-,
224# Builds all etags files
225alletags:
226	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags
227	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_noexamples
228	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_examples
229	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_makefiles
230# Builds complete etags list
231etags:
232	-${RM} ${TAGSDIR}/TAGS
233	-touch ${TAGSDIR}/TAGS
234	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcec alltree
235	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcej alltree
236	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourceh alltree
237	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcef alltree
238	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesc alltree
239	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesf alltree
240	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesch alltree
241	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesfh alltree
242	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_makefile alltree
243	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS etags_bmakefiles
244	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_docs alltree
245	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_scripts alltree
246# Builds the etags file that excludes the examples directories
247etags_noexamples:
248	-${RM} ${TAGSDIR}/TAGS_NO_EXAMPLES
249	-touch ${TAGSDIR}/TAGS_NO_EXAMPLES
250	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcec alltree
251	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcej alltree
252	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourceh alltree
253	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcef alltree
254	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_makefile alltree
255	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES etags_bmakefiles
256	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_docs alltree
257# Builds the etags file for makefiles
258etags_makefiles:
259	-${RM} ${TAGSDIR}/TAGS_MAKEFILES
260	-touch ${TAGSDIR}/TAGS_MAKEFILES
261	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES ACTION=etags_makefile alltree
262	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES etags_bmakefiles
263# Builds the etags file for examples
264etags_examples:
265	-${RM} ${TAGSDIR}/TAGS_EXAMPLES
266	-touch ${TAGSDIR}/TAGS_EXAMPLES
267	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesc alltree
268	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesch alltree
269	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesf alltree
270	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
271etags_fexamples:
272	-${RM} ${TAGSDIR}/TAGS_FEXAMPLES
273	-touch ${TAGSDIR}/TAGS_FEXAMPLES
274	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_FEXAMPLES ACTION=etags_examplesf alltree
275	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
276#
277# These are here for the target allci and allco, and etags
278#
279
280BMAKEFILES = bmake/common/base bmake/common/test \
281	     bmake/common/bopt* bmake/*/rules bmake/*/variables bmake/*/packages \
282	     bmake/*/petscconf.h bmake/*/petscfix.h bmake/config/packages.in \
283	     bmake/config/petscfix.h.in  bmake/config/rules.in  \
284	     bmake/config/variables.in bmake/adic.init bmake/adicmf.init
285DOCS	   = bmake/readme bmake/petscconf.defs
286SCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/crontab python/PETSc/Configure.py python/PETSc/Options.py \
287             python/PETSc/packages/ADIC.py python/PETSc/packages/MPE.py python/PETSc/packages/Mathematica.py \
288             python/PETSc/packages/PLAPACK.py python/PETSc/packages/Triangle.py python/PETSc/packages/Matlab.py \
289             python/PETSc/packages/PVODE.py python/PETSc/packages/BlasLapack.py python/PETSc/packages/MPI.py \
290             python/PETSc/packages/BlockSolve.py python/PETSc/packages/NetCDF.py python/PETSc/packages/ParMetis.py \
291             python/PETSc/packages/update.py maint/confignightly/* config/*.py
292
293
294updatewebdocs:
295	-chmod -R ug+w /mcs/tmp/petsc-tmp
296	-chgrp -R petsc /mcs/tmp/petsc-tmp
297	-/bin/rm -rf /mcs/tmp/petscdocs
298	-/bin/cp -r /mcs/tmp/petsc-tmp/docs /mcs/tmp/petscdocs
299	-maint/update-docs.py /mcs/tmp/petscdocs
300	-find /mcs/tmp/petscdocs -type d -name "*" -exec chmod g+w {} \;
301	-/bin/cp -r /mcs/tmp/petscdocs/* ${PETSC_DIR}/docs
302	-/bin/rm -rf /mcs/tmp/petscdocs
303
304chk_loc:
305	@if [ ${LOC}foo = foo ] ; then \
306	  echo "*********************** ERROR ************************" ; \
307	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
308	  echo "******************************************************";  false; fi
309
310# Builds all the documentation - should be done every night
311alldoc: alldoc1 alldoc2
312
313# Build everything that goes into 'doc' dir except html sources
314alldoc1: chk_loc deletemanualpages chk_concepts_dir
315	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
316	cd docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
317	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
318	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
319	-${OMAKE} ACTION=manexamples tree LOC=${LOC}
320	-${OMAKE} manconcepts LOC=${LOC}
321	-${OMAKE} ACTION=getexlist tree LOC=${LOC}
322	-${OMAKE} ACTION=exampleconcepts tree LOC=${LOC}
323	-maint/helpindex.py ${PETSC_DIR} ${LOC}
324
325# Builds .html versions of the source
326# html overwrites some stuff created by update-docs - hence this is done later.
327alldoc2: chk_loc
328	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
329	-maint/update-docs.py ${LOC}
330
331alldocclean: deletemanualpages allcleanhtml
332
333# Deletes man pages (HTML version)
334deletemanualpages: chk_loc
335	find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \;
336	${RM} ${LOC}/docs/tex/exampleconcepts
337	${RM} ${LOC}/docs/tex/manconcepts
338	${RM} ${LOC}/docs/manualpages/manualpages.cit
339	-maint/update-docs.py ${LOC} clean
340
341allcleanhtml:
342	-${RM} include/adic/*.h.html include/esi/petsc/*.h.html
343	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
344
345chk_concepts_dir: chk_loc
346	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
347	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
348#
349#  checks if should build Fortran stubs
350chk_fortranstubs:
351	-@if [ ! -f "${PETSC_DIR}/src/fortran/auto/makefile.src" -a "${C_FC}" != "" ]; then \
352          ${OMAKE} PETSC_DIR=${PETSC_DIR} allfortranstubs ;\
353        fi
354
355# Builds Fortran stub files
356allfortranstubs:
357	-@which ${BFORT} > /dev/null 2>&1;  \
358        if [ "$$?" != "0" ]; then \
359          echo "No bfort available, skipping building Fortran stubs";\
360        else \
361          ${RM} -f ${PETSC_DIR}/src/fortran/auto/*.c ;\
362	  touch ${PETSC_DIR}/src/fortran/auto/makefile.src ;\
363	  ${OMAKE} ACTION=fortranstubs tree_basic ;\
364	  cd ${PETSC_DIR}/src/fortran/auto; ${RM} makefile.src; echo SOURCEC = ` ls *.c | tr -s '\n' ' '` > makefile.src ;\
365	  cd ${PETSC_DIR}/src/fortran/auto; ${OMAKE} fixfortran ;\
366        fi
367
368allci:
369	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
370
371allco:
372	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
373
374# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
375allrcslabel:
376	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
377#
378#   The commands below are for generating ADIC versions of the code;
379# they are not currently used.
380#
381alladicignore:
382	-@${RM} ${INSTALL_LIB_DIR}/adicignore
383	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
384
385alladic:
386	-@echo "Beginning to compile ADIC source code in all directories"
387	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
388	-@echo "========================================="
389	-@cd include ; \
390           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
391	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
392	-@cd src/inline ; \
393            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic
394	-@cd src/blaslapack ; \
395            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
396
397alladiclib:
398	-@echo "Beginning to compile ADIC libraries in all directories"
399	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
400	-@echo "-----------------------------------------"
401	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
402	-@echo "-----------------------------------------"
403	-@echo "Using configuration flags:"
404	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
405	-@echo "-----------------------------------------"
406	-@echo "Using include paths: ${PETSC_INCLUDE}"
407	-@echo "-----------------------------------------"
408	-@echo "Using PETSc directory: ${PETSC_DIR}"
409	-@echo "Using PETSc arch: ${PETSC_ARCH}"
410	-@echo "========================================="
411	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${LIB_SUFFIX}
412	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
413	-@cd src/blaslapack ; \
414            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
415	-@cd src/adic/src ; \
416            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib
417
418# -------------------------------------------------------------------------------
419#
420# Some macros to check if the fortran interface is up-to-date.
421#
422countfortranfunctions:
423	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
424	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
425	sed "s/_$$//" | sort > /tmp/countfortranfunctions
426
427countcfunctions:
428	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
429	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
430	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
431
432difffortranfunctions: countfortranfunctions countcfunctions
433	-@echo -------------- Functions missing in the fortran interface ---------------------
434	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
435	-@echo ----------------- Functions missing in the C interface ------------------------
436	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
437	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
438
439checkbadfortranstubs:
440	-@echo "========================================="
441	-@echo "Functions with MPI_Comm as an Argument"
442	-@echo "========================================="
443	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
444	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
445	-@echo "========================================="
446	-@echo "Functions with a String as an Argument"
447	-@echo "========================================="
448	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
449	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
450	-@echo "========================================="
451	-@echo "Functions with Pointers to PETSc Objects as Argument"
452	-@echo "========================================="
453	-@cd ${PETSC_DIR}/src/fortran/auto; \
454	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
455	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
456	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
457	for OBJ in $$_p_OBJ; do \
458	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
459	cut -d'(' -f1 | cut -d' ' -f1,3; \
460	done
461#
462# Automatically generates PETSc exercises in html from the tutorial examples.
463#
464# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
465#  (used also in introductions to the manual pages)
466# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
467# The list of exercises is from TUTORIALS in each directory's makefile
468#
469# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
470# The pagemaker rule is in the file bmake/common (at the bottom)
471#
472# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
473#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
474#
475exercises:
476	-@echo "========================================="
477	-@echo "Generating HTML tutorial exercises"
478	-@${RM} docs/pageform.txt
479	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
480	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
481	-@echo "access_format=short"                        >> docs/pageform.txt
482	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
483	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
484	-@echo "Generating HTML for individual directories"
485	-@echo "========================================="
486	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
487	-@echo "Completed HTML for individual directories"
488	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
489	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
490	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
491	-@echo "========================================="
492
493# Make a tarball of all the Python code
494#   This is currently used to release to the Teragrid
495petscPython.tgz:
496	@tar cvzf $@ --exclude SCCS --exclude BitKeeper --dereference python/
497	-@scp $@ tg-login2.uc.teragrid.org:./
498
499.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
500        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples updatewebdocs alldoc allmanualpages \
501        allhtml allcleanhtml allfortranstubs allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
502        start_configure configure_petsc configure_clean petscPython.tgz
503
504