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