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