xref: /petsc/makefile (revision f09e8eb94a771781a812a8d81a9ca3d36ec35eba)
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
7CFLAGS	 =
8SOURCEC	 =
9SOURCEF	 =
10DOCS	 = Changes Machines Readme maint/addlinks \
11	   maint/builddist FAQ Installation BugReporting\
12	   maint/buildlinks maint/wwwman maint/xclude maint/crontab\
13	   bmake/common bmake/*/base* maint/autoftp docs/www/sec/* \
14           include/finclude/generateincludes bin/petscviewinfo.text \
15           bin/petscoptsinfo.text
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) $(COPTFLAGS)"
28	-@echo "-----------------------------------------"
29	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
30	-@echo "-----------------------------------------"
31	-@echo "Using configuration flags: $(CONF)"
32	-@echo "-----------------------------------------"
33	-@echo "Using include paths: $(PETSC_INCLUDE)"
34	-@echo "-----------------------------------------"
35	-@echo "Using PETSc directory: $(PETSC_DIR)"
36	-@echo "Using PETSc arch: $(PETSC_ARCH)"
37	-@echo "========================================="
38	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
39	   ACTION=libfast  tree
40	-@cd $(PETSC_DIR)/src/sys/src ; \
41	$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) rs6000_time
42	$(RANLIB) $(PDIR)/*.a
43	-@chmod g+w  $(PDIR)/*.a
44	-@echo "Completed building libraries"
45	-@echo "========================================="
46
47# Builds PETSc test examples for a given BOPT and architecture
48testexamples: chkopts
49	-@echo "Beginning to compile and run test examples"
50	-@echo "Using compiler: $(CC) $(COPTFLAGS)"
51	-@echo "-----------------------------------------"
52	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
53	-@echo "-----------------------------------------"
54	-@echo "Using include paths: $(PETSC_INCLUDE)"
55	-@echo "-----------------------------------------"
56	-@echo "Using PETSc directory: $(PETSC_DIR)"
57	-@echo "Using PETSc arch: $(PETSC_ARCH)"
58	-@echo "------------------------------------------"
59	-@echo "Using linker: $(CLINKER)"
60	-@echo "Using libraries: $(PETSC_LIB)"
61	-@echo "------------------------------------------"
62	-@echo "Due to different numerical round-off on certain"
63	-@echo "machines some of the numbers may not match exactly."
64	-@echo "========================================="
65	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
66	   ACTION=testexamples_1  tree
67	-@echo "Completed compiling and running test examples"
68	-@echo "========================================="
69
70# Builds PETSc test examples for a given BOPT and architecture
71testexamples_uni: chkopts
72	-@echo "Beginning to compile and run uniprocessor test examples"
73	-@echo "Using compiler: $(CC) $(COPTFLAGS)"
74	-@echo "Using linker: $(CLINKER)"
75	-@echo "------------------------------------------"
76	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
77	-@echo "------------------------------------------"
78	-@echo "Using include paths: $(PETSC_INCLUDE)"
79	-@echo "------------------------------------------"
80	-@echo "Using PETSc directory: $(PETSC_DIR)"
81	-@echo "Using PETSc arch: $(PETSC_ARCH)"
82	-@echo "------------------------------------------"
83	-@echo "Using linker: $(CLINKER)"
84	-@echo "Using libraries: $(PETSC_LIB)"
85	-@echo "------------------------------------------"
86	-@echo "Due to different numerical round-off on certain"
87	-@echo "machines some of the numbers may not match exactly."
88	-@echo "========================================="
89	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
90	   ACTION=testexamples_4  tree
91	-@echo "Completed compiling and running uniprocessor test examples"
92	-@echo "========================================="
93
94#
95# Builds PETSc Fortran interface libary
96# Note:	 libfast cannot run on .F files on certain machines, so we
97# use lib and check for errors here.
98fortran: chkpetsc_dir
99	-$(RM) -f $(PDIR)/libpetscfortran.*
100	-@echo "Beginning to compile Fortran interface library"
101	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
102	-@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)"
103	-@echo "------------------------------------------"
104	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
105	-@echo "------------------------------------------"
106	-@echo "Using configuration flags: $(CONF)"
107	-@echo "------------------------------------------"
108	-@echo "Using include paths: $(PETSC_INCLUDE)"
109	-@echo "------------------------------------------"
110	-@echo "Using PETSc directory: $(PETSC_DIR)"
111	-@echo "Using PETSc arch: $(PETSC_ARCH)"
112	-@echo "========================================="
113	-@cd src/fortran/custom; \
114	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
115	  grep -v clog trashz | grep -v "information sections" | \
116	  egrep -i '(Error|warning|Can)' >> /dev/null;\
117	  if [ "$$?" != 1 ]; then \
118	  cat trashz ; fi; $(RM) trashz
119	-@cd src/fortran/auto; \
120	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
121	$(RANLIB) $(PDIR)/libpetscfortran.a
122	-@chmod g+w  $(PDIR)/*.a
123	-@echo "Completed compiling Fortran interface library"
124	-@echo "========================================="
125
126# Builds PETSc test examples for a given BOPT and architecture
127testfortran: chkopts
128	-@echo "Beginning to compile and run Fortran test examples"
129	-@echo "Using compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
130	-@echo "Using linker: $(FLINKER)"
131	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
132	-@echo "------------------------------------------"
133	-@echo "Using PETSc directory: $(PETSC_DIR)"
134	-@echo "Using PETSc arch: $(PETSC_ARCH)"
135	-@echo "------------------------------------------"
136	-@echo "Using linker: $(FLINKER)"
137	-@echo "Using libraries: $(PETSC_FORTRAN_LIB) $(PETSC_LIB)"
138	-@echo "========================================="
139	-@echo "Due to different numerical round-off on certain"
140	-@echo "machines or the way Fortran formats numbers"
141	-@echo "some of the results may not match exactly."
142	-@echo "========================================="
143	-@echo "On some machines you may get messages of the form"
144	-@echo "PetscScalarAddressToFortran:C and Fortran arrays are"
145	-@echo "not commonly aligned or are too far apart to be indexed"
146	-@echo "by an integer. Locations: C xxxc Fortran xxxf"
147	-@echo "Locations/sizeof(Scalar): C yyc Fortran yyf"
148	-@echo "This indicates that you may not be able to use the"
149	-@echo "PETSc routines VecGetArray() and MatGetArray() from Fortran"
150	-@echo "========================================="
151	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
152	   ACTION=testexamples_3  tree
153	-@echo "Completed compiling and running Fortran test examples"
154	-@echo "========================================="
155
156#
157# Builds PETSc Fortran90 interface libary
158# Note:	 libfast cannot run on .F files on certain machines, so we
159# use lib and check for errors here.
160# Note: F90 interface currently only supported in NAG F90 compiler
161fortran90: chkpetsc_dir fortran
162	-@echo "Beginning to compile Fortran90 interface library"
163	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
164	-@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)"
165	-@echo "------------------------------------------"
166	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
167	-@echo "------------------------------------------"
168	-@echo "Using configuration flags: $(CONF)"
169	-@echo "------------------------------------------"
170	-@echo "Using include paths: $(PETSC_INCLUDE)"
171	-@echo "------------------------------------------"
172	-@echo "Using PETSc directory: $(PETSC_DIR)"
173	-@echo "Using PETSc arch: $(PETSC_ARCH)"
174	-@echo "========================================="
175	-@cd src/fortran/f90; \
176	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
177	  grep -v clog trashz | grep -v "information sections" | \
178	  egrep -i '(Error|warning|Can)' >> /dev/null;\
179	  if [ "$$?" != 1 ]; then \
180	  cat trashz ; fi; $(RM) trashz
181	$(RANLIB) $(PDIR)/libpetscfortran.a
182	-@chmod g+w  $(PDIR)/*.a
183	-@echo "Completed compiling Fortran90 interface library"
184	-@echo "========================================="
185
186ranlib:
187	$(RANLIB) $(PDIR)/*.a
188
189# Deletes PETSc libraries
190deletelibs:
191	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
192
193# Deletes man pages (HTML version)
194deletewwwpages:
195	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit \
196	         $(PETSC_DIR)/docs/www/man*.html
197
198# Deletes man pages (LaTeX version)
199deletelatexpages:
200	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
201
202# To access the tags in emacs, type M-x visit-tags-table and specify
203# the file petsc/TAGS.	Then, to move to where a PETSc function is
204# defined, enter M-. and the function name.  To search for a string
205# and move to the first occurrence, use M-x tags-search and the string.
206# To locate later occurrences, use M-,
207
208TAGS_INCLUDE_FILES  = include/*.h include/pinclude/*.h include/FINCLUDE/*.h
209TAGS_BMAKE_FILES    = bmake/common bmake/*/base*
210TAGS_EXAMPLE_FILES  = src/*/examples/*/*.[c,h,F,f] src/*/examples/*/*/*.[c,h,F,f] \
211                      src/benchmarks/*.c src/contrib/*/examples/*/*.[c,h,F,f]
212TAGS_DOC_FILES      = docs/tex/manual/routin.tex docs/tex/manual/manual.tex \
213                      docs/tex/manual/manual_tex.tex docs/tex/manual/intro.tex \
214                      docs/tex/manual/part1.tex docs/tex/manual/part2.tex
215TAGS_SRC_FILES      = src/*/*.[c,h] src/*/interface/*.[c,h] src/*/src/*.[c,h] \
216                      src/*/utils/*.[c,h] \
217                      src/*/impls/*.[c,h] src/*/impls/*/*.[c,h] src/*/impls/*/*/*.[c,h] \
218                      src/gvec/impls/*/*/*/*/*.[c,h] src/contrib/*/*.[c,h] \
219                      src/contrib/*/src/*.[c,h] src/fortran/custom/*.[c,h,F]
220TAGS_MAKEFILE_FILES = include/makefile include/*/makefile \
221                      makefile \
222                      src/makefile src/*/makefile src/*/src/makefile \
223                      src/*/interface/makefile \
224                      src/*/utils/makefile \
225                      src/*/impls/makefile src/*/impls/*/makefile src/*/impls/*/*/makefile \
226                      src/*/examples/makefile src/*/examples/*/makefile src/*/examples/*/*/makefile \
227                      src/gvec/impls/*/*/*/*/makefile src/gvec/impls/*/*/*/makefile \
228                      src/fortran/*/makefile \
229                      src/contrib/*/makefile src/contrib/*/src/makefile \
230                      src/contrib/*/examples/makefile src/contrib/*/examples/*/makefile \
231                      docs/makefile
232
233# Builds all etags files
234alletags:
235	-make etags_complete
236	-make etags
237	-make etags_noexamples
238	-make etags_makefiles
239
240# Builds the basic etags file.	This should be employed by most users.
241etags:
242	$(RM) TAGS
243	etags -f TAGS $(TAGS_INCLUDE_FILES)
244	etags -a -f TAGS $(TAGS_SRC_FILES)
245	etags -a -f TAGS $(TAGS_EXAMPLE_FILES)
246	etags -a -f TAGS $(TAGS_MAKEFILE_FILES)
247	etags -a -f TAGS $(TAGS_BMAKE_FILES)
248	chmod g+w TAGS
249
250# Builds complete etags list; only for PETSc developers.
251etags_complete:
252	$(RM) TAGS_COMPLETE
253	etags -f TAGS_COMPLETE $(TAGS_SRC_FILES)
254	etags -a -f TAGS_COMPLETE $(TAGS_INCLUDE_FILES)
255	etags -a -f TAGS_COMPLETE $(TAGS_EXAMPLE_FILES)
256	etags -a -f TAGS_COMPLETE $(TAGS_MAKEFILE_FILES)
257	etags -a -f TAGS_COMPLETE $(TAGS_BMAKE_FILES)
258	etags -a -f TAGS_COMPLETE $(TAGS_DOC_FILES)
259	chmod g+w TAGS_COMPLETE
260
261# Builds the etags file that excludes the examples directories
262etags_noexamples:
263	$(RM) TAGS_NO_EXAMPLES
264	etags -f TAGS_NO_EXAMPLES $(TAGS_SRC_FILES)
265	etags -a -f TAGS_NO_EXAMPLES $(TAGS_INCLUDE_FILES)
266	etags -a -f TAGS_NO_EXAMPLES $(TAGS_MAKEFILE_FILES)
267	etags -a -f TAGS_NO_EXAMPLES $(TAGS_BMAKE_FILES)
268	etags -a -f TAGS_NO_EXAMPLES $(TAGS_DOC_FILES)
269	chmod g+w TAGS_NO_EXAMPLES
270
271# Builds the etags file for makefiles
272etags_makefiles:
273	$(RM) TAGS_MAKEFILES
274	etags -f TAGS_MAKEFILES $(TAGS_MAKEFILE_FILES)
275	etags -a -f TAGS_MAKEFILES $(TAGS_BMAKE_FILES)
276	chmod g+w TAGS_MAKEFILES
277
278#
279# ctags builds the tags file required for VI.
280# To use the tags file do the following:
281# 1. within vi invole the command - :set tags=/home/bsmith/petsc/tags
282#    or add  the command to your ~/.exrc file - set tags=/home/bsmith/petsc/tags
283# 2. now to go to a tag do - :tag TAGNAME for eg - :tag MatCreate
284#
285ctags:
286	$(RM) tags
287	ctags -w -f tags $(TAGS_INCLUDE_FILES)
288	ctags -w -a -f tags $(TAGS_SRC_FILES)
289	ctags -w -a -f tags $(TAGS_EXAMPLE_FILES)
290	ctags -w -a -f tags $(TAGS_MAKEFILE_FILES)
291	ctags -w -a -f tags $(TAGS_BMAKE_FILES)
292	chmod g+w tags
293
294# ------------------------------------------------------------------
295#
296# All remaining actions are intended for PETSc developers only.
297# PETSc users should not generally need to use these commands.
298#
299
300# Builds all versions of the man pages
301allmanpages: allwwwpages alllatexpages
302allwwwpages: deletewwwpages
303	-make ACTION=wwwpages_buildcite tree
304	-cd src/fortran/custom; make wwwpages_buildcite
305	-cd src/fortran/custom; make wwwpages
306	-make ACTION=wwwpages tree
307	-maint/wwwman
308	-maint/examplesindex.tcl -www
309	-maint/htmlkeywords.tcl
310	-@chmod g+w docs/www/man*/*
311
312#This is similar to allwwwpages except -www -> -wwwhome
313#The wwwmanpages built this way can pe placed at PETSc Home Page
314allwwwhomepages: deletewwwpages
315	-make ACTION=wwwpages_buildcite tree
316	-cd src/fortran/custom; make wwwpages_buildcite
317	-cd src/fortran/custom; make wwwpages
318	-make ACTION=wwwpages tree
319	-maint/wwwman
320	-maint/examplesindex.tcl -wwwhome
321	-maint/htmlkeywords.tcl -wwwhome
322	-@chmod g+w docs/www/man*/*
323
324alllatexpages: deletelatexpages
325	-make ACTION=latexpages tree
326	-cd src/fortran/custom; make latexpages
327	-@chmod g+w docs/tex/rsum/*
328
329# Builds Fortran stub files
330allfortranstubs:
331	-@include/finclude/generateincludes
332	-@$(RM) -f src/fortran/auto/*.c
333	-make ACTION=fortranstubs tree
334	chmod g+w src/fortran/auto/*.c
335
336allci:
337	-@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) ci
338	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=ci  tree
339
340allco:
341	-@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) co
342	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=co  tree
343
344#
345#   The commands below are for generating ADIC versions of the code;
346# they are not currently used.
347#
348CFLAGS   =  $(CPPFLAGS) $(CONF)
349alladicignore:
350	-@$(RM) $(PDIR)/adicignore
351	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adicignore  tree
352
353alladic:
354	-@cd include ; \
355           $(ADIC_CC) -s -f 1 $(CFLAGS) petsc.h
356	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adic  tree
357	-@cd src/inline ; \
358            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic
359
360alladiclib:
361	-@$(RM) -f  $(PDIR)/*adic.a
362	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adiclib  tree
363
364
365
366
367
368
369