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