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