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