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