xref: /petsc/makefile (revision 19552e715ceb60353fcc546e09cccab4df7222a5)
1# $Id: makefile,v 1.353 2001/08/28 19:43:38 balay Exp $
2#
3# This is the makefile for installing PETSc. See the file
4# docs/installation.html for directions on installing PETSc.
5# See also bmake/common for additional commands.
6#
7ALL: all
8LOCDIR = .
9DIRS   = src include docs
10#
11# Configuration Variables
12#
13# Read configure options from a file if CONFIGURE_OPTIONSis not defined
14CONFIGURE_ARCH         = `config/configarch`
15CONFIGURE_OPTIONS_FILE = ./config/configure_options.${CONFIGURE_ARCH}
16CONFIGURE_OPTIONS      = $(shell cat $(CONFIGURE_OPTIONS_FILE))
17CONFIGURE_LOG_FILE     = configure_petsc.log
18AUTOMAKE_ADD_FILES     = config/config.guess config/config.sub config/install-sh config/missing config/mkinstalldirs \
19                         config/ltmain.sh
20BMAKE_TEMPLATE_FILES   = bmake/config/packages.in bmake/config/rules.in bmake/config/variables.in
21
22include ${PETSC_DIR}/bmake/common/base
23include ${PETSC_DIR}/bmake/common/test
24
25#
26# Configuration Targets
27#
28aclocal.m4: configure.in
29	@echo "Making $@" >> $(CONFIGURE_LOG_FILE)
30	@echo "----------------------------------------" >> $(CONFIGURE_LOG_FILE)
31	@aclocal >> $(CONFIGURE_LOG_FILE)
32
33bmake/config/petscconf.h.in: config/acconfig.h config/acsite.m4 configure.in
34	@echo "Making $@" >> $(CONFIGURE_LOG_FILE)
35	@echo "----------------------------------------" >> $(CONFIGURE_LOG_FILE)
36	@autoheader -l config >> $(CONFIGURE_LOG_FILE)
37
38$(AUTOMAKE_ADD_FILES):
39	@echo "Making $@" >> $(CONFIGURE_LOG_FILE)
40	@echo "----------------------------------------" >> $(CONFIGURE_LOG_FILE)
41	@automake --foreign --add-missing Makefile >> $(CONFIGURE_LOG_FILE)
42
43Makefile.am: $(AUTOMAKE_ADD_FILES)
44
45Makefile.in: Makefile.am
46	@echo "Making $@" >> $(CONFIGURE_LOG_FILE)
47	@echo "----------------------------------------" >> $(CONFIGURE_LOG_FILE)
48	@automake --foreign Makefile >> $(CONFIGURE_LOG_FILE)
49
50configure: configure.in config/acsite.m4 aclocal.m4 bmake/config/petscconf.h.in $(AUTOMAKE_ADD_FILES)
51	@echo "Making $@" >> $(CONFIGURE_LOG_FILE)
52	@echo "----------------------------------------" >> $(CONFIGURE_LOG_FILE)
53	@autoconf -l config >> $(CONFIGURE_LOG_FILE)
54
55start_configure:
56	-@$(RM) $(CONFIGURE_LOG_FILE)
57
58configure_petsc: start_configure configure Makefile.in
59	@echo "Configuring Petsc with options:" >> $(CONFIGURE_LOG_FILE)
60	@echo "$(CONFIGURE_OPTIONS)" >> $(CONFIGURE_LOG_FILE)
61	@echo "----------------------------------------" >> $(CONFIGURE_LOG_FILE)
62	@echo "$(CONFIGURE_OPTIONS)" > $(CONFIGURE_OPTIONS_FILE)
63	@./configure $(CONFIGURE_OPTIONS) >> $(CONFIGURE_LOG_FILE)
64
65$(CONFIGURE_OPTIONS_FILE):
66	touch $(CONFIGURE_OPTIONS_FILE)
67
68# We allow substring matching so that new configure architectures can be created
69$(CONFIGURE_LOG_FILE): $(CONFIGURE_OPTIONS_FILE) $(BMAKE_TEMPLATE_FILES)
70	@if test `${PETSC_DIR}/config/configarch | awk 'BEGIN {} {print match("${PETSC_ARCH}",$$1)} END{}'` -gt 0; then \
71	    $(MAKE) configure_petsc; \
72    else \
73        echo "Petsc is preconfigured for architecture ${PETSC_ARCH}" > $(CONFIGURE_LOG_FILE); \
74    fi
75
76configure_clean:
77	-@$(RM) aclocal.m4
78	-@$(RM) bmake/config/petscconf.h.in
79	-@$(RM) $(AUTOMAKE_ADD_FILES) Makefile.in
80	-@$(RM) configure
81#
82# Basic targets to build PETSc libraries.
83# all: builds the c, fortran, and f90 libraries
84all: $(CONFIGURE_LOG_FILE)
85	${MAKE} all_build
86# This is necessary if configure jsut created files to have them reread
87all_build: chk_petsc_dir info info_h chklib_dir deletelibs build shared
88#
89# Prints information about the system and version of PETSc being compiled
90#
91info:
92	-@echo "=========================================="
93	-@echo " "
94	-@echo "See docs/troubleshooting.html and docs/bugreporting.html"
95	-@echo "for help with installation problems. Please send EVERYTHING"
96	-@echo "printed out below when reporting problems"
97	-@echo " "
98	-@echo "To subscribe to the PETSc users mailing list, send mail to "
99	-@echo "majordomo@mcs.anl.gov with the message: "
100	-@echo "subscribe petsc-users"
101	-@echo " "
102	-@echo "=========================================="
103	-@echo On `date` on `hostname`
104	-@echo Machine characteristics: `uname -a`
105	-@echo "-----------------------------------------"
106	-@echo "Using C compiler: ${CC} ${COPTFLAGS} ${CCPPFLAGS}"
107	-@if [ -n "${C_CCV}" -a "${C_CCV}" != "unknown" ]; then \
108        echo "C Compiler version: " `${C_CCV}`; fi
109	-@echo "Using C++ compiler: ${CXX} ${COPTFLAGS} ${CCPPFLAGS}"
110	-@if [ -n "${CXX_CCV}" -a "${CXX_CCV}" != "unknown" ]; then \
111        echo "C++ Compiler version: " `${CXX_CCV}`; fi
112	-@echo "Using Fortran compiler: ${FC} ${FOPTFLAGS} ${FCPPFLAGS}"
113	-@if [ -n "${C_FCV}" -a "${C_FCV}" != "unknown" ]; then \
114	  echo "Fortran Compiler version: " `${C_FCV}`; fi
115	-@echo "-----------------------------------------"
116	-@grep PETSC_VERSION_NUMBER ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
117	-@echo "-----------------------------------------"
118	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
119	-@echo "-----------------------------------------"
120	-@echo "Using configuration flags:"
121	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
122	-@echo "-----------------------------------------"
123	-@echo "Using include paths: ${PETSC_INCLUDE}"
124	-@echo "-----------------------------------------"
125	-@echo "Using PETSc directory: ${PETSC_DIR}"
126	-@echo "Using PETSc arch: ${PETSC_ARCH}"
127	-@echo "------------------------------------------"
128	-@echo "Using C linker: ${CLINKER}"
129	-@echo "Using Fortran linker: ${FLINKER}"
130	-@echo "Using libraries: ${PETSC_LIB}"
131	-@echo "=========================================="
132#
133#
134MINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
135info_h:
136	-@$(RM) -f MINFO ${MINFO}
137	-@echo  "static char *petscmachineinfo = \"  " >> MINFO
138	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
139	-@echo  Machine characteristics: `uname -a` "" >> MINFO
140	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
141	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
142	-@echo  "-----------------------------------------\"; " >> MINFO
143	-@echo  "static char *petsccompilerinfo = \"  " >> MINFO
144	-@echo  "Using C compiler: ${CC} ${COPTFLAGS} ${CCPPFLAGS} " >> MINFO
145	-@if [  "${C_CCV}" -a "${C_CCV}" != "unknown" ] ; then \
146	  echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1; fi ; true
147	-@if [  "${CXX_CCV}" -a "${CXX_CCV}" != "unknown" ] ; then \
148	  echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; fi ; true
149	-@echo  "Using Fortran compiler: ${FC} ${FOPTFLAGS} ${FCPPFLAGS}" >> MINFO
150	-@if [  "${C_FCV}" -a "${C_FCV}" != "unknown" ] ; then \
151	  echo  "Fortran Compiler version:" >> MINFO ; ${C_FCV} >> MINFO 2>&1 ; fi ; true
152	-@echo  "-----------------------------------------\"; " >> MINFO
153	-@echo  "static char *petsccompilerflagsinfo = \"  " >> MINFO
154	-@echo  "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" >> MINFO
155	-@echo  "-----------------------------------------" >> MINFO
156	-@echo  "Using configuration flags:" >> MINFO
157	-@echo  "-----------------------------------------" >> MINFO
158	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
159	-@echo  "------------------------------------------\"; " >> MINFO
160	-@echo  "static char *petsclinkerinfo = \"  " >> MINFO
161	-@echo  "Using C linker: ${CLINKER}" >> MINFO
162	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
163	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
164	-@cat MINFO | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}
165	-@chmod g+w ${MINFO}
166	-@$(RM) MINFO
167#
168# Builds the PETSc libraries
169# This target also builds fortran77 and f90 interface
170# files and compiles .F files
171#
172build:
173	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
174	-@echo "========================================="
175	${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree \
176         2>&1 | tee make_log_${BOPT} | egrep "(^lib|^*\.c:|Error)"
177	${RANLIB} ${PETSC_LIB_DIR}/*.a
178	-@chmod g+w  ${PETSC_LIB_DIR}/*.a
179	-@echo "Completed building libraries"
180	-@echo "========================================="
181#
182# Builds the PETSc libraries
183# This target is the same as 'build', but uses the 'lib' target instead
184#
185build_lt:
186	-@echo "BEGINNING TO COMPILE LIBTOOL LIBRARIES IN ALL DIRECTORIES"
187	-@echo "========================================="
188	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=lib tree \
189          2>&1 | tee make_log_${BOPT} | egrep "(^lib|^*\.c:|Error)"
190	-@echo "Completed building libraries"
191	-@echo "========================================="
192#
193# Builds PETSc test examples for a given BOPT and architecture
194#
195testexamples: info chkopts
196	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
197	-@echo "Due to different numerical round-off on certain"
198	-@echo "machines some of the numbers may not match exactly."
199	-@echo "========================================="
200	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_1  tree
201	-@echo "Completed compiling and running test examples"
202	-@echo "========================================="
203testfortran: info chkopts
204	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
205	-@echo "========================================="
206	-@echo "Due to different numerical round-off on certain"
207	-@echo "machines or the way Fortran formats numbers"
208	-@echo "some of the results may not match exactly."
209	-@echo "========================================="
210	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3  tree
211	-@echo "Completed compiling and running Fortran test examples"
212	-@echo "========================================="
213testexamples_uni: info chkopts
214	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
215	-@echo "Due to different numerical round-off on certain"
216	-@echo "machines some of the numbers may not match exactly."
217	-@echo "========================================="
218	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_4  tree
219	-@echo "Completed compiling and running uniprocessor test examples"
220	-@echo "========================================="
221testfortran_uni: info chkopts
222	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
223	-@echo "Due to different numerical round-off on certain"
224	-@echo "machines some of the numbers may not match exactly."
225	-@echo "========================================="
226	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree
227	-@echo "Completed compiling and running uniprocessor fortran test examples"
228	-@echo "========================================="
229
230# Ranlib on the libraries
231ranlib:
232	${RANLIB} ${PETSC_LIB_DIR}/*.a
233
234# Deletes PETSc libraries
235deletelibs: chkopts_basic
236	-${RM} -f ${PETSC_LIB_DIR}/*
237
238# Cleans up build
239allclean: deletelibs
240	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
241
242#
243#   Updates your PETSc version to the latest set of patches
244#
245update:
246	-@bin/petscupdate
247
248#
249# Check if PETSC_DIR variable specified is valid
250#
251chk_petsc_dir:
252	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
253	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
254	  echo "You need to use / to separate directories, not \\!"; \
255	  echo "Aborting build"; \
256	  false; fi
257
258# ------------------------------------------------------------------
259#
260# All remaining actions are intended for PETSc developers only.
261# PETSc users should not generally need to use these commands.
262#
263
264# To access the tags in EMACS, type M-x visit-tags-table and specify
265# the file petsc/TAGS.
266# 1) To move to where a PETSc function is defined, enter M-. and the
267#     function name.
268# 2) To search for a string and move to the first occurrence,
269#     use M-x tags-search and the string.
270#     To locate later occurrences, use M-,
271# Builds all etags files
272alletags:
273	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags
274	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_complete
275	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_noexamples
276	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_examples
277	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_makefiles
278# Builds the basic etags file.	This should be employed by most users.
279etags:
280	-${RM} ${TAGSDIR}/TAGS
281	-touch ${TAGSDIR}/TAGS
282	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcec alltree
283	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcej alltree
284	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourceh alltree
285	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcef alltree
286	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesc alltree
287	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesf alltree
288	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesch alltree
289	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesfh alltree
290	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_makefile alltree
291	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS etags_bmakefiles
292	-chmod g+w TAGS
293# Builds complete etags list; only for PETSc developers.
294etags_complete:
295	-${RM} ${TAGSDIR}/TAGS_COMPLETE
296	-touch ${TAGSDIR}/TAGS_COMPLETE
297	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_sourcec alltree
298	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_sourcej alltree
299	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_sourceh alltree
300	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_sourcef alltree
301	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_examplesc alltree
302	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_examplesf alltree
303	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_examplesch alltree
304	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_examplesfh alltree
305	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_makefile alltree
306	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE etags_bmakefiles
307	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_docs alltree
308	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_COMPLETE ACTION=etags_scripts alltree
309	-chmod g+w TAGS_COMPLETE
310# Builds the etags file that excludes the examples directories
311etags_noexamples:
312	-${RM} ${TAGSDIR}/TAGS_NO_EXAMPLES
313	-touch ${TAGSDIR}/TAGS_NO_EXAMPLES
314	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcec alltree
315	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcej alltree
316	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourceh alltree
317	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcef alltree
318	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_makefile alltree
319	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES etags_bmakefiles
320	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_docs alltree
321	-chmod g+w TAGS_NO_EXAMPLES
322# Builds the etags file for makefiles
323etags_makefiles:
324	-${RM} ${TAGSDIR}/TAGS_MAKEFILES
325	-touch ${TAGSDIR}/TAGS_MAKEFILES
326	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES ACTION=etags_makefile alltree
327	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES etags_bmakefiles
328	-chmod g+w TAGS_MAKEFILES
329# Builds the etags file for examples
330etags_examples:
331	-${RM} ${TAGSDIR}/TAGS_EXAMPLES
332	-touch ${TAGSDIR}/TAGS_EXAMPLES
333	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesc alltree
334	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesch alltree
335	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesf alltree
336	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
337	-chmod g+w TAGS_EXAMPLES
338etags_fexamples:
339	-${RM} ${TAGSDIR}/TAGS_FEXAMPLES
340	-touch ${TAGSDIR}/TAGS_FEXAMPLES
341	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_FEXAMPLES ACTION=etags_examplesf alltree
342	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
343	-chmod g+w TAGS_FEXAMPLES
344#
345# These are here for the target allci and allco, and etags
346#
347
348BMAKEFILES = bmake/common/base bmake/common/test \
349	     bmake/common/bopt* bmake/*/rules bmake/*/variables bmake/*/packages \
350	     bmake/*/petscconf.h bmake/*/petscfix.h bmake/config/*.in \
351             bmake/*/buildtest bmake/adic.init bmake/adicmf.init
352DOCS	   = bmake/readme bmake/petscconf.defs
353SCRIPTS    = maint/addlinks maint/builddist maint/buildlinks maint/wwwman \
354	     maint/xclude maint/crontab  \
355	     maint/autoftp include/foldinclude/generateincludes
356
357updatewebdocs:
358	-chmod -R ug+w /mcs/tmp/petsc-tmp
359	-chgrp -R petsc /mcs/tmp/petsc-tmp
360	-/bin/rm -rf /mcs/tmp/petscdocs
361	-/bin/cp -r /mcs/tmp/petsc-tmp/docs /mcs/tmp/petscdocs
362	-maint/update-docs.py /mcs/tmp/petscdocs
363	-find /mcs/tmp/petscdocs -type d -name "*" -exec chmod g+w {} \;
364	-/bin/cp -r /mcs/tmp/petscdocs/* ${PETSC_DIR}/docs
365	-/bin/rm -rf /mcs/tmp/petscdocs
366
367# Builds all the documentation - should be done every night
368alldoc: allmanualpages
369	cd docs/tex/manual; ${OMAKE} manual.dvi manual.ps manual.html splitmanual.html
370
371# Deletes man pages (HTML version)
372deletemanualpages:
373	${RM} -f ${LOC}/docs/manualpages/*/*.html \
374                 ${LOC}/docs/manualpages/manualpages.cit
375
376# Builds all versions of the man pages
377allmanualpages: deletemanualpages
378	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
379	-${OMAKE} ACTION=manualpages tree_basic  LOC=${LOC}
380	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
381	-${OMAKE} ACTION=manexamples tree  LOC=${LOC}
382	-${OMAKE} manconcepts  LOC=${LOC}
383	-${OMAKE} ACTION=getexlist tree LOC=${LOC}
384	-${OMAKE} ACTION=exampleconcepts tree LOC=${LOC}
385	-maint/helpindex.py ${PETSC_DIR} ${LOC}
386	-@chmod g+w ${LOC}/docs/manualpages/*/*.html
387
388# Builds .html versions of the source
389allhtml:
390	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} tree LOC=${LOC}
391
392allcleanhtml:
393	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} tree
394
395# Builds Fortran stub files
396allfortranstubs:
397	-@include/foldinclude/generateincludes ${PETSC_DIR}
398	-@${RM} -f src/fortran/auto/*.c
399	-${OMAKE} ACTION=fortranstubs tree_basic
400	chmod g+w src/fortran/auto/*.c
401	-@cd src/fortran/auto; ${RM} makefile.src; echo SOURCEC = `find . -type f -name "*.c" -printf "%f "` > makefile.src
402	-@cd src/fortran/auto; ${OMAKE} fixfortran
403
404allci:
405	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
406
407allco:
408	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
409
410# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
411allrcslabel:
412	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
413#
414#   The commands below are for generating ADIC versions of the code;
415# they are not currently used.
416#
417alladicignore:
418	-@${RM} ${INSTALL_LIB_DIR}/adicignore
419	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
420
421alladic:
422	-@echo "Beginning to compile ADIC source code in all directories"
423	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
424	-@echo "========================================="
425	-@cd include ; \
426           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
427	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
428	-@cd src/inline ; \
429            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic
430	-@cd src/blaslapack ; \
431            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
432
433alladiclib:
434	-@echo "Beginning to compile ADIC libraries in all directories"
435	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
436	-@echo "-----------------------------------------"
437	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
438	-@echo "-----------------------------------------"
439	-@echo "Using configuration flags:"
440	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
441	-@echo "-----------------------------------------"
442	-@echo "Using include paths: ${PETSC_INCLUDE}"
443	-@echo "-----------------------------------------"
444	-@echo "Using PETSc directory: ${PETSC_DIR}"
445	-@echo "Using PETSc arch: ${PETSC_ARCH}"
446	-@echo "========================================="
447	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.a
448	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
449	-@cd src/blaslapack ; \
450            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
451	-@cd src/adic/src ; \
452            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib
453
454# -------------------------------------------------------------------------------
455#
456# Some macros to check if the fortran interface is up-to-date.
457#
458countfortranfunctions:
459	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
460	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
461	sed "s/_$$//" | sort > /tmp/countfortranfunctions
462
463countcfunctions:
464	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
465	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
466	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
467
468difffortranfunctions: countfortranfunctions countcfunctions
469	-@echo -------------- Functions missing in the fortran interface ---------------------
470	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
471	-@echo ----------------- Functions missing in the C interface ------------------------
472	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
473	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
474
475checkbadfortranstubs:
476	-@echo "========================================="
477	-@echo "Functions with MPI_Comm as an Argument"
478	-@echo "========================================="
479	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
480	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
481	-@echo "========================================="
482	-@echo "Functions with a String as an Argument"
483	-@echo "========================================="
484	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
485	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
486	-@echo "========================================="
487	-@echo "Functions with Pointers to PETSc Objects as Argument"
488	-@echo "========================================="
489	-@cd ${PETSC_DIR}/src/fortran/auto; \
490	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
491	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
492	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
493	for OBJ in $$_p_OBJ; do \
494	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
495	cut -d'(' -f1 | cut -d' ' -f1,3; \
496	done
497# Builds noise routines (not yet publically available)
498# Note:	 libfast cannot run on .F files on certain machines, so we
499# use lib and check for errors here.
500noise: info chklib_dir
501	-@echo "Beginning to compile noise routines"
502	-@echo "========================================="
503	-@cd src/snes/interface/noise; \
504	  ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib > trashz 2>&1; \
505	  grep -v clog trashz | grep -v "information sections" | \
506	  egrep -i '(Error|warning|Can)' >> /dev/null;\
507	  if [ "$$?" != 1 ]; then \
508	  cat trashz ; fi; ${RM} trashz
509	${RANLIB} ${INSTALL_LIB_DIR}/libpetscsnes.a
510	-@chmod g+w  ${INSTALL_LIB_DIR}/libpetscsnes.a
511	-@echo "Completed compiling noise routines"
512	-@echo "========================================="
513
514#
515# Automatically generates PETSc exercises in html from the tutorial examples.
516#
517# The introduction for each section is obtained from docs/manualpages/bop.${MANSEC} is under RCS and may be edited
518#  (used also in introductions to the manual pages)
519# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
520# The list of exercises is from TUTORIALS in each directory's makefile
521#
522# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
523# The pagemaker rule is in the file bmake/common (at the bottom)
524#
525# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
526#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
527#
528exercises:
529	-@echo "========================================="
530	-@echo "Generating HTML tutorial exercises"
531	-@${RM} docs/pageform.txt
532	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
533	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
534	-@echo "access_format=short"                        >> docs/pageform.txt
535	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
536	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
537	-@echo "Generating HTML for individual directories"
538	-@echo "========================================="
539	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
540	-@echo "Completed HTML for individual directories"
541	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
542	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
543	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
544	-@echo "========================================="
545
546.PHONY: info info_h build build_lt testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
547        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples updatewebdocs alldoc allmanualpages \
548        allhtml allcleanhtml allfortranstubs allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
549        start_configure configure_petsc configure_clean
550
551