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