xref: /petsc/makefile (revision 029af93f72d387caa45cf6909ac9aed2d04296ca)
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	-@echo "Due to different numerical round-off on certain"
142	-@echo "machines or the way Fortran formats numbers"
143	-@echo "some of the results may not match exactly."
144	-@echo "========================================="
145	-@echo "On some machines you may get messages of the form"
146	-@echo "PetscScalarAddressToFortran:C and Fortran arrays are"
147	-@echo "not commonly aligned or are too far apart to be indexed"
148	-@echo "by an integer. Locations: C xxxc Fortran xxxf"
149	-@echo "Locations/sizeof(Scalar): C yyc Fortran yyf"
150	-@echo "This indicates that you may not be able to use the"
151	-@echo "PETSc routines VecGetArray() and MatGetArray() from Fortran"
152	-@echo "========================================="
153	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
154	   ACTION=testexamples_3  tree
155	-@echo "Completed compiling and running Fortran test examples"
156	-@echo "========================================="
157
158#
159# Builds PETSc Fortran90 interface libary
160# Note:	 libfast cannot run on .F files on certain machines, so we
161# use lib and check for errors here.
162# Note: F90 interface currently only supported in NAG F90 compiler
163fortran90: chkpetsc_dir fortran
164	-@echo "Beginning to compile Fortran90 interface library"
165	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
166	-@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)"
167	-@echo "------------------------------------------"
168	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
169	-@echo "------------------------------------------"
170	-@echo "Using configuration flags: $(CONF)"
171	-@echo "------------------------------------------"
172	-@echo "Using include paths: $(PETSC_INCLUDE)"
173	-@echo "------------------------------------------"
174	-@echo "Using PETSc directory: $(PETSC_DIR)"
175	-@echo "Using PETSc arch: $(PETSC_ARCH)"
176	-@echo "========================================="
177	-@cd src/fortran/f90; \
178	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
179	  grep -v clog trashz | grep -v "information sections" | \
180	  egrep -i '(Error|warning|Can)' >> /dev/null;\
181	  if [ "$$?" != 1 ]; then \
182	  cat trashz ; fi; $(RM) trashz
183	$(RANLIB) $(PDIR)/libpetscfortran.a
184	-@chmod g+w  $(PDIR)/*.a
185	-@echo "Completed compiling Fortran90 interface library"
186	-@echo "========================================="
187
188
189ranlib:
190	$(RANLIB) $(PDIR)/*.a
191
192# Deletes PETSc libraries
193deletelibs:
194	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
195
196
197# Deletes man pages (HTML version)
198deletewwwpages:
199	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit \
200	         $(PETSC_DIR)/docs/www/man*.html
201
202# Deletes man pages (LaTeX version)
203deletelatexpages:
204	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
205
206# To access the tags in emacs, type M-x visit-tags-table and specify
207# the file petsc/TAGS.	Then, to move to where a PETSc function is
208# defined, enter M-. and the function name.  To search for a string
209# and move to the first occurrence, use M-x tags-search and the string.
210# To locate later occurrences, use M-,
211
212TAGS_INCLUDE_FILES  = include/*.h include/pinclude/*.h include/FINCLUDE/*.h
213TAGS_BMAKE_FILES    = bmake/common bmake/*/base*
214TAGS_EXAMPLE_FILES  = src/*/examples/*/*.[c,h,F,f] src/*/examples/*/*/*.[c,h,F,f] \
215	src/benchmarks/*.c src/contrib/*/examples/*/*.[c,h,F,f]
216TAGS_DOC_FILES      = docs/tex/manual/routin.tex docs/tex/manual/manual.tex \
217	docs/tex/manual/manual_tex.tex docs/tex/manual/intro.tex \
218	docs/tex/manual/part1.tex docs/tex/manual/part2.tex
219TAGS_SRC_FILES      = src/*/*.[c,h] src/*/interface/*.[c,h] src/*/src/*.[c,h] \
220	src/*/utils/*.[c,h] \
221	src/*/impls/*.[c,h] src/*/impls/*/*.[c,h] src/*/impls/*/*/*.[c,h] \
222	src/gvec/impls/*/*/*/*/*.[c,h] src/contrib/*/*.[c,h] src/contrib/*/src/*.[c,h] \
223	src/fortran/custom/*.[c,h,F]
224TAGS_MAKEFILE_FILES = include/makefile include/*/makefile \
225	makefile \
226	src/makefile src/*/makefile src/*/src/makefile \
227	src/*/interface/makefile \
228	src/*/utils/makefile \
229	src/*/impls/makefile src/*/impls/*/makefile src/*/impls/*/*/makefile \
230	src/*/examples/makefile src/*/examples/*/makefile src/*/examples/*/*/makefile \
231	src/gvec/impls/*/*/*/*/makefile src/gvec/impls/*/*/*/makefile \
232	src/fortran/*/makefile \
233	src/contrib/*/makefile src/contrib/*/src/makefile \
234	src/contrib/*/examples/makefile src/contrib/*/examples/*/makefile \
235	docs/makefile
236
237# Builds all etags files
238alletags:
239	-make etags_complete
240	-make etags
241	-make etags_noexamples
242	-make etags_makefiles
243
244# Builds the basic etags file.	This should be employed by most users.
245etags:
246	$(RM) TAGS
247	etags -f TAGS $(TAGS_INCLUDE_FILES)
248	etags -a -f TAGS $(TAGS_SRC_FILES)
249	etags -a -f TAGS $(TAGS_EXAMPLE_FILES)
250	etags -a -f TAGS $(TAGS_MAKEFILE_FILES)
251	etags -a -f TAGS $(TAGS_BMAKE_FILES)
252	chmod g+w TAGS
253
254# Builds complete etags list; only for PETSc developers.
255etags_complete:
256	$(RM) TAGS_COMPLETE
257	etags -f TAGS_COMPLETE $(TAGS_SRC_FILES)
258	etags -a -f TAGS_COMPLETE $(TAGS_INCLUDE_FILES)
259	etags -a -f TAGS_COMPLETE $(TAGS_EXAMPLE_FILES)
260	etags -a -f TAGS_COMPLETE $(TAGS_MAKEFILE_FILES)
261	etags -a -f TAGS_COMPLETE $(TAGS_BMAKE_FILES)
262	etags -a -f TAGS_COMPLETE $(TAGS_DOC_FILES)
263	chmod g+w TAGS_COMPLETE
264
265# Builds the etags file that excludes the examples directories
266etags_noexamples:
267	$(RM) TAGS_NO_EXAMPLES
268	etags -f TAGS_NO_EXAMPLES $(TAGS_SRC_FILES)
269	etags -a -f TAGS_NO_EXAMPLES $(TAGS_INCLUDE_FILES)
270	etags -a -f TAGS_NO_EXAMPLES $(TAGS_MAKEFILE_FILES)
271	etags -a -f TAGS_NO_EXAMPLES $(TAGS_BMAKE_FILES)
272	etags -a -f TAGS_NO_EXAMPLES $(TAGS_DOC_FILES)
273	chmod g+w TAGS_NO_EXAMPLES
274
275# Builds the etags file for makefiles
276etags_makefiles:
277	$(RM) TAGS_MAKEFILES
278	etags -f TAGS_MAKEFILES $(TAGS_MAKEFILE_FILES)
279	etags -a -f TAGS_MAKEFILES $(TAGS_BMAKE_FILES)
280	chmod g+w TAGS_MAKEFILES
281
282#
283# ctags builds the tags file required for VI.
284# To use the tags file do the following:
285# 1. within vi invole the command - :set tags=/home/bsmith/petsc/tags
286#    or add  the command to your ~/.exrc file - set tags=/home/bsmith/petsc/tags
287# 2. now to go to a tag do - :tag TAGNAME for eg - :tag MatCreate
288#
289ctags:
290	$(RM) tags
291	ctags -w -f tags $(TAGS_INCLUDE_FILES)
292	ctags -w -a -f tags $(TAGS_SRC_FILES)
293	ctags -w -a -f tags $(TAGS_EXAMPLE_FILES)
294	ctags -w -a -f tags $(TAGS_MAKEFILE_FILES)
295	ctags -w -a -f tags $(TAGS_BMAKE_FILES)
296	chmod g+w tags
297
298# ------------------------------------------------------------------
299#
300# All remaining actions are intended for PETSc developers only.
301# PETSc users should not generally need to use these commands.
302#
303
304# Builds all versions of the man pages
305allmanpages: allwwwpages alllatexpages
306allwwwpages: deletewwwpages
307	-make ACTION=wwwpages_buildcite tree
308	-cd src/fortran/custom; make wwwpages_buildcite
309	-cd src/fortran/custom; make wwwpages
310	-make ACTION=wwwpages tree
311	-maint/wwwman
312	-maint/examplesindex.tcl -www
313	-maint/htmlkeywords.tcl
314	-@chmod g+w docs/www/man*/*
315
316#This is similar to allwwwpages except -www -> -wwwhome
317#The wwwmanpages built thisway can pe placed at PETSc Home Page
318allwwwhomepages: deletewwwpages
319	-make ACTION=wwwpages_buildcite tree
320	-cd src/fortran/custom; make wwwpages_buildcite
321	-cd src/fortran/custom; make wwwpages
322	-make ACTION=wwwpages tree
323	-maint/wwwman
324	-maint/examplesindex.tcl -wwwhome
325	-maint/htmlkeywords.tcl
326	-@chmod g+w docs/www/man*/*
327
328alllatexpages: deletelatexpages
329	-make ACTION=latexpages tree
330	-cd src/fortran/custom; make latexpages
331	-@chmod g+w docs/tex/rsum/*
332
333# Builds Fortran stub files
334allfortranstubs:
335	-@include/finclude/generateincludes
336	-@$(RM) -f $(PETSC_DIR)/src/fortran/auto/*.c
337	-make ACTION=fortranstubs tree
338	chmod g+w $(PETSC_DIR)/src/fortran/auto/*.c
339
340allci:
341	-@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) ci
342	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=ci  tree
343
344allco:
345	-@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) co
346	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=co  tree
347
348alladicignore:
349	-@$(RM) $(PDIR)/adicignore
350	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adicignore  tree
351
352CFLAGS   =  $(CPPFLAGS) $(CONF)
353
354alladic:
355	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adic  tree
356	-@cd include ; \
357           $(ADIC_CC) -s -f 1 $(CFLAGS) petsc.h
358	-@cd src/inline ; \
359            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic
360
361alladiclib:
362	-@$(RM) -f  $(PDIR)/*adic.a
363	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adiclib  tree
364
365#
366#  We no longer make Unix manpages
367#
368#allunixmanpages:
369#	-make ACTION=manpages tree
370#	-cd src/fortran/custom; make manpages
371#	-cd docs/man; catman -W .
372#	-@chmod g+w docs/man/man*/*
373# Deletes man pages (xman version)
374#deletemanpages:
375#	$(RM) -f $(PETSC_DIR)/Keywords $(PETSC_DIR)/docs/man/man*/*
376
377