xref: /petsc/makefile (revision 4af9383dadb94f9a13ecfc4c4e6594dae617cca4)
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
186# Builds noise routines (not yet publically available)
187# Note:	 libfast cannot run on .F files on certain machines, so we
188# use lib and check for errors here.
189noise: chkpetsc_dir
190	-@echo "Beginning to compile noise routines"
191	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
192	-@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)"
193	-@echo "------------------------------------------"
194	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
195	-@echo "------------------------------------------"
196	-@echo "Using configuration flags: $(CONF)"
197	-@echo "------------------------------------------"
198	-@echo "Using include paths: $(PETSC_INCLUDE)"
199	-@echo "------------------------------------------"
200	-@echo "Using PETSc directory: $(PETSC_DIR)"
201	-@echo "Using PETSc arch: $(PETSC_ARCH)"
202	-@echo "========================================="
203	-@cd src/snes/interface/noise; \
204	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
205	  grep -v clog trashz | grep -v "information sections" | \
206	  egrep -i '(Error|warning|Can)' >> /dev/null;\
207	  if [ "$$?" != 1 ]; then \
208	  cat trashz ; fi; $(RM) trashz
209	$(RANLIB) $(PDIR)/libpetscsnes.a
210	-@chmod g+w  $(PDIR)/libpetscsnes.a
211	-@echo "Completed compiling noise routines"
212	-@echo "========================================="
213
214
215ranlib:
216	$(RANLIB) $(PDIR)/*.a
217
218# Deletes PETSc libraries
219deletelibs:
220	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
221
222# Deletes man pages (HTML version)
223deletewwwpages:
224	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit \
225	         $(PETSC_DIR)/docs/www/man*.html
226
227# Deletes man pages (LaTeX version)
228deletelatexpages:
229	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
230
231# To access the tags in emacs, type M-x visit-tags-table and specify
232# the file petsc/TAGS.	Then, to move to where a PETSc function is
233# defined, enter M-. and the function name.  To search for a string
234# and move to the first occurrence, use M-x tags-search and the string.
235# To locate later occurrences, use M-,
236
237TAGS_INCLUDE_FILES  = include/*.h include/pinclude/*.h include/FINCLUDE/*.h
238TAGS_BMAKE_FILES    = bmake/common bmake/*/base*
239TAGS_EXAMPLE_FILES  = src/*/examples/*/*.[c,h,F,f] src/*/examples/*/*/*.[c,h,F,f] \
240                      src/benchmarks/*.c src/contrib/*/examples/*/*.[c,h,F,f]
241TAGS_DOC_FILES      = docs/tex/manual/routin.tex docs/tex/manual/manual.tex \
242                      docs/tex/manual/manual_tex.tex docs/tex/manual/intro.tex \
243                      docs/tex/manual/part1.tex docs/tex/manual/part2.tex
244TAGS_SRC_FILES      = src/*/*.[c,h] src/*/interface/*.[c,h] src/*/src/*.[c,h] \
245                      src/*/utils/*.[c,h] \
246                      src/*/impls/*.[c,h] src/*/impls/*/*.[c,h] src/*/impls/*/*/*.[c,h] \
247                      src/gvec/impls/*/*/*/*/*.[c,h] src/contrib/*/*.[c,h] \
248                      src/contrib/*/src/*.[c,h] src/fortran/custom/*.[c,h,F]
249TAGS_MAKEFILE_FILES = include/makefile include/*/makefile \
250                      makefile \
251                      src/makefile src/*/makefile src/*/src/makefile \
252                      src/*/interface/makefile \
253                      src/*/utils/makefile \
254                      src/*/impls/makefile src/*/impls/*/makefile src/*/impls/*/*/makefile \
255                      src/*/examples/makefile src/*/examples/*/makefile src/*/examples/*/*/makefile \
256                      src/gvec/impls/*/*/*/*/makefile src/gvec/impls/*/*/*/makefile \
257                      src/fortran/*/makefile \
258                      src/contrib/*/makefile src/contrib/*/src/makefile \
259                      src/contrib/*/examples/makefile src/contrib/*/examples/*/makefile \
260                      docs/makefile
261
262# Builds all etags files
263alletags:
264	-make etags_complete
265	-make etags
266	-make etags_noexamples
267	-make etags_makefiles
268
269# Builds the basic etags file.	This should be employed by most users.
270etags:
271	$(RM) TAGS
272	etags -f TAGS $(TAGS_INCLUDE_FILES)
273	etags -a -f TAGS $(TAGS_SRC_FILES)
274	etags -a -f TAGS $(TAGS_EXAMPLE_FILES)
275	etags -a -f TAGS $(TAGS_MAKEFILE_FILES)
276	etags -a -f TAGS $(TAGS_BMAKE_FILES)
277	chmod g+w TAGS
278
279# Builds complete etags list; only for PETSc developers.
280etags_complete:
281	$(RM) TAGS_COMPLETE
282	etags -f TAGS_COMPLETE $(TAGS_SRC_FILES)
283	etags -a -f TAGS_COMPLETE $(TAGS_INCLUDE_FILES)
284	etags -a -f TAGS_COMPLETE $(TAGS_EXAMPLE_FILES)
285	etags -a -f TAGS_COMPLETE $(TAGS_MAKEFILE_FILES)
286	etags -a -f TAGS_COMPLETE $(TAGS_BMAKE_FILES)
287	etags -a -f TAGS_COMPLETE $(TAGS_DOC_FILES)
288	chmod g+w TAGS_COMPLETE
289
290# Builds the etags file that excludes the examples directories
291etags_noexamples:
292	$(RM) TAGS_NO_EXAMPLES
293	etags -f TAGS_NO_EXAMPLES $(TAGS_SRC_FILES)
294	etags -a -f TAGS_NO_EXAMPLES $(TAGS_INCLUDE_FILES)
295	etags -a -f TAGS_NO_EXAMPLES $(TAGS_MAKEFILE_FILES)
296	etags -a -f TAGS_NO_EXAMPLES $(TAGS_BMAKE_FILES)
297	etags -a -f TAGS_NO_EXAMPLES $(TAGS_DOC_FILES)
298	chmod g+w TAGS_NO_EXAMPLES
299
300# Builds the etags file for makefiles
301etags_makefiles:
302	$(RM) TAGS_MAKEFILES
303	etags -f TAGS_MAKEFILES $(TAGS_MAKEFILE_FILES)
304	etags -a -f TAGS_MAKEFILES $(TAGS_BMAKE_FILES)
305	chmod g+w TAGS_MAKEFILES
306
307#
308# ctags builds the tags file required for VI.
309# To use the tags file do the following:
310# 1. within vi invole the command - :set tags=/home/bsmith/petsc/tags
311#    or add  the command to your ~/.exrc file - set tags=/home/bsmith/petsc/tags
312# 2. now to go to a tag do - :tag TAGNAME for eg - :tag MatCreate
313#
314ctags:
315	$(RM) tags
316	ctags -w -f tags $(TAGS_INCLUDE_FILES)
317	ctags -w -a -f tags $(TAGS_SRC_FILES)
318	ctags -w -a -f tags $(TAGS_EXAMPLE_FILES)
319	ctags -w -a -f tags $(TAGS_MAKEFILE_FILES)
320	ctags -w -a -f tags $(TAGS_BMAKE_FILES)
321	chmod g+w tags
322
323# ------------------------------------------------------------------
324#
325# All remaining actions are intended for PETSc developers only.
326# PETSc users should not generally need to use these commands.
327#
328
329# Builds all versions of the man pages
330allmanpages: allwwwpages alllatexpages
331allwwwpages: deletewwwpages
332	-make ACTION=wwwpages_buildcite tree
333	-cd src/fortran/custom; make wwwpages_buildcite
334	-cd src/fortran/custom; make wwwpages
335	-make ACTION=wwwpages tree
336	-maint/wwwman
337	-maint/examplesindex.tcl -www
338	-maint/htmlkeywords.tcl
339	-@chmod g+w docs/www/man*/*
340
341#This is similar to allwwwpages except -www -> -wwwhome
342#The wwwmanpages built this way can pe placed at PETSc Home Page
343allwwwhomepages: deletewwwpages
344	-make ACTION=wwwpages_buildcite tree
345	-cd src/fortran/custom; make wwwpages_buildcite
346	-cd src/fortran/custom; make wwwpages
347	-make ACTION=wwwpages tree
348	-maint/wwwman
349	-maint/examplesindex.tcl -wwwhome
350	-maint/htmlkeywords.tcl -wwwhome
351	-@chmod g+w docs/www/man*/*
352
353alllatexpages: deletelatexpages
354	-make ACTION=latexpages tree
355	-cd src/fortran/custom; make latexpages
356	-@chmod g+w docs/tex/rsum/*
357
358# Builds Fortran stub files
359allfortranstubs:
360	-@include/finclude/generateincludes
361	-@$(RM) -f src/fortran/auto/*.c
362	-make ACTION=fortranstubs tree
363	chmod g+w src/fortran/auto/*.c
364
365allci:
366	-@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) ci
367	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=ci  tree
368
369allco:
370	-@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) co
371	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=co  tree
372
373#
374#   The commands below are for generating ADIC versions of the code;
375# they are not currently used.
376#
377CFLAGS   =  $(CPPFLAGS) $(CONF)
378alladicignore:
379	-@$(RM) $(PDIR)/adicignore
380	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adicignore  tree
381
382alladic:
383	-@cd include ; \
384           $(ADIC_CC) -s -f 1 $(CFLAGS) petsc.h
385	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adic  tree
386	-@cd src/inline ; \
387            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic
388	-@cd src/adic/blas ; \
389            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic
390	-@cd src/adic/lapack ; \
391            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic
392	-@cd src/adic/src ; \
393            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic
394
395alladiclib:
396	-@$(RM) -f  $(PDIR)/*adic.a
397	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adiclib  tree
398	-@cd src/adic/blas ; \
399            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adiclib
400	-@cd src/adic/lapack ; \
401            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adiclib
402	-@cd src/adic/src ; \
403            $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adiclib
404
405
406
407
408
409
410