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