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