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