xref: /petsc/makefile (revision 8f6be9af63786f3ee06b3c15b3b32a30d03edbd3)
1#
2# This is the makefile for installing PETSc. See the file
3# Installation for directions on installing PETSc.
4# See also bmake/common for additional commands.
5#
6
7#PETSC_DIR = .
8
9CFLAGS	 =
10SOURCEC	 =
11SOURCEF	 =
12DOCS	 = Changes Machines Readme maint/addlinks \
13	   maint/builddist FAQ Installation BugReporting\
14	   maint/buildlinks maint/wwwman maint/xclude maint/crontab\
15	   bmake/common bmake/*/base* maint/autoftp docs/www/sec/* \
16           include/finclude/generateincludes bin/petscviewinfo.text \
17           bin/petscoptsinfo.text
18OBJSC	 =
19OBJSF	 =
20LIBBASE	 = libpetscvec
21DIRS	 = src include docs
22
23include $(PETSC_DIR)/bmake/$(PETSC_ARCH)/base
24
25# Builds PETSc libraries for a given BOPT and architecture
26all: chkpetsc_dir
27	-$(RM) -f $(PDIR)/*
28	-@echo "Beginning to compile libraries in all directories"
29	-@echo "Using compiler: $(CC) $(COPTFLAGS)"
30	-@echo "-----------------------------------------"
31	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
32	-@echo "-----------------------------------------"
33	-@echo "Using configuration flags: $(CONF)"
34	-@echo "-----------------------------------------"
35	-@echo "Using include paths: $(PETSC_INCLUDE)"
36	-@echo "-----------------------------------------"
37	-@echo "Using PETSc directory: $(PETSC_DIR)"
38	-@echo "Using PETSc arch: $(PETSC_ARCH)"
39	-@echo "========================================="
40	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
41	   ACTION=libfast  tree
42	-@cd $(PETSC_DIR)/src/sys/src ; \
43	$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) rs6000_time
44	$(RANLIB) $(PDIR)/*.a
45	-@chmod g+w  $(PDIR)/*.a
46	-@echo "Completed building libraries"
47	-@echo "========================================="
48
49# Builds PETSc test examples for a given BOPT and architecture
50testexamples: chkopts
51	-@echo "Beginning to compile and run test examples"
52	-@echo "Using compiler: $(CC) $(COPTFLAGS)"
53	-@echo "-----------------------------------------"
54	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
55	-@echo "-----------------------------------------"
56	-@echo "Using include paths: $(PETSC_INCLUDE)"
57	-@echo "-----------------------------------------"
58	-@echo "Using PETSc directory: $(PETSC_DIR)"
59	-@echo "Using PETSc arch: $(PETSC_ARCH)"
60	-@echo "------------------------------------------"
61	-@echo "Using linker: $(CLINKER)"
62	-@echo "Using libraries: $(PETSC_LIB)"
63	-@echo "------------------------------------------"
64	-@echo "Due to different numerical round-off on certain"
65	-@echo "machines some of the numbers may not match exactly."
66	-@echo "========================================="
67	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
68	   ACTION=testexamples_1  tree
69	-@echo "Completed compiling and running test examples"
70	-@echo "========================================="
71
72# Builds PETSc test examples for a given BOPT and architecture
73testexamples_uni: chkopts
74	-@echo "Beginning to compile and run uniprocessor test examples"
75	-@echo "Using compiler: $(CC) $(COPTFLAGS)"
76	-@echo "Using linker: $(CLINKER)"
77	-@echo "------------------------------------------"
78	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
79	-@echo "------------------------------------------"
80	-@echo "Using include paths: $(PETSC_INCLUDE)"
81	-@echo "------------------------------------------"
82	-@echo "Using PETSc directory: $(PETSC_DIR)"
83	-@echo "Using PETSc arch: $(PETSC_ARCH)"
84	-@echo "------------------------------------------"
85	-@echo "Using linker: $(CLINKER)"
86	-@echo "Using libraries: $(PETSC_LIB)"
87	-@echo "------------------------------------------"
88	-@echo "Due to different numerical round-off on certain"
89	-@echo "machines some of the numbers may not match exactly."
90	-@echo "========================================="
91	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
92	   ACTION=testexamples_4  tree
93	-@echo "Completed compiling and running uniprocessor test examples"
94	-@echo "========================================="
95
96#
97# Builds PETSc Fortran interface libary
98# Note:	 libfast cannot run on .F files on certain machines, so we
99# use lib and check for errors here.
100fortran: chkpetsc_dir
101	-$(RM) -f $(PDIR)/libpetscfortran.*
102	-@echo "Beginning to compile Fortran interface library"
103	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
104	-@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)"
105	-@echo "------------------------------------------"
106	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
107	-@echo "------------------------------------------"
108	-@echo "Using configuration flags: $(CONF)"
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	-@cd src/fortran/custom; \
116	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
117	  grep -v clog trashz | grep -v "information sections" | \
118	  egrep -i '(Error|warning|Can)' >> /dev/null;\
119	  if [ "$$?" != 1 ]; then \
120	  cat trashz ; fi; $(RM) trashz
121	-@cd src/fortran/auto; \
122	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
123	$(RANLIB) $(PDIR)/libpetscfortran.a
124	-@chmod g+w  $(PDIR)/*.a
125	-@echo "Completed compiling Fortran interface library"
126	-@echo "========================================="
127
128# Builds PETSc test examples for a given BOPT and architecture
129testfortran: chkopts
130	-@echo "Beginning to compile and run Fortran test examples"
131	-@echo "Using compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
132	-@echo "Using linker: $(FLINKER)"
133	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
134	-@echo "------------------------------------------"
135	-@echo "Using PETSc directory: $(PETSC_DIR)"
136	-@echo "Using PETSc arch: $(PETSC_ARCH)"
137	-@echo "------------------------------------------"
138	-@echo "Using linker: $(FLINKER)"
139	-@echo "Using libraries: $(PETSC_FORTRAN_LIB) $(PETSC_LIB)"
140	-@echo "========================================="
141	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
142	   ACTION=testexamples_3  tree
143	-@echo "Completed compiling and running Fortran test examples"
144	-@echo "========================================="
145
146ranlib:
147	$(RANLIB) $(PDIR)/*.a
148
149# Deletes PETSc libraries
150deletelibs:
151	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
152
153
154# Deletes man pages (HTML version)
155deletewwwpages:
156	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit \
157	         $(PETSC_DIR)/docs/www/man*.html
158
159# Deletes man pages (LaTeX version)
160deletelatexpages:
161	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
162
163# To access the tags in emacs, type M-x visit-tags-table and specify
164# the file petsc/TAGS.	Then, to move to where a PETSc function is
165# defined, enter M-. and the function name.  To search for a string
166# and move to the first occurrence, use M-x tags-search and the string.
167# To locate later occurrences, use M-,
168
169TAGS_INCLUDE_FILES  = include/*.h include/pinclude/*.h include/FINCLUDE/*.h
170TAGS_BMAKE_FILES    = bmake/common bmake/*/base*
171TAGS_EXAMPLE_FILES  = src/*/examples/*/*.[c,h,F,f] src/*/examples/*/*/*.[c,h,F,f] \
172	src/benchmarks/*.c src/contrib/*/examples/*/*.[c,h,F,f]
173TAGS_DOC_FILES      = docs/tex/manual/routin.tex docs/tex/manual/manual.tex \
174	docs/tex/manual/manual_tex.tex docs/tex/manual/intro.tex \
175	docs/tex/manual/part1.tex docs/tex/manual/part2.tex
176TAGS_SRC_FILES      = src/*/*.[c,h] src/*/interface/*.[c,h] src/*/src/*.[c,h] \
177	src/*/utils/*.[c,h] \
178	src/*/impls/*.[c,h] src/*/impls/*/*.[c,h] src/*/impls/*/*/*.[c,h] \
179	src/gvec/impls/*/*/*/*/*.[c,h] src/contrib/*/*.[c,h] src/contrib/*/src/*.[c,h] \
180	src/fortran/custom/*.[c,h,F]
181TAGS_MAKEFILE_FILES = include/makefile include/*/makefile \
182	makefile \
183	src/makefile src/*/makefile src/*/src/makefile \
184	src/*/interface/makefile \
185	src/*/utils/makefile \
186	src/*/impls/makefile src/*/impls/*/makefile src/*/impls/*/*/makefile \
187	src/*/examples/makefile src/*/examples/*/makefile src/*/examples/*/*/makefile \
188	src/gvec/impls/*/*/*/*/makefile src/gvec/impls/*/*/*/makefile \
189	src/fortran/*/makefile \
190	src/contrib/*/makefile src/contrib/*/src/makefile \
191	src/contrib/*/examples/makefile src/contrib/*/examples/*/makefile \
192	docs/makefile
193
194# Builds all etags files
195alletags:
196	-make etags_complete
197	-make etags
198	-make etags_noexamples
199	-make etags_makefiles
200
201# Builds the basic etags file.	This should be employed by most users.
202etags:
203	$(RM) TAGS
204	etags -f TAGS $(TAGS_INCLUDE_FILES)
205	etags -a -f TAGS $(TAGS_SRC_FILES)
206	etags -a -f TAGS $(TAGS_EXAMPLE_FILES)
207	etags -a -f TAGS $(TAGS_MAKEFILE_FILES)
208	etags -a -f TAGS $(TAGS_BMAKE_FILES)
209	chmod g+w TAGS
210
211# Builds complete etags list; only for PETSc developers.
212etags_complete:
213	$(RM) TAGS_COMPLETE
214	etags -f TAGS_COMPLETE $(TAGS_SRC_FILES)
215	etags -a -f TAGS_COMPLETE $(TAGS_INCLUDE_FILES)
216	etags -a -f TAGS_COMPLETE $(TAGS_EXAMPLE_FILES)
217	etags -a -f TAGS_COMPLETE $(TAGS_MAKEFILE_FILES)
218	etags -a -f TAGS_COMPLETE $(TAGS_BMAKE_FILES)
219	etags -a -f TAGS_COMPLETE $(TAGS_DOC_FILES)
220	chmod g+w TAGS_COMPLETE
221
222# Builds the etags file that excludes the examples directories
223etags_noexamples:
224	$(RM) TAGS_NO_EXAMPLES
225	etags -f TAGS_NO_EXAMPLES $(TAGS_SRC_FILES)
226	etags -a -f TAGS_NO_EXAMPLES $(TAGS_INCLUDE_FILES)
227	etags -a -f TAGS_NO_EXAMPLES $(TAGS_MAKEFILE_FILES)
228	etags -a -f TAGS_NO_EXAMPLES $(TAGS_BMAKE_FILES)
229	etags -a -f TAGS_NO_EXAMPLES $(TAGS_DOC_FILES)
230	chmod g+w TAGS_NO_EXAMPLES
231
232# Builds the etags file for makefiles
233etags_makefiles:
234	$(RM) TAGS_MAKEFILES
235	etags -f TAGS_MAKEFILES $(TAGS_MAKEFILE_FILES)
236	etags -a -f TAGS_MAKEFILES $(TAGS_BMAKE_FILES)
237	chmod g+w TAGS_MAKEFILES
238
239#
240# ctags builds the tags file required for VI.
241# To use the tags file do the following:
242# 1. within vi invole the command - :set tags=/home/bsmith/petsc/tags
243#    or add  the command to your ~/.exrc file - set tags=/home/bsmith/petsc/tags
244# 2. now to go to a tag do - :tag TAGNAME for eg - :tag MatCreate
245#
246ctags:
247	$(RM) tags
248	ctags -w -f tags $(TAGS_INCLUDE_FILES)
249	ctags -w -a -f tags $(TAGS_SRC_FILES)
250	ctags -w -a -f tags $(TAGS_EXAMPLE_FILES)
251	ctags -w -a -f tags $(TAGS_MAKEFILE_FILES)
252	ctags -w -a -f tags $(TAGS_BMAKE_FILES)
253	chmod g+w tags
254
255# ------------------------------------------------------------------
256#
257# All remaining actions are intended for PETSc developers only.
258# PETSc users should not generally need to use these commands.
259#
260
261# Builds all versions of the man pages
262allmanpages: allwwwpages alllatexpages
263allwwwpages: deletewwwpages
264	-make ACTION=wwwpages_buildcite tree
265	-cd src/fortran/custom; make wwwpages_buildcite
266	-cd src/fortran/custom; make wwwpages
267	-make ACTION=wwwpages tree
268	-maint/wwwman
269	-maint/examplesindex.tcl -www
270	-maint/htmlkeywords.tcl
271	-@chmod g+w docs/www/man*/*
272alllatexpages: deletelatexpages
273	-make ACTION=latexpages tree
274	-cd src/fortran/custom; make latexpages
275	-@chmod g+w docs/tex/rsum/*
276
277# Builds Fortran stub files
278allfortranstubs:
279	-@include/finclude/generateincludes
280	-@$(RM) -f $(PETSC_DIR)/src/fortran/auto/*.c
281	-make ACTION=fortranstubs tree
282	chmod g+w $(PETSC_DIR)/src/fortran/auto/*.c
283
284allci:
285	-@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) ci
286	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=ci  tree
287
288allco:
289	-@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) co
290	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=co  tree
291
292alladicignore:
293	-@$(RM) $(PDIR)/adicignore
294	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adicignore  tree
295
296CFLAGS   =  $(CPPFLAGS) $(CONF)
297
298alladic:
299	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adic  tree
300	-@cd include ; \
301           adiC.new -avud gradient.new -i $(PETSC_DIR)/bmake/adicmastercontrol $(CFLAGS) petsc.h
302	-@cd src/inline ; \
303            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic
304
305alladiclib:
306	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adiclib  tree
307
308#
309#  We no longer make Unix manpages
310#
311#allunixmanpages:
312#	-make ACTION=manpages tree
313#	-cd src/fortran/custom; make manpages
314#	-cd docs/man; catman -W .
315#	-@chmod g+w docs/man/man*/*
316# Deletes man pages (xman version)
317#deletemanpages:
318#	$(RM) -f $(PETSC_DIR)/Keywords $(PETSC_DIR)/docs/man/man*/*
319
320