xref: /petsc/makefile (revision a64a8e0274a74be50e9a5e5243fa71ef16fcaf3e)
1#
2# This is the makefile for compiling PETSc. See
3# http://www.mcs.anl.gov/petsc/documentation/installation.html for directions on installing PETSc.
4# See also conf for additional commands.
5#
6ALL: all
7LOCDIR	 = ./
8DIRS	 = src include tutorials
9CFLAGS	 =
10FFLAGS	 =
11CPPFLAGS =
12FPPFLAGS =
13
14# next line defines PETSC_DIR and PETSC_ARCH if they are not set
15include ././${PETSC_ARCH}/conf/petscvariables
16include ${PETSC_DIR}/conf/variables
17include ${PETSC_DIR}/conf/rules
18include ${PETSC_DIR}/conf/test
19
20#
21# Basic targets to build PETSc libraries.
22# all: builds the c, fortran, and f90 libraries
23all: chk_makej
24	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} chkpetsc_dir petscnagupgrade | tee ${PETSC_ARCH}/conf/make.log
25	@ln -sf ${PETSC_ARCH}/conf/make.log make.log
26	@if [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \
27	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-cmake 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log \
28		| egrep -v '( --check-build-system |cmake -E | -o CMakeFiles/petsc[[:lower:]]*.dir/| -o lib/libpetsc|CMakeFiles/petsc[[:lower:]]*\.dir/(build|depend|requires)|-f CMakeFiles/Makefile2|Dependee .* is newer than depender |provides\.build. is up to date)'; \
29	 else \
30	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-legacy 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log \
31                | ${GREP} -v "has no symbols"; \
32	 fi
33	@egrep -i "( error | error: |no such file or directory)" ${PETSC_ARCH}/conf/make.log | tee ${PETSC_ARCH}/conf/error.log > /dev/null
34	@if test -s ${PETSC_ARCH}/conf/error.log; then \
35           echo "********************************************************************" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
36           echo "  Error during compile, check ${PETSC_ARCH}/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
37           echo "  Send it and ${PETSC_ARCH}/conf/configure.log to petsc-maint@mcs.anl.gov" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log;\
38           echo "********************************************************************" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log;\
39	 else \
40	  ${OMAKE} shared_install PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log ;\
41        fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below
42	@if test -s ${PETSC_ARCH}/conf/error.log; then exit 1; fi
43
44all-cmake: chk_makej info cmakegen cmake
45
46all-legacy: chk_makej chklib_dir info deletelibs deletemods build shared_nomesg mpi4py petsc4py
47#
48# Prints information about the system and version of PETSc being compiled
49#
50info: chk_makej
51	-@echo "=========================================="
52	-@echo " "
53	-@echo "See documentation/faq.html and documentation/bugreporting.html"
54	-@echo "for help with installation problems. Please send EVERYTHING"
55	-@echo "printed out below when reporting problems"
56	-@echo " "
57	-@echo "To subscribe to the PETSc announcement list, send mail to "
58	-@echo "majordomo@mcs.anl.gov with the message: "
59	-@echo "subscribe petsc-announce"
60	-@echo " "
61	-@echo "To subscribe to the PETSc users mailing list, send mail to "
62	-@echo "majordomo@mcs.anl.gov with the message: "
63	-@echo "subscribe petsc-users"
64	-@echo " "
65	-@echo "=========================================="
66	-@echo On `date` on `hostname`
67	-@echo Machine characteristics: `uname -a`
68	-@echo "-----------------------------------------"
69	-@echo "Using PETSc directory: ${PETSC_DIR}"
70	-@echo "Using PETSc arch: ${PETSC_ARCH}"
71	-@echo "-----------------------------------------"
72	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
73	-@echo "-----------------------------------------"
74	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
75	-@echo "Using configuration flags:"
76	-@grep "\#define " ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h
77	-@echo "-----------------------------------------"
78	-@echo "Using C/C++ compile: ${PETSC_COMPILE}"
79	-@if [ "${PETSC_LANGUAGE}" = "CONLY" -a "${MPICC_SHOW}" != "" ]; then \
80             printf  "mpicc -show: %b\n" "${MPICC_SHOW}"; \
81	  elif [ "${PETSC_LANGUAGE}" = "CXXONLY" -a "${MPICXX_SHOW}" != "" ]; then \
82             printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \
83          fi;
84	-@if [ "${FC}" != "" ]; then \
85	   echo "Using Fortran compile: ${PETSC_FCOMPILE}";\
86           if [ "${MPIFC_SHOW}" != "" ]; then \
87             printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \
88           fi; \
89         fi
90	-@if [ "${CUDAC}" != "" ]; then \
91	   echo "Using CUDA compile: ${PETSC_CUCOMPILE}";\
92         fi
93	-@echo "-----------------------------------------"
94	-@echo "Using C/C++ linker: ${PCC_LINKER}"
95	-@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}"
96	-@if [ "${FC}" != "" ]; then \
97	   echo "Using Fortran linker: ${FC_LINKER}";\
98	   echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\
99         fi
100	-@echo "-----------------------------------------"
101	-@echo "Using libraries: ${PETSC_LIB}"
102	-@echo "------------------------------------------"
103	-@echo "Using mpiexec: ${MPIEXEC}"
104	-@echo "=========================================="
105
106#
107# Builds the PETSc libraries
108# This target also builds fortran77 and f90 interface
109# files and compiles .F files
110#
111build: chk_makej
112	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
113	-@echo "========================================="
114	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
115	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}  > tmpf 2>&1 ; ${GREP} -v "has no symbols" tmpf; ${RM} tmpf;
116	-@echo "Completed building libraries"
117	-@echo "========================================="
118#
119#
120# Builds PETSc test examples for a given architecture
121#
122check: test
123test:
124	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} test_build 2>&1 | tee ./${PETSC_ARCH}/conf/test.log
125testx:
126	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testx_build 2>&1 | tee ./${PETSC_ARCH}/conf/testx.log
127test_build:
128	-@echo "Running test examples to verify correct installation"
129	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
130	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
131	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
132	@if [ "${FC}" != "" ]; then cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
133	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
134	-@echo "Completed test examples"
135testx_build:
136	-@echo "Running graphics test example to verify correct X11 installation"
137	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
138	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
139	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testxex19
140	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
141	-@echo "Completed graphics test example"
142
143testexamples: info
144	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
145	-@echo "Due to different numerical round-off on certain"
146	-@echo "machines some of the numbers may not match exactly."
147	-@echo "========================================="
148	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C  tree
149	-@echo "Completed compiling and running test examples"
150	-@echo "========================================="
151testfortran: info
152	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
153	-@echo "========================================="
154	-@echo "Due to different numerical round-off on certain"
155	-@echo "machines or the way Fortran formats numbers"
156	-@echo "some of the results may not match exactly."
157	-@echo "========================================="
158	-@if [ "${FC}" != "" ]; then \
159            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran tree; \
160            echo "Completed compiling and running Fortran test examples"; \
161          else \
162            echo "Error: No FORTRAN compiler available"; \
163          fi
164	-@echo "========================================="
165testexamples_uni: info
166	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
167	-@echo "Due to different numerical round-off on certain"
168	-@echo "machines some of the numbers may not match exactly."
169	-@echo "========================================="
170	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C_X_MPIUni  tree
171	-@echo "Completed compiling and running uniprocessor test examples"
172	-@echo "========================================="
173testfortran_uni: info
174	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
175	-@echo "Due to different numerical round-off on certain"
176	-@echo "machines some of the numbers may not match exactly."
177	-@echo "========================================="
178	-@if [ "${FC}" != "" ]; then \
179            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran_MPIUni  tree; \
180            echo "Completed compiling and running uniprocessor fortran test examples"; \
181          else \
182            echo "Error: No FORTRAN compiler available"; \
183          fi
184	-@
185	-@echo "========================================="
186
187# Ranlib on the libraries
188ranlib:
189	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
190
191# Deletes PETSc libraries
192deletelibs: chk_makej
193	-${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.*
194deletemods: chk_makej
195	-${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod
196
197# Cleans up build
198allclean: deletelibs deletemods
199	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
200#
201reconfigure:
202	@${PYTHON} ${PETSC_ARCH}/conf/reconfigure-${PETSC_ARCH}.py
203#
204install:
205	@${PYTHON} ./config/install.py -destDir=${DESTDIR}
206
207newall:
208	-@cd src/sys;  @${PYTHON} ${PETSC_DIR}/config/builder.py
209	-@cd src/vec;  @${PYTHON} ${PETSC_DIR}/config/builder.py
210	-@cd src/mat;  @${PYTHON} ${PETSC_DIR}/config/builder.py
211	-@cd src/dm;   @${PYTHON} ${PETSC_DIR}/config/builder.py
212	-@cd src/ksp;  @${PYTHON} ${PETSC_DIR}/config/builder.py
213	-@cd src/snes; @${PYTHON} ${PETSC_DIR}/config/builder.py
214	-@cd src/ts;   @${PYTHON} ${PETSC_DIR}/config/builder.py
215
216streams:
217	cd src/benchmarks/streams; ${OMAKE} test
218# ------------------------------------------------------------------
219#
220# All remaining actions are intended for PETSc developers only.
221# PETSc users should not generally need to use these commands.
222#
223#  See the users manual for how the tags files may be used from Emacs and Vi/Vim
224#
225alletags:
226	-@${PYTHON} bin/maint/generateetags.py
227	-@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
228
229allfortranstubs:
230	-@${RM} -rf include/finclude/ftn-auto/*-tmpdir
231	-@${PYTHON} bin/maint/generatefortranstubs.py ${BFORT}  ${VERBOSE}
232	-@${PYTHON} bin/maint/generatefortranstubs.py -merge  ${VERBOSE}
233	-@${RM} -rf include/finclude/ftn-auto/*-tmpdir
234deletefortranstubs:
235	-@find . -type d -name ftn-auto | xargs rm -rf
236cmakegen:
237	-@${PYTHON} config/cmakegen.py
238#
239# These are here for the target allci and allco, and etags
240#
241
242BMAKEFILES = conf/variables conf/rules conf/test bmake/adic.init bmake/adicmf.init
243SCRIPTS    = bin/maint/builddist  bin/maint/wwwman bin/maint/xclude bin/maint/bugReport.py bin/maint/buildconfigtest bin/maint/builddistlite \
244             bin/maint/buildtest bin/maint/checkBuilds.py bin/maint/copylognightly bin/maint/copylognightly.tao bin/maint/countfiles bin/maint/findbadfiles \
245             bin/maint/fixinclude bin/maint/getexlist bin/maint/getpdflabels.py bin/maint/helpindex.py bin/maint/hosts.local bin/maint/hosts.solaris  \
246             bin/maint/lex.py  bin/maint/mapnameslatex.py bin/maint/startnightly bin/maint/startnightly.tao bin/maint/submitPatch.py \
247             bin/maint/update-docs.py  bin/maint/wwwindex.py bin/maint/xcludebackup bin/maint/xcludecblas bin/maint/zap bin/maint/zapall \
248             config/PETSc/Configure.py config/PETSc/Options.py \
249             config/PETSc/packages/*.py config/PETSc/utilities/*.py
250
251
252# Builds all the documentation - should be done every night
253alldoc: alldoc1 alldoc2 alldoc3 docsetdate
254
255# Build everything that goes into 'doc' dir except html sources
256alldoc1: chk_loc deletemanualpages chk_concepts_dir
257	-${PYTHON} bin/maint/countpetsccits.py
258	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
259	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
260	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
261	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
262	-cd src/docs/tex/manual; ${OMAKE} developers.pdf LOC=${LOC}
263	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
264	-${PYTHON} bin/maint/wwwindex.py ${PETSC_DIR} ${LOC}
265	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
266	-${OMAKE} manconcepts LOC=${LOC}
267	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
268	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
269	-${PYTHON} bin/maint/helpindex.py ${PETSC_DIR} ${LOC}
270
271# Builds .html versions of the source
272# html overwrites some stuff created by update-docs - hence this is done later.
273alldoc2: chk_loc
274	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
275	-${PYTHON} bin/maint/update-docs.py ${PETSC_DIR} ${LOC}
276#
277# Builds HTML versions of Matlab scripts
278alldoc3: chk_loc
279	if  [ "${MATLAB_COMMAND}" != "" ]; then\
280          export MATLABPATH=${MATLABPATH}:${PETSC_DIR}/bin/matlab; \
281          cd ${PETSC_DIR}/bin/matlab; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
282          cd classes; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
283          cd examples/tutorials; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
284        fi
285
286# modify all generated html files and add in version number, date, canonical URL info.
287docsetdate: chkpetsc_dir
288	@echo "Updating generated html files with petsc version, date, canonical URL info";\
289        version_release=`grep '^#define PETSC_VERSION_RELEASE ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
290        version_major=`grep '^#define PETSC_VERSION_MAJOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
291        version_minor=`grep '^#define PETSC_VERSION_MINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
292        version_patch=`grep '^#define PETSC_VERSION_PATCH ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
293        if  [ $${version_release} = 0 ]; then \
294          petscversion=petsc-dev; \
295          export petscversion; \
296        elif [ $${version_release} = 1 ]; then \
297          petscversion=petsc-$${version_major}.$${version_minor}-p$${version_patch}; \
298          export petscversion; \
299        else \
300          echo "Unknown PETSC_VERSION_RELEASE: $${version_release}"; \
301          exit; \
302        fi; \
303        datestr=`hg tip --template "{date|shortdate}"`; \
304        export datestr; \
305        find * -type d -wholename src/docs/website -prune -o -type d -wholename src/benchmarks/results -prune -o \
306          -type d -wholename arch-* -prune -o -type d -wholename src/tops -prune -o -type d -wholename externalpackages -prune -o \
307          -type f -wholename tutorials/multiphysics/tutorial.html -prune -o -type f -name \*.html \
308          -exec perl -pi -e 's^(<body.*>)^$$1\n   <div id=\"version\" align=right><b>$$ENV{petscversion} $$ENV{datestr}</b></div>^i' {} \; \
309          -exec perl -pi -e 's^(<head>)^$$1 <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/{}" />^i' {} \; ; \
310        echo "Done fixing version number, date, canonical URL info"
311
312alldocclean: deletemanualpages allcleanhtml
313
314# Deletes man pages (HTML version)
315deletemanualpages: chk_loc
316	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
317          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
318          ${RM} ${LOC}/docs/exampleconcepts ;\
319          ${RM} ${LOC}/docs/manconcepts ;\
320          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
321          ${PYTHON} bin/maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
322        fi
323
324allcleanhtml:
325	-${RM} include/adic/*.h.html
326	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
327
328chk_concepts_dir: chk_loc
329	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
330	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
331
332###########################################################
333# targets to build distribution and update docs
334###########################################################
335
336# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
337dist:
338	${PETSC_DIR}/bin/maint/builddist ${PETSC_DIR}
339
340# This target works only if you can do 'ssh petsc@login.mcs.anl.gov'
341# also copy the file over to ftp site.
342web-snapshot:
343	@if [ ! -f "${HOME}/petsc-dev.tar.gz" ]; then \
344	    echo "~/petsc-dev.tar.gz missing! cannot update petsc-dev snapshot on mcs-web-site"; \
345	  else \
346            echo "updating petsc-dev snapshot on mcs-web-site"; \
347	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
348	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-dev.tar.gz; \
349	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-dev/ \
350              petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-dev ;\
351	    /bin/cp -f /home/petsc/petsc-dev.tar.gz /mcs/ftp/pub/petsc/petsc-dev.tar.gz;\
352	    ${RM} -rf $${tmpdir} ;\
353	  fi
354
355# build the tarfile - and then update petsc-dev snapshot on mcs-web-site
356update-web-snapshot: dist web-snapshot
357
358# This target updates website main pages
359update-web:
360	@cd ${PETSC_DIR}/src/docs; make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
361	/usr/bin/rsync -az -C --exclude=documentation/index.html \
362          --exclude=documentation/installation.html --exclude=download/index.html \
363	  ${PETSC_DIR}/src/docs/website/ petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc
364	@cd ${PETSC_DIR}/docs; /usr/bin/rsync -az developers.pdf petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/developers/
365	@cd ${PETSC_DIR}/src/docs/tex; /usr/bin/rsync -az petscapp.bib petsc.bib petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/publications
366
367#
368#  builds a single list of files for each PETSc library so they may all be built in parallel
369#  without a recursive set of make calls
370createfastbuild:
371	cd src/vec; ${RM} -f files; /bin/echo -n "SOURCEC = " > files; make tree ACTION=sourcelist BASE_DIR=${PETSC_DIR}/src/vec
372
373###########################################################
374#
375#  See script for details
376#
377gcov:
378	-@${PETSC_DIR}/bin/maint/gcov.py -run_gcov
379
380mergegcov:
381	-@${PETSC_DIR}/bin/maint/gcov.py -merge_gcov ${LOC} *.tar.gz
382
383# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
384allrcslabel:
385	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
386#
387#   The commands below are for generating ADIC versions of the code;
388# they are not currently used.
389#
390alladicignore:
391	-@${RM} ${INSTALL_LIB_DIR}/adicignore
392	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
393
394alladic:
395	-@echo "Beginning to compile ADIC source code in all directories"
396	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
397	-@echo "========================================="
398	-@cd include ; \
399           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petscsys.h
400	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
401
402alladiclib:
403	-@echo "Beginning to compile ADIC libraries in all directories"
404	-@echo "Using compiler: ${PCC} ${COPTFLAGS}"
405	-@echo "-----------------------------------------"
406	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
407	-@echo "-----------------------------------------"
408	-@echo "Using configuration flags:"
409	-@grep "define " ${PETSC_ARCH}/include/petscconf.h
410	-@echo "-----------------------------------------"
411	-@echo "Using include paths: ${CC_PETSC_INCLUDE}"
412	-@echo "-----------------------------------------"
413	-@echo "Using PETSc directory: ${PETSC_DIR}"
414	-@echo "Using PETSc arch: ${PETSC_ARCH}"
415	-@echo "========================================="
416	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${AR_LIB_SUFFIX}
417	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
418	-@cd src/adic/src ; \
419            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} lib
420
421# -------------------------------------------------------------------------------
422#
423# Some macros to check if the fortran interface is up-to-date.
424#
425countfortranfunctions:
426	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
427	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
428	sed "s/_$$//" | sort > /tmp/countfortranfunctions
429
430countcfunctions:
431	-@grep extern ${PETSC_DIR}/include/*.h  | grep "(" | tr -s ' ' | \
432	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
433	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
434
435difffortranfunctions: countfortranfunctions countcfunctions
436	-@echo -------------- Functions missing in the fortran interface ---------------------
437	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
438	-@echo ----------------- Functions missing in the C interface ------------------------
439	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
440	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
441
442checkbadfortranstubs:
443	-@echo "========================================="
444	-@echo "Functions with MPI_Comm as an Argument"
445	-@echo "========================================="
446	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
447	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
448	-@echo "========================================="
449	-@echo "Functions with a String as an Argument"
450	-@echo "========================================="
451	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
452	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
453	-@echo "========================================="
454	-@echo "Functions with Pointers to PETSc Objects as Argument"
455	-@echo "========================================="
456	-@cd ${PETSC_DIR}/src/fortran/auto; \
457	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
458	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
459	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
460	for OBJ in $$_p_OBJ; do \
461	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
462	cut -d'(' -f1 | cut -d' ' -f1,3; \
463	done
464#
465# Automatically generates PETSc exercises in html from the tutorial examples.
466#
467# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
468#  (used also in introductions to the manual pages)
469# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
470# The list of exercises is from TUTORIALS in each directory's makefile
471#
472# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
473# The pagemaker rule is in the file conf (at the bottom)
474#
475# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
476#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
477#
478exercises:
479	-@echo "========================================="
480	-@echo "Generating HTML tutorial exercises"
481	-@${RM} docs/pageform.txt
482	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
483	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
484	-@echo "access_format=short"                        >> docs/pageform.txt
485	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
486	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
487	-@echo "Generating HTML for individual directories"
488	-@echo "========================================="
489	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
490	-@echo "Completed HTML for individual directories"
491	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
492	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
493	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
494	-@echo "========================================="
495
496.PHONY: info info_h all build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update \
497        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
498        allhtml allcleanhtml  allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
499        start_configure configure_petsc configure_clean
500
501petscao : petscmat petscao.f90.h
502petscdm : petscksp petscdm.f90.h
503petscdraw : petsc petscdraw.f90.h
504petscis : petsc petscis.f90.h
505petscksp : petscpc  petscksp.f90.h
506petsclog : petsc petsclog.f90.h
507petscmat : petscvec petscmat.f90.h
508petscmg : petscksp petscmg.f90.h
509petscpc : petscmat petscpc.f90.h
510petscsnes : petscksp petscsnes.f90.h
511petscsys : petsc petscsys.f90.h
512petscts : petscsnes petscts.f90.h
513petsc : petsc.f90.h
514petscvec : petscis petscvec.f90.h
515petscviewer : petsc petscviewer.f90.h
516petscmesh : petsc petscmesh.f90.h
517modules : petscao petscdm petscdraw petscis petscksp petsclog petscmat petscmg petscpc petscsnes petscsys petscts petsc petscvec petscviewer petscmesh
518