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