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