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