xref: /petsc/makefile (revision b951964f0fc83ed405b88515d4693dd22c4dfee8)
111b6ed10SLois Curfman McInnes#
2cfd69a58SBarry Smith# This is the makefile for installing PETSc. See the file
3cfd69a58SBarry Smith# Installation for directions on installing PETSc.
4cfd69a58SBarry Smith# See also bmake/common for additional commands.
511b6ed10SLois Curfman McInnes#
611b6ed10SLois Curfman McInnes
772035b96SSatish Balay#PETSC_DIR = .
861523587SBarry Smith
9ab94cc7aSSatish BalayCFLAGS	 =
1061523587SBarry SmithSOURCEC	 =
1161523587SBarry SmithSOURCEF	 =
126daaf66cSBarry SmithSOURCEH	 = Changes Machines Readme maint/addlinks \
1343a90d84SBarry Smith	   maint/builddist FAQ Installation BugReporting\
14deb7fc1cSBarry Smith	   maint/buildlinks maint/wwwman maint/xclude maint/crontab\
15630a6785SBarry Smith	   bmake/common bmake/*/base* maint/autoftp docs/www/sec/* \
16630a6785SBarry Smith           include/finclude/generateincludes bin/petscviewinfo.text \
17630a6785SBarry Smith           bin/petscoptsinfo.text
1861523587SBarry SmithOBJSC	 =
1961523587SBarry SmithOBJSF	 =
2061523587SBarry SmithLIBBASE	 = libpetscvec
21b16a3bb1SBarry SmithDIRS	 = src include docs
2261523587SBarry Smith
234e627d3aSBarry Smithinclude $(PETSC_DIR)/bmake/$(PETSC_ARCH)/base
2461523587SBarry Smith
2511b6ed10SLois Curfman McInnes# Builds PETSc libraries for a given BOPT and architecture
267857610eSBarry Smithall: chkpetsc_dir
27511caf8eSSatish Balay	-$(RM) -f $(PDIR)/*
280b3634f8SBarry Smith	-@echo "Beginning to compile libraries in all directories"
2926de76a5SSatish Balay	-@echo "Using compiler: $(CC) $(CFLAGS) $(COPTFLAGS)"
30b14e8f29SBarry Smith	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
31b14e8f29SBarry Smith	-@echo "Using configuration flags: $(CONF)"
32b14e8f29SBarry Smith	-@echo "Using include paths: $(PETSC_INCLUDE)"
33c2c9bc36SBarry Smith	-@echo "Using PETSc directory: $(PETSC_DIR)"
34c2c9bc36SBarry Smith	-@echo "Using PETSc arch: $(PETSC_ARCH)"
350b3634f8SBarry Smith	-@echo "------------------------------------------"
36e35bd481SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
37f3848965SBarry Smith	   ACTION=libfast  tree
38aa45e91cSSatish Balay	-@cd $(PETSC_DIR)/src/sys/src ; $(OMAKE) PETSC_ARCH=$(PETSC_ARCH) rs6000_time
394e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
407862f17cSBarry Smith	-@chmod g+w  $(PDIR)/*.a
410b3634f8SBarry Smith	-@echo "Completed building libraries"
420b3634f8SBarry Smith	-@echo "------------------------------------------"
430b3634f8SBarry Smith
440b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
450b3634f8SBarry Smithtestexamples: chkpetsc_dir
460b3634f8SBarry Smith	-@echo "Beginning to compile and run test examples"
4726de76a5SSatish Balay	-@echo "Using compiler: $(CC) $(CFLAGS) $(COPTFLAGS)"
48b14e8f29SBarry Smith	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
49b14e8f29SBarry Smith	-@echo "Using include paths: $(PETSC_INCLUDE)"
50c2c9bc36SBarry Smith	-@echo "Using PETSc directory: $(PETSC_DIR)"
51c2c9bc36SBarry Smith	-@echo "Using PETSc arch: $(PETSC_ARCH)"
52c2c9bc36SBarry Smith	-@echo "------------------------------------------"
539c69534bSBarry Smith	-@echo "Using linker: $(CLINKER)"
549c69534bSBarry Smith	-@echo "Using libraries: $(PETSC_LIB)"
550b3634f8SBarry Smith	-@echo "------------------------------------------"
56eb817c50SBarry Smith	-@echo "Due to different numerical round-off on certain"
57eb817c50SBarry Smith	-@echo "machines some of the numbers may not match exactly."
5831ca9999SBarry Smith	-@echo "------------------------------------------"
590b3634f8SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
600b3634f8SBarry Smith	   ACTION=testexamples_1  tree
610b3634f8SBarry Smith	-@echo "Completed compiling and running test examples"
620b3634f8SBarry Smith	-@echo "------------------------------------------"
630b3634f8SBarry Smith
640b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
658475343bSBarry Smithtestexamples_uni: chkpetsc_dir
668475343bSBarry Smith	-@echo "Beginning to compile and run uniprocessor test examples"
6726de76a5SSatish Balay	-@echo "Using compiler: $(CC) $(CFLAGS) $(COPTFLAGS)"
688475343bSBarry Smith	-@echo "Using linker: $(CLINKER)"
69b14e8f29SBarry Smith	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
70b14e8f29SBarry Smith	-@echo "Using include paths: $(PETSC_INCLUDE)"
71d6db1478SLois Curfman McInnes	-@echo "Using PETSc directory: $(PETSC_DIR)"
72d6db1478SLois Curfman McInnes	-@echo "Using PETSc arch: $(PETSC_ARCH)"
73d6db1478SLois Curfman McInnes	-@echo "------------------------------------------"
74d6db1478SLois Curfman McInnes	-@echo "Using linker: $(CLINKER)"
758475343bSBarry Smith	-@echo "Using libraries: $(PETSC_LIB)"
768475343bSBarry Smith	-@echo "------------------------------------------"
778475343bSBarry Smith	-@echo "Due to different numerical round-off on certain"
788475343bSBarry Smith	-@echo "machines some of the numbers may not match exactly."
798475343bSBarry Smith	-@echo "------------------------------------------"
808475343bSBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
818475343bSBarry Smith	   ACTION=testexamples_4  tree
828475343bSBarry Smith	-@echo "Completed compiling and running uniprocessor test examples"
838475343bSBarry Smith	-@echo "------------------------------------------"
848475343bSBarry Smith
8535ca7349SBarry Smith#
8611b6ed10SLois Curfman McInnes# Builds PETSc Fortran interface libary
8711b6ed10SLois Curfman McInnes# Note:	 libfast cannot run on .F files on certain machines, so we
8835ca7349SBarry Smith# use lib and check for errors here.
8983f0b094SBarry Smithfortran: chkpetsc_dir
90727c161cSBarry Smith	-$(RM) -f $(PDIR)/libpetscfortran.*
910b3634f8SBarry Smith	-@echo "Beginning to compile Fortran interface library"
9226de76a5SSatish Balay	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
93fc939babSLois Curfman McInnes	-@echo "Using C/C++ compiler: $(CC) $(CFLAGS) $(COPTFLAGS)"
94fc939babSLois Curfman McInnes	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
95fc939babSLois Curfman McInnes	-@echo "Using configuration flags: $(CONF)"
96fc939babSLois Curfman McInnes	-@echo "Using include paths: $(PETSC_INCLUDE)"
97d6db1478SLois Curfman McInnes	-@echo "Using PETSc directory: $(PETSC_DIR)"
98d6db1478SLois Curfman McInnes	-@echo "Using PETSc arch: $(PETSC_ARCH)"
990b3634f8SBarry Smith	-@echo "------------------------------------------"
100b16a3bb1SBarry Smith	-@cd src/fortran/custom; \
10135ca7349SBarry Smith	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
10235ca7349SBarry Smith	  grep -v clog trashz | grep -v "information sections" | \
10335ca7349SBarry Smith	  egrep -i '(Error|warning|Can)' >> /dev/null;\
10435ca7349SBarry Smith	  if [ "$$?" != 1 ]; then \
10535ca7349SBarry Smith	  cat trashz ; fi; $(RM) trashz
106b16a3bb1SBarry Smith	-@cd src/fortran/auto; \
10735ca7349SBarry Smith	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
10883f0b094SBarry Smith	$(RANLIB) $(PDIR)/libpetscfortran.a
10931dbba39SBarry Smith	-@chmod g+w  $(PDIR)/*.a
1100b3634f8SBarry Smith	-@echo "Completed compiling Fortran interface library"
1110b3634f8SBarry Smith	-@echo "------------------------------------------"
11283f0b094SBarry Smith
113727c161cSBarry Smith# Builds PETSc test examples for a given BOPT and architecture
114727c161cSBarry Smithtestfortran: chkpetsc_dir
115727c161cSBarry Smith	-@echo "Beginning to compile and run Fortran test examples"
116727c161cSBarry Smith	-@echo "Using compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
117727c161cSBarry Smith	-@echo "Using linker: $(FLINKER)"
118727c161cSBarry Smith	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
119727c161cSBarry Smith	-@echo "Using PETSc directory: $(PETSC_DIR)"
120727c161cSBarry Smith	-@echo "Using PETSc arch: $(PETSC_ARCH)"
121727c161cSBarry Smith	-@echo "------------------------------------------"
122727c161cSBarry Smith	-@echo "Using linker: $(FLINKER)"
123727c161cSBarry Smith	-@echo "Using libraries: $(PETSC_FORTRAN_LIB) $(PETSC_LIB)"
124727c161cSBarry Smith	-@echo "------------------------------------------"
125727c161cSBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
126727c161cSBarry Smith	   ACTION=testexamples_3  tree
127727c161cSBarry Smith	-@echo "Completed compiling and running Fortran test examples"
128727c161cSBarry Smith	-@echo "------------------------------------------"
129727c161cSBarry Smith
1308c37ef55SBarry Smithranlib:
1314e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
13261523587SBarry Smith
13311b6ed10SLois Curfman McInnes# Deletes PETSc libraries
13461523587SBarry Smithdeletelibs:
1354e04c1a0SBarry Smith	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
136d44968ceSBarry Smith
137d44968ceSBarry Smith
13811b6ed10SLois Curfman McInnes# Deletes man pages (HTML version)
139b346654fSBarry Smithdeletewwwpages:
140dea827f2SLois Curfman McInnes	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit \
141dea827f2SLois Curfman McInnes	         $(PETSC_DIR)/docs/www/man*.html
142b346654fSBarry Smith
14311b6ed10SLois Curfman McInnes# Deletes man pages (LaTeX version)
144b346654fSBarry Smithdeletelatexpages:
1457857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
14620563c6bSBarry Smith
1477acb7333SLois Curfman McInnes# To access the tags in emacs, type M-x visit-tags-table and specify
1487acb7333SLois Curfman McInnes# the file petsc/TAGS.	Then, to move to where a PETSc function is
1497acb7333SLois Curfman McInnes# defined, enter M-. and the function name.  To search for a string
1507acb7333SLois Curfman McInnes# and move to the first occurrence, use M-x tags-search and the string.
1517acb7333SLois Curfman McInnes# To locate later occurrences, use M-,
1527acb7333SLois Curfman McInnes
153b38bb785SSatish BalayTAGS_INCLUDE_FILES  = include/*.h include/pinclude/*.h include/FINCLUDE/*.h
154b38bb785SSatish BalayTAGS_BMAKE_FILES    = bmake/common bmake/*/base*
155b38bb785SSatish BalayTAGS_EXAMPLE_FILES  = src/*/examples/*/*.[c,h,F,f] src/*/examples/*/*/*.[c,h,F,f] \
156b38bb785SSatish Balay	src/benchmarks/*.c src/contrib/*/examples/*/*.[c,h,F,f]
157b38bb785SSatish BalayTAGS_DOC_FILES      = docs/tex/manual/routin.tex docs/tex/manual/manual.tex \
158b38bb785SSatish Balay	docs/tex/manual/manual_tex.tex docs/tex/manual/intro.tex \
159b38bb785SSatish Balay	docs/tex/manual/part1.tex docs/tex/manual/part2.tex
1604431cf12SSatish BalayTAGS_SRC_FILES      = src/*/*.[c,h] src/*/interface/*.[c,h] src/*/src/*.[c,h] \
161b38bb785SSatish Balay	src/*/utils/*.[c,h] \
162b38bb785SSatish Balay	src/*/impls/*.[c,h] src/*/impls/*/*.[c,h] src/*/impls/*/*/*.[c,h] \
163b38bb785SSatish Balay	src/gvec/impls/*/*/*/*/*.[c,h] src/contrib/*/*.[c,h] src/contrib/*/src/*.[c,h] \
164b38bb785SSatish Balay	src/fortran/custom/*.[c,h,F]
165b38bb785SSatish BalayTAGS_MAKEFILE_FILES = include/makefile include/*/makefile \
166b38bb785SSatish Balay	makefile \
167b38bb785SSatish Balay	src/makefile src/*/makefile src/*/src/makefile \
168b38bb785SSatish Balay	src/*/interface/makefile \
169b38bb785SSatish Balay	src/*/utils/makefile \
170b38bb785SSatish Balay	src/*/impls/makefile src/*/impls/*/makefile src/*/impls/*/*/makefile \
171b38bb785SSatish Balay	src/*/examples/makefile src/*/examples/*/makefile src/*/examples/*/*/makefile \
172b38bb785SSatish Balay	src/gvec/impls/*/*/*/*/makefile src/gvec/impls/*/*/*/makefile \
173b38bb785SSatish Balay	src/fortran/*/makefile \
174b38bb785SSatish Balay	src/contrib/*/makefile src/contrib/*/src/makefile \
175b38bb785SSatish Balay	src/contrib/*/examples/makefile src/contrib/*/examples/*/makefile \
176b38bb785SSatish Balay	docs/makefile
177b38bb785SSatish Balay
17811b6ed10SLois Curfman McInnes# Builds all etags files
17911b6ed10SLois Curfman McInnesalletags:
1809ae7ee0fSLois Curfman McInnes	-make etags_complete
18111b6ed10SLois Curfman McInnes	-make etags
18211b6ed10SLois Curfman McInnes	-make etags_noexamples
18311b6ed10SLois Curfman McInnes	-make etags_makefiles
18411b6ed10SLois Curfman McInnes
18511b6ed10SLois Curfman McInnes# Builds the basic etags file.	This should be employed by most users.
18620563c6bSBarry Smithetags:
187edd2f0e1SBarry Smith	$(RM) TAGS
188b38bb785SSatish Balay	etags -f TAGS $(TAGS_INCLUDE_FILES)
189b38bb785SSatish Balay	etags -a -f TAGS $(TAGS_SRC_FILES)
190b38bb785SSatish Balay	etags -a -f TAGS $(TAGS_EXAMPLE_FILES)
191b38bb785SSatish Balay	etags -a -f TAGS $(TAGS_MAKEFILE_FILES)
192b38bb785SSatish Balay	etags -a -f TAGS $(TAGS_BMAKE_FILES)
19328988994SBarry Smith	chmod g+w TAGS
194bfce26a3SBarry Smith
19529cdf679SBarry Smith# Builds complete etags list; only for PETSc developers.
19629cdf679SBarry Smithetags_complete:
19729cdf679SBarry Smith	$(RM) TAGS_COMPLETE
1989ca56a1bSSatish Balay	etags -f TAGS_COMPLETE $(TAGS_SRC_FILES)
1999ca56a1bSSatish Balay	etags -a -f TAGS_COMPLETE $(TAGS_INCLUDE_FILES)
200b38bb785SSatish Balay	etags -a -f TAGS_COMPLETE $(TAGS_EXAMPLE_FILES)
201b38bb785SSatish Balay	etags -a -f TAGS_COMPLETE $(TAGS_MAKEFILE_FILES)
202b38bb785SSatish Balay	etags -a -f TAGS_COMPLETE $(TAGS_BMAKE_FILES)
203b38bb785SSatish Balay	etags -a -f TAGS_COMPLETE $(TAGS_DOC_FILES)
20429cdf679SBarry Smith	chmod g+w TAGS_COMPLETE
20529cdf679SBarry Smith
20611b6ed10SLois Curfman McInnes# Builds the etags file that excludes the examples directories
207bfce26a3SBarry Smithetags_noexamples:
208bfce26a3SBarry Smith	$(RM) TAGS_NO_EXAMPLES
2099ca56a1bSSatish Balay	etags -f TAGS_NO_EXAMPLES $(TAGS_SRC_FILES)
2109ca56a1bSSatish Balay	etags -a -f TAGS_NO_EXAMPLES $(TAGS_INCLUDE_FILES)
211b38bb785SSatish Balay	etags -a -f TAGS_NO_EXAMPLES $(TAGS_MAKEFILE_FILES)
212b38bb785SSatish Balay	etags -a -f TAGS_NO_EXAMPLES $(TAGS_BMAKE_FILES)
213b38bb785SSatish Balay	etags -a -f TAGS_NO_EXAMPLES $(TAGS_DOC_FILES)
214bfce26a3SBarry Smith	chmod g+w TAGS_NO_EXAMPLES
215b16a3bb1SBarry Smith
21611b6ed10SLois Curfman McInnes# Builds the etags file for makefiles
217b16a3bb1SBarry Smithetags_makefiles:
218b16a3bb1SBarry Smith	$(RM) TAGS_MAKEFILES
219b38bb785SSatish Balay	etags -f TAGS_MAKEFILES $(TAGS_MAKEFILE_FILES)
220b38bb785SSatish Balay	etags -a -f TAGS_MAKEFILES $(TAGS_BMAKE_FILES)
221b16a3bb1SBarry Smith	chmod g+w TAGS_MAKEFILES
22211b6ed10SLois Curfman McInnes
223b38bb785SSatish Balay#
224b38bb785SSatish Balay# ctags builds the tags file required for VI.
225b38bb785SSatish Balay# To use the tags file do the following:
226b38bb785SSatish Balay# 1. within vi invole the command - :set tags=/home/bsmith/petsc/tags
227b38bb785SSatish Balay#    or add  the command to your ~/.exrc file - set tags=/home/bsmith/petsc/tags
228b38bb785SSatish Balay# 2. now to go to a tag do - :tag TAGNAME for eg - :tag MatCreate
229b38bb785SSatish Balay#
230b38bb785SSatish Balayctags:
231b38bb785SSatish Balay	$(RM) tags
232b8319b70SSatish Balay	ctags -w -f tags $(TAGS_INCLUDE_FILES)
233b8319b70SSatish Balay	ctags -w -a -f tags $(TAGS_SRC_FILES)
234b38bb785SSatish Balay	ctags -w -a -f tags $(TAGS_EXAMPLE_FILES)
235b38bb785SSatish Balay	ctags -w -a -f tags $(TAGS_MAKEFILE_FILES)
236b38bb785SSatish Balay	ctags -w -a -f tags $(TAGS_BMAKE_FILES)
237b38bb785SSatish Balay	chmod g+w tags
238b38bb785SSatish Balay
23911b6ed10SLois Curfman McInnes# ------------------------------------------------------------------
24011b6ed10SLois Curfman McInnes#
24111b6ed10SLois Curfman McInnes# All remaining actions are intended for PETSc developers only.
24211b6ed10SLois Curfman McInnes# PETSc users should not generally need to use these commands.
24311b6ed10SLois Curfman McInnes#
24411b6ed10SLois Curfman McInnes
24511b6ed10SLois Curfman McInnes# Builds all versions of the man pages
246956e605aSBarry Smithallmanpages: allwwwpages alllatexpages
247dea827f2SLois Curfman McInnesallwwwpages: deletewwwpages
248299192b9SLois Curfman McInnes	-make ACTION=wwwpages_buildcite tree
249c3e30b67SBarry Smith	-cd src/fortran/custom; make wwwpages_buildcite
250c3e30b67SBarry Smith	-cd src/fortran/custom; make wwwpages
251dea827f2SLois Curfman McInnes	-make ACTION=wwwpages tree
252dea827f2SLois Curfman McInnes	-maint/wwwman
2539921e35aSSatish Balay	-maint/examplesindex.tcl -www
254f8cfbf3fSSatish Balay	-maint/htmlkeywords.tcl
25551c61065SBarry Smith	-@chmod g+w docs/www/man*/*
256416022c9SBarry Smithalllatexpages: deletelatexpages
257416022c9SBarry Smith	-make ACTION=latexpages tree
258c3e30b67SBarry Smith	-cd src/fortran/custom; make latexpages
25951c61065SBarry Smith	-@chmod g+w docs/tex/rsum/*
260416022c9SBarry Smith
26111b6ed10SLois Curfman McInnes# Builds Fortran stub files
26211b6ed10SLois Curfman McInnesallfortranstubs:
26335aab85fSBarry Smith	-@include/finclude/generateincludes
2644b0e389bSBarry Smith	-@$(RM) -f $(PETSC_DIR)/src/fortran/auto/*.c
26511b6ed10SLois Curfman McInnes	-make ACTION=fortranstubs tree
2664b0e389bSBarry Smith	chmod g+w $(PETSC_DIR)/src/fortran/auto/*.c
267f6ff2982SSatish Balay
268*b951964fSBarry Smithallci: chkpetsc_dir
269*b951964fSBarry Smith	-@cd $(PETSC_DIR)/src/fortran/custom ; $(OMAKE) PETSC_ARCH=$(PETSC_ARCH) ci
270*b951964fSBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=ci  tree
271*b951964fSBarry Smith
272956e605aSBarry Smith#
273956e605aSBarry Smith#  We no longer make Unix manpages
274956e605aSBarry Smith#
275956e605aSBarry Smith#allunixmanpages:
276956e605aSBarry Smith#	-make ACTION=manpages tree
277956e605aSBarry Smith#	-cd src/fortran/custom; make manpages
278956e605aSBarry Smith#	-cd docs/man; catman -W .
279956e605aSBarry Smith#	-@chmod g+w docs/man/man*/*
280956e605aSBarry Smith# Deletes man pages (xman version)
281956e605aSBarry Smith#deletemanpages:
282956e605aSBarry Smith#	$(RM) -f $(PETSC_DIR)/Keywords $(PETSC_DIR)/docs/man/man*/*
283f6ff2982SSatish Balay
284