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