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