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