xref: /petsc/makefile (revision ab66e7628d261cbb66cdd29d76a6a59eb36aee60)
1#
2# This is the makefile for compiling PETSc. See
3# http://www.mcs.anl.gov/petsc/petsc-as/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
12include ${PETSC_DIR}/conf/base
13include ${PETSC_DIR}/conf/test
14
15#
16# Basic targets to build PETSc libraries.
17# all: builds the c, fortran, and f90 libraries
18all:
19	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  chkpetsc_dir
20	-@${OMAKE} all_build 2>&1 | tee ${PETSC_ARCH}/conf/make.log
21	-@egrep -i "( error | error:)" ${PETSC_ARCH}/conf/make.log > /dev/null; if [ "$$?" = "0" ]; then \
22           echo "********************************************************************"; \
23           echo "  Error during compile, check ${PETSC_ARCH}/conf/make.log"; \
24           echo "  Send it and ${PETSC_ARCH}/conf/configure.log to petsc-maint@mcs.anl.gov";\
25           echo "********************************************************************"; \
26           exit 1; fi
27
28all_build: chk_petsc_dir chklib_dir info info_h deletelibs  build shared
29#
30# Prints information about the system and version of PETSc being compiled
31#
32info:
33	-@echo "=========================================="
34	-@echo " "
35	-@echo "See documentation/faq.html and documentation/bugreporting.html"
36	-@echo "for help with installation problems. Please send EVERYTHING"
37	-@echo "printed out below when reporting problems"
38	-@echo " "
39	-@echo "To subscribe to the PETSc announcement list, send mail to "
40	-@echo "majordomo@mcs.anl.gov with the message: "
41	-@echo "subscribe petsc-announce"
42	-@echo " "
43	-@echo "To subscribe to the PETSc users mailing list, send mail to "
44	-@echo "majordomo@mcs.anl.gov with the message: "
45	-@echo "subscribe petsc-users"
46	-@echo " "
47	-@echo "=========================================="
48	-@echo On `date` on `hostname`
49	-@echo Machine characteristics: `uname -a`
50	-@echo "-----------------------------------------"
51	-@echo "Using PETSc directory: ${PETSC_DIR}"
52	-@echo "Using PETSc arch: ${PETSC_ARCH}"
53	-@echo "-----------------------------------------"
54	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
55	-@echo "-----------------------------------------"
56	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
57	-@echo "Using configuration flags:"
58	-@grep "\#define " ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h
59	-@echo "-----------------------------------------"
60	-@echo "Using include paths: ${PETSC_INCLUDE}"
61	-@echo "------------------------------------------"
62	-@echo "Using C/C++ compiler: ${PCC} ${PCC_FLAGS} ${COPTFLAGS} ${CFLAGS}"
63	-@echo "C/C++ Compiler version: " `${CCV}`
64	-@if [ "${FC}" != "" ]; then \
65	   echo "Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}";\
66	   echo "Fortran Compiler version: " `${FCV}`;\
67         fi
68	-@echo "-----------------------------------------"
69	-@echo "Using C/C++ linker: ${PCC_LINKER}"
70	-@if [ "${FC}" != "" ]; then \
71	   echo "Using Fortran linker: ${FC_LINKER}";\
72         fi
73	-@echo "-----------------------------------------"
74	-@echo "Using libraries: ${PETSC_LIB}"
75	-@echo "------------------------------------------"
76	-@echo "Using mpiexec: ${MPIEXEC}"
77	-@echo "=========================================="
78#
79#
80MINFO = ${PETSC_DIR}/${PETSC_ARCH}/include/petscmachineinfo.h
81info_h:
82	-@$(RM) -f ${MINFO} MINFO
83	-@echo  "static const char *petscmachineinfo = \"\__n__\"" >> MINFO
84	-@echo  "\"-----------------------------------------\__n__\"" >> MINFO
85	-@if [ -f /usr/bin/cygcheck.exe ]; then \
86	  echo  "\"Libraries compiled on `date` on `hostname|/usr/bin/dos2unix` \__n__\"" >> MINFO; \
87          else \
88	  echo  "\"Libraries compiled on `date` on `hostname` \__n__\"" >> MINFO; \
89          fi
90	-@echo  "\"Machine characteristics: `uname -a` \__n__\"" >> MINFO
91	-@echo  "\"Using PETSc directory: ${PETSC_DIR}\__n__\"" >> MINFO
92	-@echo  "\"Using PETSc arch: ${PETSC_ARCH}\__n__\"" >> MINFO
93	-@echo  "\"-----------------------------------------\"; " >> MINFO
94	-@echo  "static const char *petsccompilerinfo = \"\__n__\"" >> MINFO
95	-@echo  "\"Using C compiler: ${PCC} ${PCC_FLAGS} ${COPTFLAGS} ${CFLAGS}\__n__\"" >> MINFO
96	-@echo  "\"Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}\__n__\"" >> MINFO
97	-@echo  "\"-----------------------------------------\"; " >> MINFO
98	-@echo  "static const char *petsccompilerflagsinfo = \"\__n__\"" >> MINFO
99	-@echo  "\"Using include paths: ${PETSC_INCLUDE}\__n__\"" >> MINFO
100	-@echo  "\"------------------------------------------\"; " >> MINFO
101	-@echo  "static const char *petsclinkerinfo = \"\__n__\"" >> MINFO
102	-@echo  "\"Using C linker: ${CLINKER}\__n__\"" >> MINFO
103	-@echo  "\"Using Fortran linker: ${FLINKER}\__n__\"" >> MINFO
104	-@echo  "\"Using libraries: ${PETSC_LIB} \__n__\"" >> MINFO
105	-@echo  "\"------------------------------------------\"; " >> MINFO
106	-@cat MINFO | ${SED} -e 's/\\ /\\\\ /g' | ${SED} -e 's/__n__/n/g' > ${MINFO}
107	-@ if [ -f /usr/bin/cygcheck.exe ]; then /usr/bin/dos2unix ${MINFO} 2> /dev/null; fi
108	-@$(RM) -f MINFO
109
110#
111# Builds the PETSc libraries
112# This target also builds fortran77 and f90 interface
113# files and compiles .F files
114#
115build:
116	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
117	-@echo "========================================="
118	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
119	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
120	-@echo "Completed building libraries"
121	-@echo "========================================="
122#
123#
124# Builds PETSc test examples for a given architecture
125#
126test:
127	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  chkpetsc_dir
128	-@${OMAKE} test_build 2>&1 | tee ${PETSC_DIR}/${PETSC_ARCH}/conf/test.log
129test_build:
130	-@echo "Running test examples to verify correct installation"
131	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
132	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
133	@if [ "${FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
134	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
135	-@echo "Completed test examples"
136
137testexamples: info
138	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
139	-@echo "Due to different numerical round-off on certain"
140	-@echo "machines some of the numbers may not match exactly."
141	-@echo "========================================="
142	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C  tree
143	-@echo "Completed compiling and running test examples"
144	-@echo "========================================="
145testfortran: info
146	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
147	-@echo "========================================="
148	-@echo "Due to different numerical round-off on certain"
149	-@echo "machines or the way Fortran formats numbers"
150	-@echo "some of the results may not match exactly."
151	-@echo "========================================="
152	-@if [ "${FC}" != "" ]; then \
153            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran tree; \
154            echo "Completed compiling and running Fortran test examples"; \
155          else \
156            echo "Error: No FORTRAN compiler available"; \
157          fi
158	-@echo "========================================="
159testexamples_uni: info
160	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR 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_X11_MPIUni  tree
165	-@echo "Completed compiling and running uniprocessor test examples"
166	-@echo "========================================="
167testfortran_uni: info
168	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
169	-@echo "Due to different numerical round-off on certain"
170	-@echo "machines some of the numbers may not match exactly."
171	-@echo "========================================="
172	-@if [ "${FC}" != "" ]; then \
173            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran_MPIUni  tree; \
174            echo "Completed compiling and running uniprocessor fortran test examples"; \
175          else \
176            echo "Error: No FORTRAN compiler available"; \
177          fi
178	-@
179	-@echo "========================================="
180
181# Ranlib on the libraries
182ranlib:
183	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
184
185# Deletes PETSc libraries
186deletelibs:
187	-${RM} -f ${PETSC_LIB_DIR}/libpetsc*.*
188
189# Cleans up build
190allclean: deletelibs
191	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
192
193
194#
195# Check if PETSC_DIR variable specified is valid
196#
197chk_petsc_dir:
198	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
199	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
200	  echo "You need to use / to separate directories, not \\!"; \
201	  echo "Aborting build"; \
202	  false; fi
203#
204#
205install:
206	-@./config/install.py --rootDir=${PETSC_DIR} --installDir=${INSTALL_DIR} --arch=${PETSC_ARCH} --ranlib=${RANLIB} --make=${OMAKE} --libSuffix=${AR_LIB_SUFFIX}
207
208install_old:
209	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
210	  echo "Install directory is current directory; nothing needs to be done";\
211        else \
212	  echo Installing PETSc at ${INSTALL_DIR};\
213          if [ ! -d ${INSTALL_DIR} ]; then \
214	    ${MKDIR} ${INSTALL_DIR} ; \
215            if [ "$$?" -ne "0" ]; then \
216              echo "********************************************************************"; \
217              echo "Unable to crate ${INSTALL_DIR}. Perhaps you need to do 'sudo make install'"; \
218              echo "********************************************************************"; \
219              exit;\
220            fi;\
221          fi;\
222          ${CP} -fr include ${INSTALL_DIR};\
223          ${CP} -fr ${PETSC_ARCH}/include ${INSTALL_DIR};\
224          ${CP} -fr conf ${INSTALL_DIR} ; \
225          ${CP} -fr ${PETSC_ARCH}/conf ${INSTALL_DIR};\
226          ${CP} -fr bin ${INSTALL_DIR} ; \
227          ${CP} -fr ${PETSC_ARCH}/bin ${INSTALL_DIR};\
228	  grep -w PETSC_HAVE_SIEVE ${PETSC_ARCH}/include/petscconf.h > /dev/null; \
229	  if [ "$$?" = 0 ]; then \
230            ${CP} -f  src/dm/mesh/sieve/*.hh ${INSTALL_DIR}/include;\
231	    ${SEDINPLACE} "s?SIEVE_INCLUDE?REMOVE_SIEVE_INCLUDE?g" ${INSTALL_DIR}/conf/petscvariables ;\
232          fi;\
233          ${SEDINPLACE} "s?$${PETSC_DIR}?TMP_INSTALL_DIR?g" ${INSTALL_DIR}/conf/* ;\
234          ${SEDINPLACE} "s?${PETSC_DIR}/${PETSC_ARCH}?TMP_INSTALL_DIR?g" ${INSTALL_DIR}/conf/* ;\
235          ${SEDINPLACE} "s?${PETSC_DIR}?TMP_INSTALL_DIR?g" ${INSTALL_DIR}/conf/* ;\
236          ${SEDINPLACE} "s?TMP_INSTALL_DIR?${INSTALL_DIR}?g" ${INSTALL_DIR}/conf/* ;\
237          ${SEDINPLACE} "s?/$${PETSC_ARCH}??g" ${INSTALL_DIR}/conf/* ;\
238          ${CP} -fr ${PETSC_ARCH}/lib ${INSTALL_DIR} ;\
239          ${RANLIB} ${INSTALL_DIR}/lib/*.${AR_LIB_SUFFIX} ;\
240          ${OMAKE} PETSC_ARCH="" PETSC_DIR=${INSTALL_DIR} shared; \
241          echo "If using sh/bash, do the following:";\
242          echo "  PETSC_DIR=${INSTALL_DIR}; export PETSC_DIR";\
243          echo "  unset PETSC_ARCH" ;\
244          echo "If using csh/tcsh, do the following:";\
245          echo "  setenv PETSC_DIR ${INSTALL_DIR}" ;\
246          echo "  unsetenv PETSC_ARCH";\
247          echo "Now run the testsuite to verify the install with the following:" ;\
248          echo "  make test";\
249        fi;
250
251install_src:
252	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
253	  echo "You did not set a directory to install to";\
254        else \
255	  echo Installing PETSc source at ${INSTALL_DIR};\
256          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
257	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
258          fi;\
259          if [ ! -d ${INSTALL_DIR} ]; then \
260	    ${MKDIR} ${INSTALL_DIR} ; \
261          fi;\
262          ${CP} -fr src ${INSTALL_DIR};\
263        fi;
264
265install_docs:
266	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
267	  echo "You did not set a directory to install to";\
268        else \
269	  echo Installing PETSc documentation at ${INSTALL_DIR};\
270          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
271	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
272          fi;\
273          if [ ! -d ${INSTALL_DIR} ]; then \
274	    ${MKDIR} ${INSTALL_DIR} ; \
275          fi;\
276          ${CP} -fr docs ${INSTALL_DIR};\
277          ${RM} -fr docs/tex;\
278        fi;
279# ------------------------------------------------------------------
280#
281# All remaining actions are intended for PETSc developers only.
282# PETSc users should not generally need to use these commands.
283#
284
285# To access the tags in EMACS, type M-x visit-tags-table and specify
286# the file petsc/TAGS.
287# 1) To move to where a PETSc function is defined, enter M-. and the
288#     function name.
289# 2) To search for a string and move to the first occurrence,
290#     use M-x tags-search and the string.
291#     To locate later occurrences, use M-,
292# Builds all etags files
293alletags:
294	-@bin/maint/generateetags.py
295	-@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
296
297allfortranstubs:
298	-@bin/maint/generatefortranstubs.py ${BFORT}
299deletefortranstubs:
300	-@find . -type d -name ftn-auto | xargs rm -rf
301#
302# These are here for the target allci and allco, and etags
303#
304
305BMAKEFILES = conf/base conf/test bmake/adic.init bmake/adicmf.init
306SCRIPTS    = bin/maint/builddist  bin/maint/wwwman bin/maint/xclude bin/maint/bugReport.py bin/maint/buildconfigtest bin/maint/builddistlite \
307             bin/maint/buildtest bin/maint/checkBuilds.py bin/maint/copylognightly bin/maint/copylognightly.tao bin/maint/countfiles bin/maint/findbadfiles \
308             bin/maint/fixinclude bin/maint/getexlist bin/maint/getpdflabels.py bin/maint/helpindex.py bin/maint/hosts.local bin/maint/hosts.solaris  \
309             bin/maint/lex.py  bin/maint/mapnameslatex.py bin/maint/startnightly bin/maint/startnightly.tao bin/maint/submitPatch.py \
310             bin/maint/update-docs.py  bin/maint/wwwindex.py bin/maint/xcludebackup bin/maint/xcludecblas bin/maint/zap bin/maint/zapall \
311             config/PETSc/Configure.py config/PETSc/Options.py \
312             config/PETSc/packages/*.py config/PETSc/utilities/*.py
313
314
315# Builds all the documentation - should be done every night
316alldoc: alldoc1 alldoc2
317
318# Build everything that goes into 'doc' dir except html sources
319alldoc1: chk_loc deletemanualpages chk_concepts_dir
320	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
321	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
322	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
323	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
324	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
325	-bin/maint/wwwindex.py ${PETSC_DIR} ${LOC}
326	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
327	-${OMAKE} manconcepts LOC=${LOC}
328	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
329	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
330	-bin/maint/helpindex.py ${PETSC_DIR} ${LOC}
331	-grep -h Polymorphic include/*.h | grep -v '#define ' | sed "s?PetscPolymorphic[a-zA-Z]*(??g" | cut -f1 -d"{" > tmppoly
332	-bin/maint/processpoly.py ${PETSC_DIR} ${LOC}
333	-${RM} tmppoly
334
335# Builds .html versions of the source
336# html overwrites some stuff created by update-docs - hence this is done later.
337alldoc2: chk_loc
338	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
339	-bin/maint/update-docs.py ${PETSC_DIR} ${LOC}
340
341alldocclean: deletemanualpages allcleanhtml
342
343# Deletes man pages (HTML version)
344deletemanualpages: chk_loc
345	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
346          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
347          ${RM} ${LOC}/docs/exampleconcepts ;\
348          ${RM} ${LOC}/docs/manconcepts ;\
349          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
350          bin/maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
351        fi
352
353allcleanhtml:
354	-${RM} include/adic/*.h.html
355	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
356
357chk_concepts_dir: chk_loc
358	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
359	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
360
361###########################################################
362# targets to build distribution and update docs
363###########################################################
364
365# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
366dist:
367	${PETSC_DIR}/bin/maint/builddist ${PETSC_DIR}
368
369# This target works only if you can do 'ssh petsc@harley.mcs.anl.gov'
370# also copy the file over to ftp site.
371web-snapshot:
372	@if [ ! -f "${HOME}/petsc-dev.tar.gz" ]; then \
373	    echo "~/petsc-dev.tar.gz missing! cannot update petsc-dev snapshot on www-unix"; \
374	  else \
375            echo "updating petsc-dev snapshot on www-unix"; \
376	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
377	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-dev.tar.gz; \
378	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-dev/ \
379              petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as/snapshots/petsc-dev ;\
380	    /bin/cp -f /home/petsc/petsc-dev.tar.gz /nfs/ftp/pub/petsc/petsc-dev.tar.gz;\
381	    ${RM} -rf $${tmpdir} ;\
382	  fi
383
384# build the tarfile - and then update petsc-dev snapshot on www-unix
385update-web-snapshot: dist web-snapshot
386
387# This target updates website main pages
388update-web:
389	@cd ${PETSC_DIR}/src/docs; make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
390	/usr/bin/rsync -az -C --exclude=BitKeeper --exclude=documentation/installation.html \
391	  ${PETSC_DIR}/src/docs/website/ petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as
392	@cd ${PETSC_DIR}/src/docs/tex/manual; make developers.pdf PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} LOC=${PETSC_DIR}; \
393	/usr/bin/rsync -az developers.pdf petsc@harley.mcs.anl.gov:/nfs/www-unix/petsc/petsc-as/developers/
394
395#
396#  builds a single list of files for each PETSc library so they may all be built in parallel
397#  without a recursive set of make calls
398createfastbuild:
399	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
400
401###########################################################
402
403#
404#  makes .lines files for all source code
405#
406allgcov:
407	-@${RM} -rf /tmp/gcov
408	-@mkdir /tmp/gcov
409	-${OMAKE} ACTION=gcov PETSC_DIR=${PETSC_DIR} tree
410
411# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
412allrcslabel:
413	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
414#
415#   The commands below are for generating ADIC versions of the code;
416# they are not currently used.
417#
418alladicignore:
419	-@${RM} ${INSTALL_LIB_DIR}/adicignore
420	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
421
422alladic:
423	-@echo "Beginning to compile ADIC source code in all directories"
424	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
425	-@echo "========================================="
426	-@cd include ; \
427           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
428	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
429	-@cd src/inline ; \
430            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} adic
431
432alladiclib:
433	-@echo "Beginning to compile ADIC libraries in all directories"
434	-@echo "Using compiler: ${PCC} ${COPTFLAGS}"
435	-@echo "-----------------------------------------"
436	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
437	-@echo "-----------------------------------------"
438	-@echo "Using configuration flags:"
439	-@grep "define " ${PETSC_ARCH}/include/petscconf.h
440	-@echo "-----------------------------------------"
441	-@echo "Using include paths: ${PETSC_INCLUDE}"
442	-@echo "-----------------------------------------"
443	-@echo "Using PETSc directory: ${PETSC_DIR}"
444	-@echo "Using PETSc arch: ${PETSC_ARCH}"
445	-@echo "========================================="
446	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${AR_LIB_SUFFIX}
447	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
448	-@cd src/adic/src ; \
449            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} lib
450
451# -------------------------------------------------------------------------------
452#
453# Some macros to check if the fortran interface is up-to-date.
454#
455countfortranfunctions:
456	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
457	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
458	sed "s/_$$//" | sort > /tmp/countfortranfunctions
459
460countcfunctions:
461	-@grep extern ${PETSC_DIR}/include/*.h  | grep "(" | tr -s ' ' | \
462	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
463	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
464
465difffortranfunctions: countfortranfunctions countcfunctions
466	-@echo -------------- Functions missing in the fortran interface ---------------------
467	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
468	-@echo ----------------- Functions missing in the C interface ------------------------
469	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
470	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
471
472checkbadfortranstubs:
473	-@echo "========================================="
474	-@echo "Functions with MPI_Comm as an Argument"
475	-@echo "========================================="
476	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
477	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
478	-@echo "========================================="
479	-@echo "Functions with a String as an Argument"
480	-@echo "========================================="
481	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
482	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
483	-@echo "========================================="
484	-@echo "Functions with Pointers to PETSc Objects as Argument"
485	-@echo "========================================="
486	-@cd ${PETSC_DIR}/src/fortran/auto; \
487	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
488	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
489	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
490	for OBJ in $$_p_OBJ; do \
491	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
492	cut -d'(' -f1 | cut -d' ' -f1,3; \
493	done
494#
495# Automatically generates PETSc exercises in html from the tutorial examples.
496#
497# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
498#  (used also in introductions to the manual pages)
499# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
500# The list of exercises is from TUTORIALS in each directory's makefile
501#
502# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
503# The pagemaker rule is in the file conf (at the bottom)
504#
505# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
506#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
507#
508exercises:
509	-@echo "========================================="
510	-@echo "Generating HTML tutorial exercises"
511	-@${RM} docs/pageform.txt
512	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
513	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
514	-@echo "access_format=short"                        >> docs/pageform.txt
515	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
516	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
517	-@echo "Generating HTML for individual directories"
518	-@echo "========================================="
519	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
520	-@echo "Completed HTML for individual directories"
521	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
522	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
523	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
524	-@echo "========================================="
525
526.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
527        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
528        allhtml allcleanhtml  allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
529        start_configure configure_petsc configure_clean
530
531getsigs:
532	-@if [ ! -d src/sigs ]; then mkdir -p sigs; fi
533	-@echo ${PETSC_INCLUDE} > sigs/petsc_include
534	-@echo "#include \"petscvec.h\"" > sigs/vec.sigs.h
535	-@grep -h "enum " include/petscsys.h include/petscvec.h >> sigs/vec.sigs.h
536	-@grep " Vec[a-zA-Z][a-zA-Z]*(Vec," include/petscvec.h | grep EXTERN | grep -v "(\*)" | grep -v IS |grep -v VecType | sed "s/EXTERN PetscErrorCode PETSCVEC_DLLEXPORT//g" >> sigs/vec.sigs.h
537	-@echo "#include \"petscmat.h\"" > sigs/mat.sigs.h
538	-@grep "enum " include/petscmat.h | grep } >> sigs/mat.sigs.h
539	-@grep " Mat[a-zA-Z][a-zA-Z]*(Mat," include/petscmat.h | grep EXTERN | grep -v "(\*)" | grep -v IS |grep -v MatType | sed "s/EXTERN PetscErrorCode PETSCMAT_DLLEXPORT//g" >> sigs/mat.sigs.h
540	-@echo "#include \"petscpc.h\"" > sigs/pc.sigs.h
541	-@grep "enum " include/petscpc.h | grep } >> sigs/pc.sigs.h
542	-@grep " PC[a-zA-Z][a-zA-Z]*(PC," include/petscpc.h | grep EXTERN | grep -v "(\*)" | grep -v "(\*\*)" | grep -v IS |grep -v PCType | sed "s/EXTERN PetscErrorCode PETSCKSP_DLLEXPORT//g" >> sigs/pc.sigs.h
543	-@echo "#include \"petscksp.h\"" > sigs/ksp.sigs.h
544	-@grep "enum " include/petscksp.h | grep } >> sigs/ksp.sigs.h
545	-@grep " KSP[a-zA-Z][a-zA-Z]*(KSP," include/petscksp.h | grep EXTERN | grep -v "(\*)" | grep -v "(\*\*)" | grep -v IS |grep -v KSPType | sed "s/EXTERN PetscErrorCode PETSCKSP_DLLEXPORT//g" >> sigs/ksp.sigs.h
546	-@echo "#include \"petscsnes.h\"" > sigs/snes.sigs.h
547	-@grep " SNES[a-zA-Z][a-zA-Z]*(SNES," include/petscsnes.h | grep EXTERN | grep -v "(\*)" | grep -v "(\*\*)" | grep -v IS |grep -v SNESType | sed "s/EXTERN PetscErrorCode PETSCSNES_DLLEXPORT//g" >> sigs/snes.sigs.h
548
549
550
551
552
553
554
555
556
557
558
559petscao : petscmat petscao.f90.h
560petscda : petscksp petscda.f90.h
561petscdraw : petsc petscdraw.f90.h
562petscis : petsc petscis.f90.h
563petscksp : petscpc  petscksp.f90.h
564petsclog : petsc petsclog.f90.h
565petscmat : petscvec petscmat.f90.h
566petscmg : petscksp petscmg.f90.h
567petscpc : petscmat petscpc.f90.h
568petscsnes : petscksp petscsnes.f90.h
569petscsys : petsc petscsys.f90.h
570petscts : petscsnes petscts.f90.h
571petsc : petsc.f90.h
572petscvec : petscis petscvec.f90.h
573petscviewer : petsc petscviewer.f90.h
574modules : petscao petscda petscdraw petscis petscksp petsclog petscmat petscmg petscpc petscsnes petscsys petscts petsc petscvec petscviewer
575