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