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