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