xref: /petsc/makefile (revision e005ede52eafe2fed2813abb7a7eb3df04d5f886)
1#
2# This is the makefile for installing PETSc. See
3# http://www.mcs.anl.gov/petsc/petsc-2/documentation/installation.html for directions on installing PETSc.
4# See also bmake/common for additional commands.
5#
6ALL: all
7LOCDIR = .
8DIRS   = src include
9
10include ${PETSC_DIR}/bmake/common/base
11include ${PETSC_DIR}/bmake/common/test
12
13#
14# Basic targets to build PETSc libraries.
15# all: builds the c, fortran, and f90 libraries
16all:
17	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} BOPT=${BOPT} chkpetsc_dir
18	-@${MAKE} all_build 2>&1 | tee make_log_${PETSC_ARCH}_${BOPT}
19all_build: chk_petsc_dir chk_default_bopt info info_h chklib_dir deletelibs chk_fortranstubs blaslapack mpich 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/C++ compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS}"
39	-@echo "C/C++ Compiler version: " `${C_CCV}`
40	-@if [ "${C_FC}" != "" ]; then \
41	   echo "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}";\
42	   echo "Fortran Compiler version: " `${C_FCV}`;\
43         fi
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/C++ linker: ${CLINKER}"
58	-@if [ "${C_FC}" != "" ]; then \
59	   echo "Using Fortran linker: ${FLINKER}";\
60         fi
61	-@echo "Using libraries: ${PETSC_LIB}"
62	-@echo "------------------------------------------"
63	-@echo "Using mpirun: ${MPIRUN}"
64	-@echo "=========================================="
65#
66#
67MINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
68info_h:
69	-@$(RM) -f MINFO ${MINFO}
70	-@echo  "static const char *petscmachineinfo = \"  " >> MINFO
71	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
72	-@echo  Machine characteristics: `uname -a` "" >> MINFO
73	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
74	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
75	-@echo  "-----------------------------------------\"; " >> MINFO
76	-@echo  "static const char *petsccompilerinfo = \"  " >> MINFO
77	-@echo  "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS} " >> MINFO
78	-@echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1 ; true
79	-@echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; true
80	-@echo  "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}" >> MINFO
81	-@echo  "Fortran Compiler version:" >> MINFO ; ${C_FCV} >> MINFO 2>&1 ; true
82	-@echo  "-----------------------------------------\"; " >> MINFO
83	-@echo  "static const char *petsccompilerflagsinfo = \"  " >> MINFO
84	-@echo  "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" >> MINFO
85	-@echo  "-----------------------------------------" >> MINFO
86	-@echo  "Using configuration flags:" >> MINFO
87	-@echo  "-----------------------------------------" >> MINFO
88	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
89	-@echo  "------------------------------------------\"; " >> MINFO
90	-@echo  "static const char *petsclinkerinfo = \"  " >> MINFO
91	-@echo  "Using C linker: ${CLINKER}" >> MINFO
92	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
93	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
94	-@cat MINFO | ${SED} -e 's/\
95//g'  | ${SED} -e 's/\^M//g' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}
96	-@$(RM) MINFO
97
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}/*.${LIB_SUFFIX}
108	-@echo "Completed building libraries"
109	-@echo "========================================="
110#
111#  Compiles the blas and lapack source code if found
112blaslapack:
113	-@if [ -d packages/f2cblaslapack/${PETSC_ARCH} -a ! -s packages/f2cblaslapack/${PETSC_ARCH}/libf2cblas.a ] ; then cd packages/f2cblaslapack;\
114        echo "=========================================";\
115        echo "Building C Blas/Lapack libraries";\
116        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
117        ${MV} libf2cblas.a libf2clapack.a ${PETSC_ARCH};\
118        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} cleanblaslapack ;\
119        echo "Completed C building Blas/Lapack libraries";\
120        echo "========================================="; fi
121	-@if [ -d packages/fblaslapack/${PETSC_ARCH} -a ! -s packages/fblaslapack/${PETSC_ARCH}/libfblas.a ] ; then cd packages/fblaslapack;\
122        echo "=========================================";\
123        echo "Building Fortran Blas/Lapack libraries";\
124        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
125        ${MV} libfblas.a libflapack.a ${PETSC_ARCH};\
126        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} cleanblaslapck ;\
127        echo "Completed building Fortran Blas/Lapack libraries";\
128        echo "========================================="; fi
129#
130#  Compiles MPICH if found
131mpich:
132	-@releasename=`ls -d packages/mpich* 2> /dev/null`;\
133        if [ -d packages/$${releasename}/${PETSC_ARCH} -a ! -d packages/$${releasename}/${PETSC_ARCH}/lib ] ; then cd packages/$${releasename} ;\
134          echo "=========================================";\
135          echo "Compiling and installing " $${releasename};\
136          make; make install; \
137          echo "=========================================";\
138        fi;
139#
140# Builds PETSc test examples for a given BOPT and architecture
141#
142test: chkopts
143	-@echo "Running test examples to verify correct installation"
144	@cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
145	@if [ "${C_FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
146	-@echo "Completed test examples"
147
148testexamples: info chkopts
149	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
150	-@echo "Due to different numerical round-off on certain"
151	-@echo "machines some of the numbers may not match exactly."
152	-@echo "========================================="
153	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_1  tree
154	-@echo "Completed compiling and running test examples"
155	-@echo "========================================="
156testfortran: info chkopts
157	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
158	-@echo "========================================="
159	-@echo "Due to different numerical round-off on certain"
160	-@echo "machines or the way Fortran formats numbers"
161	-@echo "some of the results may not match exactly."
162	-@echo "========================================="
163	-@if [ "${C_FC}" != "" ]; then \
164            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3 tree; \
165            echo "Completed compiling and running Fortran test examples"; \
166          else \
167            echo "Error: No FORTRAN compiler available"; \
168          fi
169	-@echo "========================================="
170testexamples_uni: info chkopts
171	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR 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_4  tree
176	-@echo "Completed compiling and running uniprocessor test examples"
177	-@echo "========================================="
178testfortran_uni: info chkopts
179	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
180	-@echo "Due to different numerical round-off on certain"
181	-@echo "machines some of the numbers may not match exactly."
182	-@echo "========================================="
183	-@if [ "${C_FC}" != "" ]; then \
184            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree; \
185            echo "Completed compiling and running uniprocessor fortran test examples"; \
186          else \
187            echo "Error: No FORTRAN compiler available"; \
188          fi
189	-@
190	-@echo "========================================="
191
192# Ranlib on the libraries
193ranlib:
194	${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
195
196# Deletes PETSc libraries
197deletelibs: chkopts_basic
198	-${RM} -f ${PETSC_LIB_DIR}/*
199
200# Cleans up build
201allclean: deletelibs
202	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
203
204
205#
206# Check if PETSC_DIR variable specified is valid
207#
208chk_petsc_dir:
209	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
210	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
211	  echo "You need to use / to separate directories, not \\!"; \
212	  echo "Aborting build"; \
213	  false; fi
214#
215# ${PETSC_DIR}/bmake/common/bopt_ is generated by configure - but if non-configure PETSC_ARCH
216# is used - create this file manually when libraries are created.
217#
218chk_default_bopt:
219	@if [ ! -f ${PETSC_DIR}/bmake/common/bopt_ ]; then \
220	  echo "BOPT=$$BOPT" > ${PETSC_DIR}/bmake/common/bopt_ ;\
221	fi
222install:
223	-@if [ "${INSTALL_DIR}" == "${PETSC_DIR}" ]; then \
224	  echo "Install directory is current directory; nothing needs to be done";\
225        else \
226	  echo Installing PETSc at ${INSTALL_DIR};\
227          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
228	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
229          fi;\
230          if [ ! -d ${INSTALL_DIR} ]; then \
231	    ${MKDIR} ${INSTALL_DIR} ; \
232          fi;\
233          cp -fr include ${INSTALL_DIR};\
234          if [ ! -d ${INSTALL_DIR}/bmake ]; then \
235	    ${MKDIR} ${INSTALL_DIR}/bmake ; \
236          fi;\
237          cp -f bmake/adic* bmake/variables ${INSTALL_DIR}/bmake ; \
238          cp -fr bmake/common ${INSTALL_DIR}/bmake;\
239          cp -fr bmake/${PETSC_ARCH} ${INSTALL_DIR}/bmake;\
240          cp -fr bin ${INSTALL_DIR};\
241          if [ ! -d ${INSTALL_DIR}/lib ]; then \
242	    ${MKDIR} ${INSTALL_DIR}/lib ; \
243          fi;\
244          for i in lib/lib*; do \
245            bopt=`echo $${i} | ${SED} s=lib/lib==g`;\
246            if [ ! -d ${INSTALL_DIR}/$${i} ]; then \
247              ${MKDIR} ${INSTALL_DIR}/$${i};\
248            fi; \
249            if [ -d $${i}/${PETSC_ARCH} ]; then \
250              cp -fr $${i}/${PETSC_ARCH} ${INSTALL_DIR}/$${i};\
251              ${RANLIB}  ${INSTALL_DIR}/$${i}/*.a > /dev/null 2>&1 ;\
252              ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${INSTALL_DIR} BOPT=$${bopt} shared; \
253            fi;\
254          done;\
255          echo "sh/bash: PETSC_DIR="${INSTALL_DIR}"; export PETSC_DIR";\
256          echo "csh/tcsh: setenv PETSC_DIR "${INSTALL_DIR} ;\
257          echo "The do make test to verify correct install";\
258        fi;
259
260install_src:
261	-@if [ "${INSTALL_DIR}" == "${PETSC_DIR}" ]; then \
262	  echo "You did not set a directory to install to";\
263        else \
264	  echo Installing PETSc source at ${INSTALL_DIR};\
265          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
266	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
267          fi;\
268          if [ ! -d ${INSTALL_DIR} ]; then \
269	    ${MKDIR} ${INSTALL_DIR} ; \
270          fi;\
271          cp -fr src ${INSTALL_DIR};\
272        fi;
273
274install_docs:
275	-@if [ "${INSTALL_DIR}" == "${PETSC_DIR}" ]; then \
276	  echo "You did not set a directory to install to";\
277        else \
278	  echo Installing PETSc documentation at ${INSTALL_DIR};\
279          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
280	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
281          fi;\
282          if [ ! -d ${INSTALL_DIR} ]; then \
283	    ${MKDIR} ${INSTALL_DIR} ; \
284          fi;\
285          cp -fr docs ${INSTALL_DIR};\
286          ${RM} -fr docs/tex;\
287        fi;
288# ------------------------------------------------------------------
289#
290# All remaining actions are intended for PETSc developers only.
291# PETSc users should not generally need to use these commands.
292#
293
294# To access the tags in EMACS, type M-x visit-tags-table and specify
295# the file petsc/TAGS.
296# 1) To move to where a PETSc function is defined, enter M-. and the
297#     function name.
298# 2) To search for a string and move to the first occurrence,
299#     use M-x tags-search and the string.
300#     To locate later occurrences, use M-,
301# Builds all etags files
302alletags:
303	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags
304	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_noexamples
305	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_examples
306	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_makefiles
307# Builds complete etags list
308etags:
309	-@${RM} ${TAGSDIR}/TAGS
310	-@touch ${TAGSDIR}/TAGS
311	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION="etags_sourcec etags_sourcej etags_sourceh etags_examplesc etags_examplesf etags_examplesch etags_examplesfh etags_makefile etags_docs etags_scripts" alltree
312	-@cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcef alltree
313	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS etags_bmakefiles
314# Builds the etags file that excludes the examples directories
315etags_noexamples:
316	-@${RM} ${TAGSDIR}/TAGS_NO_EXAMPLES
317	-@touch ${TAGSDIR}/TAGS_NO_EXAMPLES
318	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION="etags_sourcec etags_sourcej etags_sourceh etags_makefile etags_docs" alltree
319	-@cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcef alltree
320	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES etags_bmakefiles
321# Builds the etags file for makefiles
322etags_makefiles:
323	-@${RM} ${TAGSDIR}/TAGS_MAKEFILES
324	-@touch ${TAGSDIR}/TAGS_MAKEFILES
325	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES ACTION=etags_makefile alltree
326	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES etags_bmakefiles
327# Builds the etags file for examples
328etags_examples:
329	-@${RM} ${TAGSDIR}/TAGS_EXAMPLES
330	-@touch ${TAGSDIR}/TAGS_EXAMPLES
331	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION="etags_examplesc etags_examplesch etags_examplesf etags_examplesfh" alltree
332etags_fexamples:
333	-@${RM} ${TAGSDIR}/TAGS_FEXAMPLES
334	-@touch ${TAGSDIR}/TAGS_FEXAMPLES
335	-@${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_FEXAMPLES ACTION="etags_examplesf etags_examplesfh" alltree
336#
337# These are here for the target allci and allco, and etags
338#
339
340BMAKEFILES = bmake/common/base bmake/common/test \
341	     bmake/common/bopt* bmake/*/rules bmake/*/variables bmake/*/packages \
342	     bmake/*/petscconf.h bmake/*/petscfix.h bmake/config/packages.in \
343	     bmake/config/petscfix.h.in  bmake/config/rules.in  \
344	     bmake/config/variables.in bmake/adic.init bmake/adicmf.init
345DOCS	   = bmake/readme bmake/petscconf.defs
346SCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/bugReport.py maint/buildconfigtest maint/builddistlite \
347             maint/buildtest maint/checkBuilds.py maint/copylognightly maint/copylognightly.tao maint/countfiles maint/findbadfiles \
348             maint/fixinclude maint/getexlist maint/getpdflabels.py maint/helpindex.py maint/hosts.local maint/hosts.solaris killnightly \
349             maint/lex.py  maint/mapnameslatex.py maint/startnightly maint/startnightly.tao maint/submitPatch.py \
350             maint/update-docs.py maint/updatetestbk maint/wwwindex.py maint/xcludebackup maint/xcludecblas maint/zap maint/zapall \
351             python/PETSc/Configure.py python/PETSc/Options.py \
352             python/PETSc/packages/ADIC.py python/PETSc/packages/MPE.py python/PETSc/packages/Mathematica.py \
353             python/PETSc/packages/PLAPACK.py python/PETSc/packages/Triangle.py python/PETSc/packages/Matlab.py \
354             python/PETSc/packages/PVODE.py python/PETSc/packages/BlasLapack.py python/PETSc/packages/MPI.py \
355             python/PETSc/packages/BlockSolve.py python/PETSc/packages/NetCDF.py python/PETSc/packages/ParMetis.py \
356             python/PETSc/packages/update.py maint/confignightly/* config/*.py
357
358chk_loc:
359	@if [ ${LOC}foo = foo ] ; then \
360	  echo "*********************** ERROR ************************" ; \
361	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
362	  echo "******************************************************";  false; fi
363	@${MKDIR} ${LOC}/docs/manualpages
364
365# Builds all the documentation - should be done every night
366alldoc: alldoc1 alldoc2
367
368# Build everything that goes into 'doc' dir except html sources
369alldoc1: chk_loc deletemanualpages chk_concepts_dir
370	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
371	cd src/docs/tex/manual; ${OMAKE} build_manual.pdf LOC=${LOC}
372	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
373	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
374	-${OMAKE} ACTION=manexamples tree LOC=${LOC}
375	-${OMAKE} manconcepts LOC=${LOC}
376	-${OMAKE} ACTION=getexlist tree LOC=${LOC}
377	-${OMAKE} ACTION=exampleconcepts tree LOC=${LOC}
378	-maint/helpindex.py ${PETSC_DIR} ${LOC}
379
380# Builds .html versions of the source
381# html overwrites some stuff created by update-docs - hence this is done later.
382alldoc2: chk_loc
383	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
384	-maint/update-docs.py ${PETSC_DIR} ${LOC}
385
386alldocclean: deletemanualpages allcleanhtml
387
388# Deletes man pages (HTML version)
389deletemanualpages: chk_loc
390	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
391          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
392          ${RM} ${LOC}/docs/exampleconcepts ;\
393          ${RM} ${LOC}/docs/manconcepts ;\
394          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
395          maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
396        fi
397
398allcleanhtml:
399	-${RM} include/adic/*.h.html include/esi/petsc/*.h.html
400	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
401
402chk_concepts_dir: chk_loc
403	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
404	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
405#
406#  checks if should build Fortran stubs
407chk_fortranstubs:
408	-@if [ ! -f "${PETSC_DIR}/src/fortran/auto/makefile.src" -a "${C_FC}" != "" ]; then \
409          ${OMAKE} PETSC_DIR=${PETSC_DIR} allfortranstubs ;\
410        fi
411
412# Builds Fortran stub files
413allfortranstubs:
414	-@which ${BFORT} > /dev/null 2>&1;  \
415        if [ "$$?" != "0" ]; then \
416          echo "No bfort available, skipping building Fortran stubs";\
417        else \
418          ${RM} -f ${PETSC_DIR}/src/fortran/auto/*.c ;\
419	  touch ${PETSC_DIR}/src/fortran/auto/makefile.src ;\
420	  ${OMAKE} ACTION=fortranstubs tree_basic ;\
421	  cd ${PETSC_DIR}/src/fortran/auto; ${RM} makefile.src; echo SOURCEC = ` ls *.c | tr -s '\n' ' '` > makefile.src ;\
422	  cd ${PETSC_DIR}/src/fortran/auto; ${OMAKE} fixfortran ;\
423        fi
424
425allci:
426	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
427
428allco:
429	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
430
431# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
432allrcslabel:
433	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
434#
435#   The commands below are for generating ADIC versions of the code;
436# they are not currently used.
437#
438alladicignore:
439	-@${RM} ${INSTALL_LIB_DIR}/adicignore
440	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
441
442alladic:
443	-@echo "Beginning to compile ADIC source code in all directories"
444	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
445	-@echo "========================================="
446	-@cd include ; \
447           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
448	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
449	-@cd src/inline ; \
450            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic
451	-@cd src/blaslapack ; \
452            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
453
454alladiclib:
455	-@echo "Beginning to compile ADIC libraries in all directories"
456	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
457	-@echo "-----------------------------------------"
458	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
459	-@echo "-----------------------------------------"
460	-@echo "Using configuration flags:"
461	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
462	-@echo "-----------------------------------------"
463	-@echo "Using include paths: ${PETSC_INCLUDE}"
464	-@echo "-----------------------------------------"
465	-@echo "Using PETSc directory: ${PETSC_DIR}"
466	-@echo "Using PETSc arch: ${PETSC_ARCH}"
467	-@echo "========================================="
468	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${LIB_SUFFIX}
469	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
470	-@cd src/blaslapack ; \
471            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
472	-@cd src/adic/src ; \
473            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib
474
475# -------------------------------------------------------------------------------
476#
477# Some macros to check if the fortran interface is up-to-date.
478#
479countfortranfunctions:
480	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
481	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
482	sed "s/_$$//" | sort > /tmp/countfortranfunctions
483
484countcfunctions:
485	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
486	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
487	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
488
489difffortranfunctions: countfortranfunctions countcfunctions
490	-@echo -------------- Functions missing in the fortran interface ---------------------
491	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
492	-@echo ----------------- Functions missing in the C interface ------------------------
493	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
494	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
495
496checkbadfortranstubs:
497	-@echo "========================================="
498	-@echo "Functions with MPI_Comm as an Argument"
499	-@echo "========================================="
500	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
501	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
502	-@echo "========================================="
503	-@echo "Functions with a String as an Argument"
504	-@echo "========================================="
505	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
506	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
507	-@echo "========================================="
508	-@echo "Functions with Pointers to PETSc Objects as Argument"
509	-@echo "========================================="
510	-@cd ${PETSC_DIR}/src/fortran/auto; \
511	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
512	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
513	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
514	for OBJ in $$_p_OBJ; do \
515	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
516	cut -d'(' -f1 | cut -d' ' -f1,3; \
517	done
518#
519# Automatically generates PETSc exercises in html from the tutorial examples.
520#
521# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
522#  (used also in introductions to the manual pages)
523# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
524# The list of exercises is from TUTORIALS in each directory's makefile
525#
526# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
527# The pagemaker rule is in the file bmake/common (at the bottom)
528#
529# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
530#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
531#
532exercises:
533	-@echo "========================================="
534	-@echo "Generating HTML tutorial exercises"
535	-@${RM} docs/pageform.txt
536	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
537	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
538	-@echo "access_format=short"                        >> docs/pageform.txt
539	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
540	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
541	-@echo "Generating HTML for individual directories"
542	-@echo "========================================="
543	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
544	-@echo "Completed HTML for individual directories"
545	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
546	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
547	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
548	-@echo "========================================="
549
550# Make a tarball of all the Python code
551#   This is currently used to release to the Teragrid
552petscPython.tgz:
553	@tar cvzf $@ --exclude SCCS --exclude BitKeeper --dereference python/
554	-@scp $@ tg-login2.uc.teragrid.org:./
555
556.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
557        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
558        allhtml allcleanhtml allfortranstubs allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
559        start_configure configure_petsc configure_clean petscPython.tgz
560
561