xref: /petsc/makefile (revision a523d3127bc3ed18d68035dbf427fd8937089a6b)
1#
2# This is the makefile for compiling PETSc. See
3# http://www.mcs.anl.gov/petsc/petsc-as/documentation/installation.html for directions on installing PETSc.
4# See also conf for additional commands.
5#
6ALL: all
7LOCDIR	 = ./
8DIRS	 = src include
9CFLAGS	 =
10FFLAGS	 =
11
12include ${PETSC_DIR}/conf/base
13include ${PETSC_DIR}/conf/test
14
15#
16# Basic targets to build PETSc libraries.
17# all: builds the c, fortran, and f90 libraries
18all:
19	@if [ "`whoami`" = "root" ]; then \
20      echo "********************************************************************"; \
21      echo "  Do not run configure as root, or using sudo.";\
22      echo "    That should be reserved for installation";\
23      echo "********************************************************************"; \
24      exit 1; fi
25	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  chkpetsc_dir
26	-@${OMAKE} all_build 2>&1 | tee ${PETSC_ARCH}/make_log
27	-@egrep -i "( error | error:)" ${PETSC_ARCH}/make_log > /dev/null; if [ "$$?" = "0" ]; then \
28           echo "********************************************************************"; \
29           echo "  Error during compile, check ${PETSC_ARCH}/make_log"; \
30           echo "  Send it and configure.log to petsc-maint@mcs.anl.gov";\
31           echo "********************************************************************"; \
32           exit 1; fi
33
34all_build: chk_petsc_dir chklib_dir info info_h deletelibs  build shared
35#
36# Prints information about the system and version of PETSc being compiled
37#
38info:
39	-@echo "=========================================="
40	-@echo " "
41	-@echo "See documentation/faq.html and documentation/bugreporting.html"
42	-@echo "for help with installation problems. Please send EVERYTHING"
43	-@echo "printed out below when reporting problems"
44	-@echo " "
45	-@echo "To subscribe to the PETSc announcement list, send mail to "
46	-@echo "majordomo@mcs.anl.gov with the message: "
47	-@echo "subscribe petsc-announce"
48	-@echo " "
49	-@echo "To subscribe to the PETSc users mailing list, send mail to "
50	-@echo "majordomo@mcs.anl.gov with the message: "
51	-@echo "subscribe petsc-users"
52	-@echo " "
53	-@echo "=========================================="
54	-@echo On `date` on `hostname`
55	-@echo Machine characteristics: `uname -a`
56	-@echo "-----------------------------------------"
57	-@echo "Using PETSc directory: ${PETSC_DIR}"
58	-@echo "Using PETSc arch: ${PETSC_ARCH}"
59	-@echo "-----------------------------------------"
60	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
61	-@echo "-----------------------------------------"
62	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
63	-@echo "Using configuration flags:"
64	-@grep "\#define " ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h
65	-@echo "-----------------------------------------"
66	-@echo "Using include paths: ${PETSC_INCLUDE}"
67	-@echo "------------------------------------------"
68	-@echo "Using C/C++ compiler: ${PCC} ${PCC_FLAGS} ${COPTFLAGS} ${CFLAGS}"
69	-@echo "C/C++ Compiler version: " `${CCV}`
70	-@if [ "${FC}" != "" ]; then \
71	   echo "Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}";\
72	   echo "Fortran Compiler version: " `${FCV}`;\
73         fi
74	-@echo "-----------------------------------------"
75	-@echo "Using C/C++ linker: ${CC_LINKER}"
76	-@if [ "${FC}" != "" ]; then \
77	   echo "Using Fortran linker: ${FC_LINKER}";\
78         fi
79	-@echo "-----------------------------------------"
80	-@echo "Using libraries: ${PETSC_LIB}"
81	-@echo "------------------------------------------"
82	-@echo "Using mpiexec: ${MPIEXEC}"
83	-@echo "=========================================="
84#
85#
86MINFO = ${PETSC_DIR}/${PETSC_ARCH}/include/petscmachineinfo.h
87info_h:
88	-@$(RM) -f ${MINFO} MINFO
89	-@echo  "static const char *petscmachineinfo = \"\__n__\"" >> MINFO
90	-@echo  "\"-----------------------------------------\__n__\"" >> MINFO
91	-@if [ -f /usr/bin/cygcheck.exe ]; then \
92	  echo  "\"Libraries compiled on `date` on `hostname|/usr/bin/dos2unix` \__n__\"" >> MINFO; \
93          else \
94	  echo  "\"Libraries compiled on `date` on `hostname` \__n__\"" >> MINFO; \
95          fi
96	-@echo  "\"Machine characteristics: `uname -a` \__n__\"" >> MINFO
97	-@echo  "\"Using PETSc directory: ${PETSC_DIR}\__n__\"" >> MINFO
98	-@echo  "\"Using PETSc arch: ${PETSC_ARCH}\__n__\"" >> MINFO
99	-@echo  "\"-----------------------------------------\"; " >> MINFO
100	-@echo  "static const char *petsccompilerinfo = \"\__n__\"" >> MINFO
101	-@echo  "\"Using C compiler: ${PCC} ${PCC_FLAGS} ${COPTFLAGS} ${CFLAGS}\__n__\"" >> MINFO
102	-@echo  "\"Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}\__n__\"" >> MINFO
103	-@echo  "\"-----------------------------------------\"; " >> MINFO
104	-@echo  "static const char *petsccompilerflagsinfo = \"\__n__\"" >> MINFO
105	-@echo  "\"Using include paths: ${PETSC_INCLUDE}\__n__\"" >> MINFO
106	-@echo  "\"------------------------------------------\"; " >> MINFO
107	-@echo  "static const char *petsclinkerinfo = \"\__n__\"" >> MINFO
108	-@echo  "\"Using C linker: ${CLINKER}\__n__\"" >> MINFO
109	-@echo  "\"Using Fortran linker: ${FLINKER}\__n__\"" >> MINFO
110	-@echo  "\"Using libraries: ${PETSC_LIB} \__n__\"" >> MINFO
111	-@echo  "\"------------------------------------------\"; " >> MINFO
112	-@cat MINFO | ${SED} -e 's/\\ /\\\\ /g' | ${SED} -e 's/__n__/n/g' > ${MINFO}
113	-@ if [ -f /usr/bin/cygcheck.exe ]; then /usr/bin/dos2unix ${MINFO} 2> /dev/null; fi
114	-@$(RM) -f MINFO
115
116#
117# Builds the PETSc libraries
118# This target also builds fortran77 and f90 interface
119# files and compiles .F files
120#
121build:
122	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
123	-@echo "========================================="
124	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
125	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
126	-@echo "Completed building libraries"
127	-@echo "========================================="
128#
129# Builds the Python wrappers
130python:
131	-@if [ -d "${PETSC_DIR}/src/python/PETSc" ]; then \
132	  echo "COMPILING PYTHON WRAPPERS"; \
133	  echo "========================================="; \
134	  PYTHONPATH=${PYTHONPATH}:${PETSC_DIR}/python/BuildSystem ./make.py --with-petsc-arch=${PETSC_ARCH} --ignoreWarnings 0; \
135	  echo "Completed building Python wrappers"; \
136	  echo "========================================="; \
137	fi
138#
139# Builds PETSc test examples for a given architecture
140#
141test:
142	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  chkpetsc_dir
143	-@${OMAKE} test_build 2>&1 | tee ${PETSC_ARCH}/test_log
144test_build:
145	-@echo "Running test examples to verify correct installation"
146	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
147	@if [ "${FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
148	-@echo "Completed test examples"
149
150testexamples: info
151	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
152	-@echo "Due to different numerical round-off on certain"
153	-@echo "machines some of the numbers may not match exactly."
154	-@echo "========================================="
155	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C  tree
156	-@echo "Completed compiling and running test examples"
157	-@echo "========================================="
158testfortran: info
159	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
160	-@echo "========================================="
161	-@echo "Due to different numerical round-off on certain"
162	-@echo "machines or the way Fortran formats numbers"
163	-@echo "some of the results may not match exactly."
164	-@echo "========================================="
165	-@if [ "${FC}" != "" ]; then \
166            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran tree; \
167            echo "Completed compiling and running Fortran test examples"; \
168          else \
169            echo "Error: No FORTRAN compiler available"; \
170          fi
171	-@echo "========================================="
172testexamples_uni: info
173	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
174	-@echo "Due to different numerical round-off on certain"
175	-@echo "machines some of the numbers may not match exactly."
176	-@echo "========================================="
177	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C_X11_MPIUni  tree
178	-@echo "Completed compiling and running uniprocessor test examples"
179	-@echo "========================================="
180testfortran_uni: info
181	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
182	-@echo "Due to different numerical round-off on certain"
183	-@echo "machines some of the numbers may not match exactly."
184	-@echo "========================================="
185	-@if [ "${FC}" != "" ]; then \
186            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran_MPIUni  tree; \
187            echo "Completed compiling and running uniprocessor fortran test examples"; \
188          else \
189            echo "Error: No FORTRAN compiler available"; \
190          fi
191	-@
192	-@echo "========================================="
193
194# Ranlib on the libraries
195ranlib:
196	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
197
198# Deletes PETSc libraries
199deletelibs:
200	-${RM} -f ${PETSC_LIB_DIR}/libpetsc*.*
201
202# Cleans up build
203allclean: deletelibs
204	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
205
206
207#
208# Check if PETSC_DIR variable specified is valid
209#
210chk_petsc_dir:
211	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
212	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
213	  echo "You need to use / to separate directories, not \\!"; \
214	  echo "Aborting build"; \
215	  false; fi
216#
217#
218install:
219	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
220	  echo "Install directory is current directory; nothing needs to be done";\
221        else \
222	  echo Installing PETSc at ${INSTALL_DIR};\
223          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
224	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
225          fi;\
226          if [ ! -d ${INSTALL_DIR} ]; then \
227	    ${MKDIR} ${INSTALL_DIR} ; \
228          fi;\
229          ${CP} -fr include ${INSTALL_DIR};\
230          ${CP}  ${PETSC_ARCH}/include/* ${INSTALL_DIR}/include;\
231          if [ ! -d ${INSTALL_DIR}/conf ]; then \
232	    ${MKDIR} ${INSTALL_DIR}/conf ; \
233          fi;\
234          ${CP} -fr conf ${INSTALL_DIR} ; \
235          ${RM} -fr ${INSTALL_DIR}/conf/docsonly ;\
236          sed -i "" 's?$${PETSC_DIR}?TMP_INSTALL_DIR?g' ${INSTALL_DIR}/conf/* ;\
237          sed -i "" s?TMP_INSTALL_DIR?${INSTALL_DIR}?g ${INSTALL_DIR}/conf/* ;\
238          sed -i "" 's?/$${PETSC_ARCH}??g' ${INSTALL_DIR}/conf/* ;\
239          ${CP} -fr ${PETSC_ARCH}/conf/* ${INSTALL_DIR}/conf;\
240          ${CP} -fr ${PETSC_ARCH}/lib ${INSTALL_DIR} ;\
241          ${RANLIB} ${INSTALL_DIR}/lib/*.a ;\
242          ${OMAKE} PETSC_ARCH="" PETSC_DIR=${INSTALL_DIR} shared; \
243          echo "sh/bash: PETSC_DIR="${INSTALL_DIR}"; export PETSC_DIR";\
244          echo "sh/bash: unset PETSC_ARCH" ;\
245          echo "csh/tcsh: setenv PETSC_DIR " ${INSTALL_DIR} ;\
246          echo "csh/tcsh: unsetenv PETSC_ARCH"; \
247          echo "Then do make test to verify correct install";\
248        fi;
249
250install_src:
251	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
252	  echo "You did not set a directory to install to";\
253        else \
254	  echo Installing PETSc source at ${INSTALL_DIR};\
255          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
256	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
257          fi;\
258          if [ ! -d ${INSTALL_DIR} ]; then \
259	    ${MKDIR} ${INSTALL_DIR} ; \
260          fi;\
261          ${CP} -fr src ${INSTALL_DIR};\
262        fi;
263
264install_docs:
265	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
266	  echo "You did not set a directory to install to";\
267        else \
268	  echo Installing PETSc documentation at ${INSTALL_DIR};\
269          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
270	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
271          fi;\
272          if [ ! -d ${INSTALL_DIR} ]; then \
273	    ${MKDIR} ${INSTALL_DIR} ; \
274          fi;\
275          ${CP} -fr docs ${INSTALL_DIR};\
276          ${RM} -fr docs/tex;\
277        fi;
278# ------------------------------------------------------------------
279#
280# All remaining actions are intended for PETSc developers only.
281# PETSc users should not generally need to use these commands.
282#
283
284# To access the tags in EMACS, type M-x visit-tags-table and specify
285# the file petsc/TAGS.
286# 1) To move to where a PETSc function is defined, enter M-. and the
287#     function name.
288# 2) To search for a string and move to the first occurrence,
289#     use M-x tags-search and the string.
290#     To locate later occurrences, use M-,
291# Builds all etags files
292alletags:
293	-@maint/generateetags.py
294	-@find python -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
295
296allfortranstubs:
297	-@maint/generatefortranstubs.py ${BFORT}
298deletefortranstubs:
299	-@find . -type d -name ftn-auto | xargs rm -rf
300#
301# These are here for the target allci and allco, and etags
302#
303
304BMAKEFILES = conf/base conf/test bmake/adic.init bmake/adicmf.init
305SCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/bugReport.py maint/buildconfigtest maint/builddistlite \
306             maint/buildtest maint/checkBuilds.py maint/copylognightly maint/copylognightly.tao maint/countfiles maint/findbadfiles \
307             maint/fixinclude maint/getexlist maint/getpdflabels.py maint/helpindex.py maint/hosts.local maint/hosts.solaris  \
308             maint/lex.py  maint/mapnameslatex.py maint/startnightly maint/startnightly.tao maint/submitPatch.py \
309             maint/update-docs.py  maint/wwwindex.py maint/xcludebackup maint/xcludecblas maint/zap maint/zapall \
310             python/PETSc/Configure.py python/PETSc/Options.py \
311             python/PETSc/packages/*.py python/PETSc/utilities/*.py
312
313
314# Builds all the documentation - should be done every night
315alldoc: alldoc1 alldoc2
316
317# Build everything that goes into 'doc' dir except html sources
318alldoc1: chk_loc deletemanualpages chk_concepts_dir
319	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
320	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
321	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
322	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
323	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
324	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
325	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
326	-${OMAKE} manconcepts LOC=${LOC}
327	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
328	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
329	-maint/helpindex.py ${PETSC_DIR} ${LOC}
330	-grep -h Polymorphic include/*.h | grep -v '#define ' | sed "s?PetscPolymorphic[a-zA-Z]*(??g" | cut -f1 -d"{" > tmppoly
331	-maint/processpoly.py ${PETSC_DIR} ${LOC}
332	-${RM} tmppoly
333
334# Builds .html versions of the source
335# html overwrites some stuff created by update-docs - hence this is done later.
336alldoc2: chk_loc
337	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
338	-maint/update-docs.py ${PETSC_DIR} ${LOC}
339
340alldocclean: deletemanualpages allcleanhtml
341
342# Deletes man pages (HTML version)
343deletemanualpages: chk_loc
344	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
345          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
346          ${RM} ${LOC}/docs/exampleconcepts ;\
347          ${RM} ${LOC}/docs/manconcepts ;\
348          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
349          maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
350        fi
351
352allcleanhtml:
353	-${RM} include/adic/*.h.html
354	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
355
356chk_concepts_dir: chk_loc
357	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
358	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
359
360###########################################################
361# targets to build distribution and update docs
362###########################################################
363
364# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
365dist:
366	${PETSC_DIR}/maint/builddist ${PETSC_DIR}
367
368# This target works only if you can do 'ssh petsc@harley.mcs.anl.gov'
369# also copy the file over to ftp site.
370web-snapshot:
371	@if [ ! -f "${HOME}/petsc-dev.tar.gz" ]; then \
372	    echo "~/petsc-dev.tar.gz missing! cannot update petsc-dev snapshot on www-unix"; \
373	  else \
374            echo "updating petsc-dev snapshot on www-unix"; \
375	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
376	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-dev.tar.gz; \
377	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-dev/ \
378              petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as/snapshots/petsc-dev ;\
379	    /bin/cp -f /home/petsc/petsc-dev.tar.gz /nfs/ftp/pub/petsc/petsc-dev.tar.gz;\
380	    ${RM} -rf $${tmpdir} ;\
381	  fi
382
383# build the tarfile - and then update petsc-dev snapshot on www-unix
384update-web-snapshot: dist web-snapshot
385
386# This target updates website main pages
387update-web:
388	@cd ${PETSC_DIR}/src/docs; make PETSC_ARCH=docsonly PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
389	/usr/bin/rsync -az -C --exclude=BitKeeper --exclude=documentation/installation.html \
390	  ${PETSC_DIR}/src/docs/website/ petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as
391	@cd ${PETSC_DIR}/src/docs/tex/manual; make developers.pdf PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} LOC=${PETSC_DIR}; \
392	/usr/bin/rsync -az developers.pdf petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as/developers/
393
394###########################################################
395
396#
397#  makes .lines files for all source code
398#
399allgcov:
400	-@${RM} -rf /tmp/gcov
401	-@mkdir /tmp/gcov
402	-${OMAKE} ACTION=gcov PETSC_DIR=${PETSC_DIR} tree
403
404# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
405allrcslabel:
406	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
407#
408#   The commands below are for generating ADIC versions of the code;
409# they are not currently used.
410#
411alladicignore:
412	-@${RM} ${INSTALL_LIB_DIR}/adicignore
413	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
414
415alladic:
416	-@echo "Beginning to compile ADIC source code in all directories"
417	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
418	-@echo "========================================="
419	-@cd include ; \
420           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
421	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
422	-@cd src/inline ; \
423            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} adic
424
425alladiclib:
426	-@echo "Beginning to compile ADIC libraries in all directories"
427	-@echo "Using compiler: ${PCC} ${COPTFLAGS}"
428	-@echo "-----------------------------------------"
429	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
430	-@echo "-----------------------------------------"
431	-@echo "Using configuration flags:"
432	-@grep "define " ${PETSC_ARCH}/include/petscconf.h
433	-@echo "-----------------------------------------"
434	-@echo "Using include paths: ${PETSC_INCLUDE}"
435	-@echo "-----------------------------------------"
436	-@echo "Using PETSc directory: ${PETSC_DIR}"
437	-@echo "Using PETSc arch: ${PETSC_ARCH}"
438	-@echo "========================================="
439	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${AR_LIB_SUFFIX}
440	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
441	-@cd src/adic/src ; \
442            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} lib
443
444# -------------------------------------------------------------------------------
445#
446# Some macros to check if the fortran interface is up-to-date.
447#
448countfortranfunctions:
449	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
450	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
451	sed "s/_$$//" | sort > /tmp/countfortranfunctions
452
453countcfunctions:
454	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
455	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
456	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
457
458difffortranfunctions: countfortranfunctions countcfunctions
459	-@echo -------------- Functions missing in the fortran interface ---------------------
460	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
461	-@echo ----------------- Functions missing in the C interface ------------------------
462	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
463	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
464
465checkbadfortranstubs:
466	-@echo "========================================="
467	-@echo "Functions with MPI_Comm as an Argument"
468	-@echo "========================================="
469	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
470	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
471	-@echo "========================================="
472	-@echo "Functions with a String as an Argument"
473	-@echo "========================================="
474	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
475	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
476	-@echo "========================================="
477	-@echo "Functions with Pointers to PETSc Objects as Argument"
478	-@echo "========================================="
479	-@cd ${PETSC_DIR}/src/fortran/auto; \
480	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
481	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
482	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
483	for OBJ in $$_p_OBJ; do \
484	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
485	cut -d'(' -f1 | cut -d' ' -f1,3; \
486	done
487#
488# Automatically generates PETSc exercises in html from the tutorial examples.
489#
490# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
491#  (used also in introductions to the manual pages)
492# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
493# The list of exercises is from TUTORIALS in each directory's makefile
494#
495# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
496# The pagemaker rule is in the file conf (at the bottom)
497#
498# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
499#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
500#
501exercises:
502	-@echo "========================================="
503	-@echo "Generating HTML tutorial exercises"
504	-@${RM} docs/pageform.txt
505	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
506	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
507	-@echo "access_format=short"                        >> docs/pageform.txt
508	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
509	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
510	-@echo "Generating HTML for individual directories"
511	-@echo "========================================="
512	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
513	-@echo "Completed HTML for individual directories"
514	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
515	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
516	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
517	-@echo "========================================="
518
519# Make a tarball of all the Python code
520#   This is currently used to release to the Teragrid
521petscPython.tgz:
522	@tar cvzf $@ --exclude SCCS --exclude BitKeeper --dereference python/
523	-@scp $@ tg-login2.uc.teragrid.org:./
524
525.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
526        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
527        allhtml allcleanhtml  allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
528        start_configure configure_petsc configure_clean python
529
530getsigs:
531	-@if [ ! -d src/sigs ]; then mkdir -p sigs; fi
532	-@echo ${PETSC_INCLUDE} > sigs/petsc_include
533	-@echo "#include \"petscvec.h\"" > sigs/vec.sigs.h
534	-@grep -h "enum " include/petscsys.h include/petscvec.h >> sigs/vec.sigs.h
535	-@grep " Vec[a-zA-Z][a-zA-Z]*(Vec," include/petscvec.h | grep EXTERN | grep -v "(\*)" | grep -v IS |grep -v VecType | sed "s/EXTERN PetscErrorCode PETSCVEC_DLLEXPORT//g" >> sigs/vec.sigs.h
536	-@echo "#include \"petscmat.h\"" > sigs/mat.sigs.h
537	-@grep "enum " include/petscmat.h | grep } >> sigs/mat.sigs.h
538	-@grep " Mat[a-zA-Z][a-zA-Z]*(Mat," include/petscmat.h | grep EXTERN | grep -v "(\*)" | grep -v IS |grep -v MatType | sed "s/EXTERN PetscErrorCode PETSCMAT_DLLEXPORT//g" >> sigs/mat.sigs.h
539	-@echo "#include \"petscpc.h\"" > sigs/pc.sigs.h
540	-@grep "enum " include/petscpc.h | grep } >> sigs/pc.sigs.h
541	-@grep " PC[a-zA-Z][a-zA-Z]*(PC," include/petscpc.h | grep EXTERN | grep -v "(\*)" | grep -v "(\*\*)" | grep -v IS |grep -v PCType | sed "s/EXTERN PetscErrorCode PETSCKSP_DLLEXPORT//g" >> sigs/pc.sigs.h
542	-@echo "#include \"petscksp.h\"" > sigs/ksp.sigs.h
543	-@grep "enum " include/petscksp.h | grep } >> sigs/ksp.sigs.h
544	-@grep " KSP[a-zA-Z][a-zA-Z]*(KSP," include/petscksp.h | grep EXTERN | grep -v "(\*)" | grep -v "(\*\*)" | grep -v IS |grep -v KSPType | sed "s/EXTERN PetscErrorCode PETSCKSP_DLLEXPORT//g" >> sigs/ksp.sigs.h
545	-@echo "#include \"petscsnes.h\"" > sigs/snes.sigs.h
546	-@grep " SNES[a-zA-Z][a-zA-Z]*(SNES," include/petscsnes.h | grep EXTERN | grep -v "(\*)" | grep -v "(\*\*)" | grep -v IS |grep -v SNESType | sed "s/EXTERN PetscErrorCode PETSCSNES_DLLEXPORT//g" >> sigs/snes.sigs.h
547
548
549
550
551
552
553
554
555
556
557
558petscao : petscmat petscao.f90.h
559petscda : petscksp petscda.f90.h
560petscdraw : petsc petscdraw.f90.h
561petscis : petsc petscis.f90.h
562petscksp : petscpc  petscksp.f90.h
563petsclog : petsc petsclog.f90.h
564petscmat : petscvec petscmat.f90.h
565petscmg : petscksp petscmg.f90.h
566petscpc : petscmat petscpc.f90.h
567petscsnes : petscksp petscsnes.f90.h
568petscsys : petsc petscsys.f90.h
569petscts : petscsnes petscts.f90.h
570petsc : petsc.f90.h
571petscvec : petscis petscvec.f90.h
572petscviewer : petsc petscviewer.f90.h
573modules : petscao petscda petscdraw petscis petscksp petsclog petscmat petscmg petscpc petscsnes petscsys petscts petsc petscvec petscviewer
574