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