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