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