xref: /petsc/makefile (revision b014e56c362ad3d2d14ac49f236e0c94d797d791)
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
13# next line defines PETSC_DIR and PETSC_ARCH if they are not set
14include ./${PETSC_ARCH}/conf/petscvariables
15include ${PETSC_DIR}/conf/variables
16include ${PETSC_DIR}/conf/rules
17include ${PETSC_DIR}/conf/test
18
19#
20# Basic targets to build PETSc libraries.
21# all: builds the c, fortran, and f90 libraries
22all:
23	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} chkpetsc_dir
24	-@${OMAKE} all_build PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} 2>&1  | tee ${PETSC_ARCH}/conf/make.log
25	-@if [ -L make.log ]; then ${RM} make.log; fi; ln -s ${PETSC_ARCH}/conf/make.log make.log
26	-@egrep -i "( error | error:)" ${PETSC_ARCH}/conf/make.log > /dev/null; if [ "$$?" = "0" ]; then \
27           echo "********************************************************************" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
28           echo "  Error during compile, check ${PETSC_ARCH}/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
29           echo "  Send it and ${PETSC_ARCH}/conf/configure.log to petsc-maint@mcs.anl.gov" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log;\
30           echo "********************************************************************" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
31           exit 1; \
32	 else \
33	  ${OMAKE} shared_install PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log ;\
34	 fi
35
36all_build: chk_petsc_dir chklib_dir info info_h deletelibs deletemods build shared_nomesg mpi4py petsc4py
37#
38# Prints information about the system and version of PETSc being compiled
39#
40info:
41	-@echo "=========================================="
42	-@echo " "
43	-@echo "See documentation/faq.html and documentation/bugreporting.html"
44	-@echo "for help with installation problems. Please send EVERYTHING"
45	-@echo "printed out below when reporting problems"
46	-@echo " "
47	-@echo "To subscribe to the PETSc announcement list, send mail to "
48	-@echo "majordomo@mcs.anl.gov with the message: "
49	-@echo "subscribe petsc-announce"
50	-@echo " "
51	-@echo "To subscribe to the PETSc users mailing list, send mail to "
52	-@echo "majordomo@mcs.anl.gov with the message: "
53	-@echo "subscribe petsc-users"
54	-@echo " "
55	-@echo "=========================================="
56	-@echo On `date` on `hostname`
57	-@echo Machine characteristics: `uname -a`
58	-@echo "-----------------------------------------"
59	-@echo "Using PETSc directory: ${PETSC_DIR}"
60	-@echo "Using PETSc arch: ${PETSC_ARCH}"
61	-@echo "-----------------------------------------"
62	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
63	-@echo "-----------------------------------------"
64	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
65	-@echo "Using configuration flags:"
66	-@grep "\#define " ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h
67	-@echo "-----------------------------------------"
68	-@echo "Using include paths: ${PETSC_INCLUDE}"
69	-@echo "------------------------------------------"
70	-@echo "Using C/C++ compiler: ${PCC} ${PCC_FLAGS} ${COPTFLAGS} ${CFLAGS}"
71	-@echo "C/C++ Compiler version: " `${CCV}`
72	-@if [ "${FC}" != "" ]; then \
73	   echo "Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}";\
74	   echo "Fortran Compiler version: " `${FCV}`;\
75         fi
76	-@echo "-----------------------------------------"
77	-@echo "Using C/C++ linker: ${PCC_LINKER}"
78	-@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}"
79	-@if [ "${FC}" != "" ]; then \
80	   echo "Using Fortran linker: ${FC_LINKER}";\
81	   echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\
82         fi
83	-@echo "-----------------------------------------"
84	-@echo "Using libraries: ${PETSC_LIB}"
85	-@echo "------------------------------------------"
86	-@echo "Using mpiexec: ${MPIEXEC}"
87	-@echo "=========================================="
88#
89#
90MINFO = ${PETSC_DIR}/${PETSC_ARCH}/include/petscmachineinfo.h
91info_h:
92	-@$(RM) -f ${MINFO} MINFO
93	-@echo  "static const char *petscmachineinfo = \"\__n__\"" >> MINFO
94	-@echo  "\"-----------------------------------------\__n__\"" >> MINFO
95	-@if [ -f /usr/bin/cygcheck.exe ]; then \
96	  echo  "\"Libraries compiled on `date` on `hostname|/usr/bin/dos2unix` \__n__\"" >> MINFO; \
97          else \
98	  echo  "\"Libraries compiled on `date` on `hostname` \__n__\"" >> MINFO; \
99          fi
100	-@echo  "\"Machine characteristics: `uname -a` \__n__\"" >> MINFO
101	-@echo  "\"Using PETSc directory: ${PETSC_DIR}\__n__\"" >> MINFO
102	-@echo  "\"Using PETSc arch: ${PETSC_ARCH}\__n__\"" >> MINFO
103	-@echo  "\"-----------------------------------------\"; " >> MINFO
104	-@echo  "static const char *petsccompilerinfo = \"\__n__\"" >> MINFO
105	-@echo  "\"Using C compiler: ${PCC} ${PCC_FLAGS} ${COPTFLAGS} ${CFLAGS}\__n__\"" >> MINFO
106	-@echo  "\"Using Fortran compiler: ${FC} ${FC_FLAGS} ${FFLAGS} ${FPP_FLAGS}\__n__\"" >> MINFO
107	-@echo  "\"-----------------------------------------\"; " >> MINFO
108	-@echo  "static const char *petsccompilerflagsinfo = \"\__n__\"" >> MINFO
109	-@echo  "\"Using include paths: ${PETSC_INCLUDE}\__n__\"" >> MINFO
110	-@echo  "\"------------------------------------------\"; " >> MINFO
111	-@echo  "static const char *petsclinkerinfo = \"\__n__\"" >> MINFO
112	-@echo  "\"Using C linker: ${CLINKER}\__n__\"" >> MINFO
113	-@echo  "\"Using Fortran linker: ${FLINKER}\__n__\"" >> MINFO
114	-@echo  "\"Using libraries: ${PETSC_LIB} \__n__\"" >> MINFO
115	-@echo  "\"------------------------------------------\"; " >> MINFO
116	-@cat MINFO | ${SED} -e 's/\\ /\\\\ /g' | ${SED} -e 's/__n__/n/g' > ${MINFO}
117	-@ if [ -f /usr/bin/cygcheck.exe ]; then /usr/bin/dos2unix ${MINFO} 2> /dev/null; fi
118	-@$(RM) -f MINFO
119
120#
121# Builds the PETSc libraries
122# This target also builds fortran77 and f90 interface
123# files and compiles .F files
124#
125build:
126	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
127	-@echo "========================================="
128	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
129	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}  > tmpf 2>&1 ; ${GREP} -v "has no symbols" tmpf; ${RM} tmpf;
130	-@echo "Completed building libraries"
131	-@echo "========================================="
132#
133#
134# Builds PETSc test examples for a given architecture
135#
136test:
137	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} test_build 2>&1 | tee ./${PETSC_ARCH}/conf/test.log
138testx11:
139	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testx11_build 2>&1 | tee ./${PETSC_ARCH}/conf/testx11.log
140test_build:
141	-@echo "Running test examples to verify correct installation"
142	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
143	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
144	@if [ "${FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
145	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
146	-@echo "Completed test examples"
147testx11_build:
148	-@echo "Running graphics test example to verify correct X11 installation"
149	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
150	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testx11ex19
151	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
152	-@echo "Completed graphics test example"
153
154testexamples: info
155	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
156	-@echo "Due to different numerical round-off on certain"
157	-@echo "machines some of the numbers may not match exactly."
158	-@echo "========================================="
159	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C  tree
160	-@echo "Completed compiling and running test examples"
161	-@echo "========================================="
162testfortran: info
163	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
164	-@echo "========================================="
165	-@echo "Due to different numerical round-off on certain"
166	-@echo "machines or the way Fortran formats numbers"
167	-@echo "some of the results may not match exactly."
168	-@echo "========================================="
169	-@if [ "${FC}" != "" ]; then \
170            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran tree; \
171            echo "Completed compiling and running Fortran test examples"; \
172          else \
173            echo "Error: No FORTRAN compiler available"; \
174          fi
175	-@echo "========================================="
176testexamples_uni: info
177	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
178	-@echo "Due to different numerical round-off on certain"
179	-@echo "machines some of the numbers may not match exactly."
180	-@echo "========================================="
181	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C_X11_MPIUni  tree
182	-@echo "Completed compiling and running uniprocessor test examples"
183	-@echo "========================================="
184testfortran_uni: info
185	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
186	-@echo "Due to different numerical round-off on certain"
187	-@echo "machines some of the numbers may not match exactly."
188	-@echo "========================================="
189	-@if [ "${FC}" != "" ]; then \
190            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran_MPIUni  tree; \
191            echo "Completed compiling and running uniprocessor fortran test examples"; \
192          else \
193            echo "Error: No FORTRAN compiler available"; \
194          fi
195	-@
196	-@echo "========================================="
197
198# Ranlib on the libraries
199ranlib:
200	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
201
202# Deletes PETSc libraries
203deletelibs:
204	-${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.*
205deletemods:
206	-${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod
207
208# Cleans up build
209allclean: deletelibs deletemods
210	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
211
212
213#
214# Check if PETSC_DIR variable specified is valid
215#
216chk_petsc_dir:
217	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
218	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
219	  echo "You need to use / to separate directories, not \\!"; \
220	  echo "Aborting build"; \
221	  false; fi
222#
223#
224install:
225	-@./config/install.py -destDir=${DESTDIR}
226
227newall:
228	-@cd src/sys; ${PETSC_DIR}/config/builder.py
229	-@cd src/vec; ${PETSC_DIR}/config/builder.py
230	-@cd src/mat; ${PETSC_DIR}/config/builder.py
231	-@cd src/dm; ${PETSC_DIR}/config/builder.py
232	-@cd src/ksp; ${PETSC_DIR}/config/builder.py
233	-@cd src/snes; ${PETSC_DIR}/config/builder.py
234	-@cd src/ts; ${PETSC_DIR}/config/builder.py
235# ------------------------------------------------------------------
236#
237# All remaining actions are intended for PETSc developers only.
238# PETSc users should not generally need to use these commands.
239#
240#  See the users manual for how the tags files may be used from Emacs and Vi/Vim
241#
242alletags:
243	-@bin/maint/generateetags.py
244	-@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
245
246allfortranstubs:
247	-@bin/maint/generatefortranstubs.py ${BFORT}
248deletefortranstubs:
249	-@find . -type d -name ftn-auto | xargs rm -rf
250#
251# These are here for the target allci and allco, and etags
252#
253
254BMAKEFILES = conf/variables conf/rules conf/test bmake/adic.init bmake/adicmf.init
255SCRIPTS    = bin/maint/builddist  bin/maint/wwwman bin/maint/xclude bin/maint/bugReport.py bin/maint/buildconfigtest bin/maint/builddistlite \
256             bin/maint/buildtest bin/maint/checkBuilds.py bin/maint/copylognightly bin/maint/copylognightly.tao bin/maint/countfiles bin/maint/findbadfiles \
257             bin/maint/fixinclude bin/maint/getexlist bin/maint/getpdflabels.py bin/maint/helpindex.py bin/maint/hosts.local bin/maint/hosts.solaris  \
258             bin/maint/lex.py  bin/maint/mapnameslatex.py bin/maint/startnightly bin/maint/startnightly.tao bin/maint/submitPatch.py \
259             bin/maint/update-docs.py  bin/maint/wwwindex.py bin/maint/xcludebackup bin/maint/xcludecblas bin/maint/zap bin/maint/zapall \
260             config/PETSc/Configure.py config/PETSc/Options.py \
261             config/PETSc/packages/*.py config/PETSc/utilities/*.py
262
263
264# Builds all the documentation - should be done every night
265alldoc: alldoc1 alldoc2
266
267# Build everything that goes into 'doc' dir except html sources
268alldoc1: chk_loc deletemanualpages chk_concepts_dir
269	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
270	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
271	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
272	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
273	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
274	-bin/maint/wwwindex.py ${PETSC_DIR} ${LOC}
275	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
276	-${OMAKE} manconcepts LOC=${LOC}
277	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
278	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
279	-bin/maint/helpindex.py ${PETSC_DIR} ${LOC}
280	-grep -h Polymorphic include/*.h | grep -v '#define ' | sed "s?PetscPolymorphic[a-zA-Z]*(??g" | cut -f1 -d"{" > tmppoly
281	-bin/maint/processpoly.py ${PETSC_DIR} ${LOC}
282	-${RM} tmppoly
283
284# Builds .html versions of the source
285# html overwrites some stuff created by update-docs - hence this is done later.
286alldoc2: chk_loc
287	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
288	-bin/maint/update-docs.py ${PETSC_DIR} ${LOC}
289
290alldocclean: deletemanualpages allcleanhtml
291
292# Deletes man pages (HTML version)
293deletemanualpages: chk_loc
294	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
295          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
296          ${RM} ${LOC}/docs/exampleconcepts ;\
297          ${RM} ${LOC}/docs/manconcepts ;\
298          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
299          bin/maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
300        fi
301
302allcleanhtml:
303	-${RM} include/adic/*.h.html
304	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
305
306chk_concepts_dir: chk_loc
307	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
308	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
309
310###########################################################
311# targets to build distribution and update docs
312###########################################################
313
314# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
315dist:
316	${PETSC_DIR}/bin/maint/builddist ${PETSC_DIR}
317
318# This target works only if you can do 'ssh petsc@harley.mcs.anl.gov'
319# also copy the file over to ftp site.
320web-snapshot:
321	@if [ ! -f "${HOME}/petsc-dev.tar.gz" ]; then \
322	    echo "~/petsc-dev.tar.gz missing! cannot update petsc-dev snapshot on mcs-web-site"; \
323	  else \
324            echo "updating petsc-dev snapshot on mcs-web-site"; \
325	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
326	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-dev.tar.gz; \
327	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-dev/ \
328              petsc@harley.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-as/snapshots/petsc-dev ;\
329	    /bin/cp -f /home/petsc/petsc-dev.tar.gz /mcs/ftp/pub/petsc/petsc-dev.tar.gz;\
330	    ${RM} -rf $${tmpdir} ;\
331	  fi
332
333# build the tarfile - and then update petsc-dev snapshot on mcs-web-site
334update-web-snapshot: dist web-snapshot
335
336# This target updates website main pages
337update-web:
338	@cd ${PETSC_DIR}/src/docs; make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
339	/usr/bin/rsync -az -C --exclude=BitKeeper --exclude=documentation/installation.html \
340	  ${PETSC_DIR}/src/docs/website/ petsc@harley.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-as
341	@cd ${PETSC_DIR}/src/docs/tex/manual; make developers.pdf PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} LOC=${PETSC_DIR}; \
342	/usr/bin/rsync -az developers.pdf petsc@harley.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-as/developers/
343
344#
345#  builds a single list of files for each PETSc library so they may all be built in parallel
346#  without a recursive set of make calls
347createfastbuild:
348	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
349
350###########################################################
351#
352#  See script for details
353#
354gcov:
355	-@${PETSC_DIR}/bin/maint/gcov.py -run_gcov
356
357mergegcov:
358	-@${PETSC_DIR}/bin/maint/gcov.py -merge_gcov ${LOC} *.tar.gz
359
360# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
361allrcslabel:
362	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
363#
364#   The commands below are for generating ADIC versions of the code;
365# they are not currently used.
366#
367alladicignore:
368	-@${RM} ${INSTALL_LIB_DIR}/adicignore
369	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
370
371alladic:
372	-@echo "Beginning to compile ADIC source code in all directories"
373	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
374	-@echo "========================================="
375	-@cd include ; \
376           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petscsys.h
377	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
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
521petscmesh : petsc petscmesh.f90.h
522modules : petscao petscda petscdraw petscis petscksp petsclog petscmat petscmg petscpc petscsnes petscsys petscts petsc petscvec petscviewer petscmesh
523