xref: /petsc/makefile (revision 639f9d9dbbc54d6ac4e42e98283c540b41bb2cee)
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 PETSc directory: $(PETSC_DIR)"
70	-@echo "Using PETSc arch: $(PETSC_ARCH)"
71	-@echo "------------------------------------------"
72	-@echo "Using linker: $(CLINKER)"
73	-@echo "Using libraries: $(PETSC_LIB)"
74	-@echo "------------------------------------------"
75	-@echo "Due to different numerical round-off on certain"
76	-@echo "machines some of the numbers may not match exactly."
77	-@echo "------------------------------------------"
78	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
79	   ACTION=testexamples_4  tree
80	-@echo "Completed compiling and running uniprocessor test examples"
81	-@echo "------------------------------------------"
82
83#
84# Builds PETSc Fortran interface libary
85# Note:	 libfast cannot run on .F files on certain machines, so we
86# use lib and check for errors here.
87fortran: chkpetsc_dir
88	-$(RM) -f $(PDIR)/libpetscfortran.*
89	-@echo "Beginning to compile Fortran interface library"
90	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
91	-@echo "Using C/C++ compiler: $(CC) $(CFLAGS) $(COPTFLAGS)"
92	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
93	-@echo "Using configuration flags: $(CONF)"
94	-@echo "Using include paths: $(PETSC_INCLUDE)"
95	-@echo "Using PETSc directory: $(PETSC_DIR)"
96	-@echo "Using PETSc arch: $(PETSC_ARCH)"
97	-@echo "------------------------------------------"
98	-@cd src/fortran/custom; \
99	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
100	  grep -v clog trashz | grep -v "information sections" | \
101	  egrep -i '(Error|warning|Can)' >> /dev/null;\
102	  if [ "$$?" != 1 ]; then \
103	  cat trashz ; fi; $(RM) trashz
104	-@cd src/fortran/auto; \
105	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
106	$(RANLIB) $(PDIR)/libpetscfortran.a
107	-@chmod g+w  $(PDIR)/*.a
108	-@echo "Completed compiling Fortran interface library"
109	-@echo "------------------------------------------"
110
111# Builds PETSc test examples for a given BOPT and architecture
112testfortran: chkpetsc_dir
113	-@echo "Beginning to compile and run Fortran test examples"
114	-@echo "Using compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
115	-@echo "Using linker: $(FLINKER)"
116	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
117	-@echo "Using PETSc directory: $(PETSC_DIR)"
118	-@echo "Using PETSc arch: $(PETSC_ARCH)"
119	-@echo "------------------------------------------"
120	-@echo "Using linker: $(FLINKER)"
121	-@echo "Using libraries: $(PETSC_FORTRAN_LIB) $(PETSC_LIB)"
122	-@echo "------------------------------------------"
123	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
124	   ACTION=testexamples_3  tree
125	-@echo "Completed compiling and running Fortran test examples"
126	-@echo "------------------------------------------"
127
128ranlib:
129	$(RANLIB) $(PDIR)/*.a
130
131# Deletes PETSc libraries
132deletelibs:
133	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
134
135
136# Deletes man pages (HTML version)
137deletewwwpages:
138	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit \
139	         $(PETSC_DIR)/docs/www/man*.html
140
141# Deletes man pages (LaTeX version)
142deletelatexpages:
143	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
144
145# To access the tags in emacs, type M-x visit-tags-table and specify
146# the file petsc/TAGS.	Then, to move to where a PETSc function is
147# defined, enter M-. and the function name.  To search for a string
148# and move to the first occurrence, use M-x tags-search and the string.
149# To locate later occurrences, use M-,
150
151TAGS_INCLUDE_FILES  = include/*.h include/pinclude/*.h include/FINCLUDE/*.h
152TAGS_BMAKE_FILES    = bmake/common bmake/*/base*
153TAGS_EXAMPLE_FILES  = src/*/examples/*/*.[c,h,F,f] src/*/examples/*/*/*.[c,h,F,f] \
154	src/benchmarks/*.c src/contrib/*/examples/*/*.[c,h,F,f]
155TAGS_DOC_FILES      = docs/tex/manual/routin.tex docs/tex/manual/manual.tex \
156	docs/tex/manual/manual_tex.tex docs/tex/manual/intro.tex \
157	docs/tex/manual/part1.tex docs/tex/manual/part2.tex
158TAGS_SRC_FILES      = src/*/*.h src/*/interface/*.[c,h] src/*/src/*.[c,h] \
159	src/*/utils/*.[c,h] \
160	src/*/impls/*.[c,h] src/*/impls/*/*.[c,h] src/*/impls/*/*/*.[c,h] \
161	src/gvec/impls/*/*/*/*/*.[c,h] src/contrib/*/*.[c,h] src/contrib/*/src/*.[c,h] \
162	src/fortran/custom/*.[c,h,F]
163TAGS_MAKEFILE_FILES = include/makefile include/*/makefile \
164	makefile \
165	src/makefile src/*/makefile src/*/src/makefile \
166	src/*/interface/makefile \
167	src/*/utils/makefile \
168	src/*/impls/makefile src/*/impls/*/makefile src/*/impls/*/*/makefile \
169	src/*/examples/makefile src/*/examples/*/makefile src/*/examples/*/*/makefile \
170	src/gvec/impls/*/*/*/*/makefile src/gvec/impls/*/*/*/makefile \
171	src/fortran/*/makefile \
172	src/contrib/*/makefile src/contrib/*/src/makefile \
173	src/contrib/*/examples/makefile src/contrib/*/examples/*/makefile \
174	docs/makefile
175
176# Builds all etags files
177alletags:
178	-make etags_complete
179	-make etags
180	-make etags_noexamples
181	-make etags_makefiles
182
183# Builds the basic etags file.	This should be employed by most users.
184etags:
185	$(RM) TAGS
186	etags -f TAGS $(TAGS_INCLUDE_FILES)
187	etags -a -f TAGS $(TAGS_SRC_FILES)
188	etags -a -f TAGS $(TAGS_EXAMPLE_FILES)
189	etags -a -f TAGS $(TAGS_MAKEFILE_FILES)
190	etags -a -f TAGS $(TAGS_BMAKE_FILES)
191	chmod g+w TAGS
192
193# Builds complete etags list; only for PETSc developers.
194etags_complete:
195	$(RM) TAGS_COMPLETE
196	etags -f TAGS_COMPLETE $(TAGS_SRC_FILES)
197	etags -a -f TAGS_COMPLETE $(TAGS_INCLUDE_FILES)
198	etags -a -f TAGS_COMPLETE $(TAGS_EXAMPLE_FILES)
199	etags -a -f TAGS_COMPLETE $(TAGS_MAKEFILE_FILES)
200	etags -a -f TAGS_COMPLETE $(TAGS_BMAKE_FILES)
201	etags -a -f TAGS_COMPLETE $(TAGS_DOC_FILES)
202	chmod g+w TAGS_COMPLETE
203
204# Builds the etags file that excludes the examples directories
205etags_noexamples:
206	$(RM) TAGS_NO_EXAMPLES
207	etags -f TAGS_NO_EXAMPLES $(TAGS_SRC_FILES)
208	etags -a -f TAGS_NO_EXAMPLES $(TAGS_INCLUDE_FILES)
209	etags -a -f TAGS_NO_EXAMPLES $(TAGS_MAKEFILE_FILES)
210	etags -a -f TAGS_NO_EXAMPLES $(TAGS_BMAKE_FILES)
211	etags -a -f TAGS_NO_EXAMPLES $(TAGS_DOC_FILES)
212	chmod g+w TAGS_NO_EXAMPLES
213
214# Builds the etags file for makefiles
215etags_makefiles:
216	$(RM) TAGS_MAKEFILES
217	etags -f TAGS_MAKEFILES $(TAGS_MAKEFILE_FILES)
218	etags -a -f TAGS_MAKEFILES $(TAGS_BMAKE_FILES)
219	chmod g+w TAGS_MAKEFILES
220
221#
222# ctags builds the tags file required for VI.
223# To use the tags file do the following:
224# 1. within vi invole the command - :set tags=/home/bsmith/petsc/tags
225#    or add  the command to your ~/.exrc file - set tags=/home/bsmith/petsc/tags
226# 2. now to go to a tag do - :tag TAGNAME for eg - :tag MatCreate
227#
228ctags:
229	$(RM) tags
230	ctags -w -f tags $(TAGS_INCLUDE_FILES)
231	ctags -w -a -f tags $(TAGS_SRC_FILES)
232	ctags -w -a -f tags $(TAGS_EXAMPLE_FILES)
233	ctags -w -a -f tags $(TAGS_MAKEFILE_FILES)
234	ctags -w -a -f tags $(TAGS_BMAKE_FILES)
235	chmod g+w tags
236
237# ------------------------------------------------------------------
238#
239# All remaining actions are intended for PETSc developers only.
240# PETSc users should not generally need to use these commands.
241#
242
243# Builds all versions of the man pages
244allmanpages: allwwwpages alllatexpages
245allwwwpages: deletewwwpages
246	-make ACTION=wwwpages_buildcite tree
247	-cd src/fortran/custom; make wwwpages_buildcite
248	-cd src/fortran/custom; make wwwpages
249	-make ACTION=wwwpages tree
250	-maint/wwwman
251	-maint/examplesindex.tcl -www
252	-@chmod g+w docs/www/man*/*
253alllatexpages: deletelatexpages
254	-make ACTION=latexpages tree
255	-cd src/fortran/custom; make latexpages
256	-@chmod g+w docs/tex/rsum/*
257
258# Builds Fortran stub files
259allfortranstubs:
260	-@include/finclude/generateincludes
261	-@$(RM) -f $(PETSC_DIR)/src/fortran/auto/*.c
262	-make ACTION=fortranstubs tree
263	chmod g+w $(PETSC_DIR)/src/fortran/auto/*.c
264
265#
266#  We no longer make Unix manpages
267#
268#allunixmanpages:
269#	-make ACTION=manpages tree
270#	-cd src/fortran/custom; make manpages
271#	-cd docs/man; catman -W .
272#	-@chmod g+w docs/man/man*/*
273# Deletes man pages (xman version)
274#deletemanpages:
275#	$(RM) -f $(PETSC_DIR)/Keywords $(PETSC_DIR)/docs/man/man*/*
276
277