xref: /petsc/makefile (revision b8319b7004de849fba0fa854ca7671e9b75becc6)
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 \
13bcfa8486SBarry Smith	   maint/builddist FAQ Installation Performance BugReporting\
14deb7fc1cSBarry Smith	   maint/buildlinks maint/wwwman maint/xclude maint/crontab\
154e627d3aSBarry Smith	   bmake/common bmake/*/base* maint/autoftp docs/www/sec/*
1661523587SBarry SmithOBJSC	 =
1761523587SBarry SmithOBJSF	 =
1861523587SBarry SmithLIBBASE	 = libpetscvec
19b16a3bb1SBarry SmithDIRS	 = src include docs
2061523587SBarry Smith
214e627d3aSBarry Smithinclude $(PETSC_DIR)/bmake/$(PETSC_ARCH)/base
2261523587SBarry Smith
2311b6ed10SLois Curfman McInnes# Builds PETSc libraries for a given BOPT and architecture
247857610eSBarry Smithall: chkpetsc_dir
25511caf8eSSatish Balay	-$(RM) -f $(PDIR)/*
260b3634f8SBarry Smith	-@echo "Beginning to compile libraries in all directories"
2726de76a5SSatish Balay	-@echo "Using compiler: $(CC) $(CFLAGS) $(COPTFLAGS)"
28b14e8f29SBarry Smith	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
29b14e8f29SBarry Smith	-@echo "Using configuration flags: $(CONF)"
30b14e8f29SBarry Smith	-@echo "Using include paths: $(PETSC_INCLUDE)"
31c2c9bc36SBarry Smith	-@echo "Using PETSc directory: $(PETSC_DIR)"
32c2c9bc36SBarry Smith	-@echo "Using PETSc arch: $(PETSC_ARCH)"
330b3634f8SBarry Smith	-@echo "------------------------------------------"
34e35bd481SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
35f3848965SBarry Smith	   ACTION=libfast  tree
36aa45e91cSSatish Balay	-@cd $(PETSC_DIR)/src/sys/src ; $(OMAKE) PETSC_ARCH=$(PETSC_ARCH) rs6000_time
374e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
387862f17cSBarry Smith	-@chmod g+w  $(PDIR)/*.a
390b3634f8SBarry Smith	-@echo "Completed building libraries"
400b3634f8SBarry Smith	-@echo "------------------------------------------"
410b3634f8SBarry Smith
420b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
430b3634f8SBarry Smithtestexamples: chkpetsc_dir
440b3634f8SBarry Smith	-@echo "Beginning to compile and run test examples"
4526de76a5SSatish Balay	-@echo "Using compiler: $(CC) $(CFLAGS) $(COPTFLAGS)"
46b14e8f29SBarry Smith	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
47b14e8f29SBarry Smith	-@echo "Using include paths: $(PETSC_INCLUDE)"
48c2c9bc36SBarry Smith	-@echo "Using PETSc directory: $(PETSC_DIR)"
49c2c9bc36SBarry Smith	-@echo "Using PETSc arch: $(PETSC_ARCH)"
50c2c9bc36SBarry Smith	-@echo "------------------------------------------"
519c69534bSBarry Smith	-@echo "Using linker: $(CLINKER)"
529c69534bSBarry Smith	-@echo "Using libraries: $(PETSC_LIB)"
530b3634f8SBarry Smith	-@echo "------------------------------------------"
54eb817c50SBarry Smith	-@echo "Due to different numerical round-off on certain"
55eb817c50SBarry Smith	-@echo "machines some of the numbers may not match exactly."
5631ca9999SBarry Smith	-@echo "------------------------------------------"
570b3634f8SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
580b3634f8SBarry Smith	   ACTION=testexamples_1  tree
590b3634f8SBarry Smith	-@echo "Completed compiling and running test examples"
600b3634f8SBarry Smith	-@echo "------------------------------------------"
610b3634f8SBarry Smith
620b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
638475343bSBarry Smithtestexamples_uni: chkpetsc_dir
648475343bSBarry Smith	-@echo "Beginning to compile and run uniprocessor test examples"
6526de76a5SSatish Balay	-@echo "Using compiler: $(CC) $(CFLAGS) $(COPTFLAGS)"
668475343bSBarry Smith	-@echo "Using linker: $(CLINKER)"
67b14e8f29SBarry Smith	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
68b14e8f29SBarry Smith	-@echo "Using include paths: $(PETSC_INCLUDE)"
69d6db1478SLois Curfman McInnes	-@echo "Using PETSc directory: $(PETSC_DIR)"
70d6db1478SLois Curfman McInnes	-@echo "Using PETSc arch: $(PETSC_ARCH)"
71d6db1478SLois Curfman McInnes	-@echo "------------------------------------------"
72d6db1478SLois Curfman McInnes	-@echo "Using linker: $(CLINKER)"
738475343bSBarry Smith	-@echo "Using libraries: $(PETSC_LIB)"
748475343bSBarry Smith	-@echo "------------------------------------------"
758475343bSBarry Smith	-@echo "Due to different numerical round-off on certain"
768475343bSBarry Smith	-@echo "machines some of the numbers may not match exactly."
778475343bSBarry Smith	-@echo "------------------------------------------"
788475343bSBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
798475343bSBarry Smith	   ACTION=testexamples_4  tree
808475343bSBarry Smith	-@echo "Completed compiling and running uniprocessor test examples"
818475343bSBarry Smith	-@echo "------------------------------------------"
828475343bSBarry Smith
8335ca7349SBarry Smith#
8411b6ed10SLois Curfman McInnes# Builds PETSc Fortran interface libary
8511b6ed10SLois Curfman McInnes# Note:	 libfast cannot run on .F files on certain machines, so we
8635ca7349SBarry Smith# use lib and check for errors here.
8783f0b094SBarry Smithfortran: chkpetsc_dir
88727c161cSBarry Smith	-$(RM) -f $(PDIR)/libpetscfortran.*
890b3634f8SBarry Smith	-@echo "Beginning to compile Fortran interface library"
9026de76a5SSatish Balay	-@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
91fc939babSLois Curfman McInnes	-@echo "Using C/C++ compiler: $(CC) $(CFLAGS) $(COPTFLAGS)"
92fc939babSLois Curfman McInnes	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
93fc939babSLois Curfman McInnes	-@echo "Using configuration flags: $(CONF)"
94fc939babSLois Curfman McInnes	-@echo "Using include paths: $(PETSC_INCLUDE)"
95d6db1478SLois Curfman McInnes	-@echo "Using PETSc directory: $(PETSC_DIR)"
96d6db1478SLois Curfman McInnes	-@echo "Using PETSc arch: $(PETSC_ARCH)"
970b3634f8SBarry Smith	-@echo "------------------------------------------"
98b16a3bb1SBarry Smith	-@cd src/fortran/custom; \
9935ca7349SBarry Smith	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
10035ca7349SBarry Smith	  grep -v clog trashz | grep -v "information sections" | \
10135ca7349SBarry Smith	  egrep -i '(Error|warning|Can)' >> /dev/null;\
10235ca7349SBarry Smith	  if [ "$$?" != 1 ]; then \
10335ca7349SBarry Smith	  cat trashz ; fi; $(RM) trashz
104b16a3bb1SBarry Smith	-@cd src/fortran/auto; \
10535ca7349SBarry Smith	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
10683f0b094SBarry Smith	$(RANLIB) $(PDIR)/libpetscfortran.a
10731dbba39SBarry Smith	-@chmod g+w  $(PDIR)/*.a
1080b3634f8SBarry Smith	-@echo "Completed compiling Fortran interface library"
1090b3634f8SBarry Smith	-@echo "------------------------------------------"
11083f0b094SBarry Smith
111727c161cSBarry Smith# Builds PETSc test examples for a given BOPT and architecture
112727c161cSBarry Smithtestfortran: chkpetsc_dir
113727c161cSBarry Smith	-@echo "Beginning to compile and run Fortran test examples"
114727c161cSBarry Smith	-@echo "Using compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)"
115727c161cSBarry Smith	-@echo "Using linker: $(FLINKER)"
116727c161cSBarry Smith	-@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)"
117727c161cSBarry Smith	-@echo "Using PETSc directory: $(PETSC_DIR)"
118727c161cSBarry Smith	-@echo "Using PETSc arch: $(PETSC_ARCH)"
119727c161cSBarry Smith	-@echo "------------------------------------------"
120727c161cSBarry Smith	-@echo "Using linker: $(FLINKER)"
121727c161cSBarry Smith	-@echo "Using libraries: $(PETSC_FORTRAN_LIB) $(PETSC_LIB)"
122727c161cSBarry Smith	-@echo "------------------------------------------"
123727c161cSBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
124727c161cSBarry Smith	   ACTION=testexamples_3  tree
125727c161cSBarry Smith	-@echo "Completed compiling and running Fortran test examples"
126727c161cSBarry Smith	-@echo "------------------------------------------"
127727c161cSBarry Smith
1288c37ef55SBarry Smithranlib:
1294e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
13061523587SBarry Smith
13111b6ed10SLois Curfman McInnes# Deletes PETSc libraries
13261523587SBarry Smithdeletelibs:
1334e04c1a0SBarry Smith	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
134d44968ceSBarry Smith
135d44968ceSBarry Smith
13611b6ed10SLois Curfman McInnes# Deletes man pages (HTML version)
137b346654fSBarry Smithdeletewwwpages:
138dea827f2SLois Curfman McInnes	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit \
139dea827f2SLois Curfman McInnes	         $(PETSC_DIR)/docs/www/man*.html
140b346654fSBarry Smith
14111b6ed10SLois Curfman McInnes# Deletes man pages (LaTeX version)
142b346654fSBarry Smithdeletelatexpages:
1437857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
14420563c6bSBarry Smith
1457acb7333SLois Curfman McInnes# To access the tags in emacs, type M-x visit-tags-table and specify
1467acb7333SLois Curfman McInnes# the file petsc/TAGS.	Then, to move to where a PETSc function is
1477acb7333SLois Curfman McInnes# defined, enter M-. and the function name.  To search for a string
1487acb7333SLois Curfman McInnes# and move to the first occurrence, use M-x tags-search and the string.
1497acb7333SLois Curfman McInnes# To locate later occurrences, use M-,
1507acb7333SLois Curfman McInnes
151b38bb785SSatish BalayTAGS_INCLUDE_FILES  = include/*.h include/pinclude/*.h include/FINCLUDE/*.h
152b38bb785SSatish BalayTAGS_BMAKE_FILES    = bmake/common bmake/*/base*
153b38bb785SSatish BalayTAGS_EXAMPLE_FILES  = src/*/examples/*/*.[c,h,F,f] src/*/examples/*/*/*.[c,h,F,f] \
154b38bb785SSatish Balay	src/benchmarks/*.c src/contrib/*/examples/*/*.[c,h,F,f]
155b38bb785SSatish BalayTAGS_DOC_FILES      = docs/tex/manual/routin.tex docs/tex/manual/manual.tex \
156b38bb785SSatish Balay	docs/tex/manual/manual_tex.tex docs/tex/manual/intro.tex \
157b38bb785SSatish Balay	docs/tex/manual/part1.tex docs/tex/manual/part2.tex
158b38bb785SSatish BalayTAGS_SRC_FILES      = src/*/*.h src/*/interface/*.[c,h] src/*/src/*.[c,h] \
159b38bb785SSatish Balay	src/*/utils/*.[c,h] \
160b38bb785SSatish Balay	src/*/impls/*.[c,h] src/*/impls/*/*.[c,h] src/*/impls/*/*/*.[c,h] \
161b38bb785SSatish Balay	src/gvec/impls/*/*/*/*/*.[c,h] src/contrib/*/*.[c,h] src/contrib/*/src/*.[c,h] \
162b38bb785SSatish Balay	src/fortran/custom/*.[c,h,F]
163b38bb785SSatish BalayTAGS_MAKEFILE_FILES = include/makefile include/*/makefile \
164b38bb785SSatish Balay	makefile \
165b38bb785SSatish Balay	src/makefile src/*/makefile src/*/src/makefile \
166b38bb785SSatish Balay	src/*/interface/makefile \
167b38bb785SSatish Balay	src/*/utils/makefile \
168b38bb785SSatish Balay	src/*/impls/makefile src/*/impls/*/makefile src/*/impls/*/*/makefile \
169b38bb785SSatish Balay	src/*/examples/makefile src/*/examples/*/makefile src/*/examples/*/*/makefile \
170b38bb785SSatish Balay	src/gvec/impls/*/*/*/*/makefile src/gvec/impls/*/*/*/makefile \
171b38bb785SSatish Balay	src/fortran/*/makefile \
172b38bb785SSatish Balay	src/contrib/*/makefile src/contrib/*/src/makefile \
173b38bb785SSatish Balay	src/contrib/*/examples/makefile src/contrib/*/examples/*/makefile \
174b38bb785SSatish Balay	docs/makefile
175b38bb785SSatish Balay
17611b6ed10SLois Curfman McInnes# Builds all etags files
17711b6ed10SLois Curfman McInnesalletags:
1789ae7ee0fSLois Curfman McInnes	-make etags_complete
17911b6ed10SLois Curfman McInnes	-make etags
18011b6ed10SLois Curfman McInnes	-make etags_noexamples
18111b6ed10SLois Curfman McInnes	-make etags_makefiles
18211b6ed10SLois Curfman McInnes
18311b6ed10SLois Curfman McInnes# Builds the basic etags file.	This should be employed by most users.
18420563c6bSBarry Smithetags:
185edd2f0e1SBarry Smith	$(RM) TAGS
186b38bb785SSatish Balay	etags -f TAGS $(TAGS_INCLUDE_FILES)
187b38bb785SSatish Balay	etags -a -f TAGS $(TAGS_SRC_FILES)
188b38bb785SSatish Balay	etags -a -f TAGS $(TAGS_EXAMPLE_FILES)
189b38bb785SSatish Balay	etags -a -f TAGS $(TAGS_MAKEFILE_FILES)
190b38bb785SSatish Balay	etags -a -f TAGS $(TAGS_BMAKE_FILES)
19128988994SBarry Smith	chmod g+w TAGS
192bfce26a3SBarry Smith
19329cdf679SBarry Smith# Builds complete etags list; only for PETSc developers.
19429cdf679SBarry Smithetags_complete:
19529cdf679SBarry Smith	$(RM) TAGS_COMPLETE
1969ca56a1bSSatish Balay	etags -f TAGS_COMPLETE $(TAGS_SRC_FILES)
1979ca56a1bSSatish Balay	etags -a -f TAGS_COMPLETE $(TAGS_INCLUDE_FILES)
198b38bb785SSatish Balay	etags -a -f TAGS_COMPLETE $(TAGS_EXAMPLE_FILES)
199b38bb785SSatish Balay	etags -a -f TAGS_COMPLETE $(TAGS_MAKEFILE_FILES)
200b38bb785SSatish Balay	etags -a -f TAGS_COMPLETE $(TAGS_BMAKE_FILES)
201b38bb785SSatish Balay	etags -a -f TAGS_COMPLETE $(TAGS_DOC_FILES)
20229cdf679SBarry Smith	chmod g+w TAGS_COMPLETE
20329cdf679SBarry Smith
20411b6ed10SLois Curfman McInnes# Builds the etags file that excludes the examples directories
205bfce26a3SBarry Smithetags_noexamples:
206bfce26a3SBarry Smith	$(RM) TAGS_NO_EXAMPLES
2079ca56a1bSSatish Balay	etags -f TAGS_NO_EXAMPLES $(TAGS_SRC_FILES)
2089ca56a1bSSatish Balay	etags -a -f TAGS_NO_EXAMPLES $(TAGS_INCLUDE_FILES)
209b38bb785SSatish Balay	etags -a -f TAGS_NO_EXAMPLES $(TAGS_MAKEFILE_FILES)
210b38bb785SSatish Balay	etags -a -f TAGS_NO_EXAMPLES $(TAGS_BMAKE_FILES)
211b38bb785SSatish Balay	etags -a -f TAGS_NO_EXAMPLES $(TAGS_DOC_FILES)
212bfce26a3SBarry Smith	chmod g+w TAGS_NO_EXAMPLES
213b16a3bb1SBarry Smith
21411b6ed10SLois Curfman McInnes# Builds the etags file for makefiles
215b16a3bb1SBarry Smithetags_makefiles:
216b16a3bb1SBarry Smith	$(RM) TAGS_MAKEFILES
217b38bb785SSatish Balay	etags -f TAGS_MAKEFILES $(TAGS_MAKEFILE_FILES)
218b38bb785SSatish Balay	etags -a -f TAGS_MAKEFILES $(TAGS_BMAKE_FILES)
219b16a3bb1SBarry Smith	chmod g+w TAGS_MAKEFILES
22011b6ed10SLois Curfman McInnes
221b38bb785SSatish Balay#
222b38bb785SSatish Balay# ctags builds the tags file required for VI.
223b38bb785SSatish Balay# To use the tags file do the following:
224b38bb785SSatish Balay# 1. within vi invole the command - :set tags=/home/bsmith/petsc/tags
225b38bb785SSatish Balay#    or add  the command to your ~/.exrc file - set tags=/home/bsmith/petsc/tags
226b38bb785SSatish Balay# 2. now to go to a tag do - :tag TAGNAME for eg - :tag MatCreate
227b38bb785SSatish Balay#
228b38bb785SSatish Balayctags:
229b38bb785SSatish Balay	$(RM) tags
230*b8319b70SSatish Balay	ctags -w -f tags $(TAGS_INCLUDE_FILES)
231*b8319b70SSatish Balay	ctags -w -a -f tags $(TAGS_SRC_FILES)
232b38bb785SSatish Balay	ctags -w -a -f tags $(TAGS_EXAMPLE_FILES)
233b38bb785SSatish Balay	ctags -w -a -f tags $(TAGS_MAKEFILE_FILES)
234b38bb785SSatish Balay	ctags -w -a -f tags $(TAGS_BMAKE_FILES)
235b38bb785SSatish Balay	chmod g+w tags
236b38bb785SSatish Balay
23711b6ed10SLois Curfman McInnes# ------------------------------------------------------------------
23811b6ed10SLois Curfman McInnes#
23911b6ed10SLois Curfman McInnes# All remaining actions are intended for PETSc developers only.
24011b6ed10SLois Curfman McInnes# PETSc users should not generally need to use these commands.
24111b6ed10SLois Curfman McInnes#
24211b6ed10SLois Curfman McInnes
24311b6ed10SLois Curfman McInnes# Builds all versions of the man pages
244956e605aSBarry Smithallmanpages: allwwwpages alllatexpages
245dea827f2SLois Curfman McInnesallwwwpages: deletewwwpages
246299192b9SLois Curfman McInnes	-make ACTION=wwwpages_buildcite tree
247c3e30b67SBarry Smith	-cd src/fortran/custom; make wwwpages_buildcite
248c3e30b67SBarry Smith	-cd src/fortran/custom; make wwwpages
249dea827f2SLois Curfman McInnes	-make ACTION=wwwpages tree
250dea827f2SLois Curfman McInnes	-maint/wwwman
2519921e35aSSatish Balay	-maint/examplesindex.tcl -www
25251c61065SBarry Smith	-@chmod g+w docs/www/man*/*
253416022c9SBarry Smithalllatexpages: deletelatexpages
254416022c9SBarry Smith	-make ACTION=latexpages tree
255c3e30b67SBarry Smith	-cd src/fortran/custom; make latexpages
25651c61065SBarry Smith	-@chmod g+w docs/tex/rsum/*
257416022c9SBarry Smith
25811b6ed10SLois Curfman McInnes# Builds Fortran stub files
25911b6ed10SLois Curfman McInnesallfortranstubs:
26035aab85fSBarry Smith	-@include/finclude/generateincludes
2614b0e389bSBarry Smith	-@$(RM) -f $(PETSC_DIR)/src/fortran/auto/*.c
26211b6ed10SLois Curfman McInnes	-make ACTION=fortranstubs tree
2634b0e389bSBarry Smith	chmod g+w $(PETSC_DIR)/src/fortran/auto/*.c
264f6ff2982SSatish Balay
265956e605aSBarry Smith#
266956e605aSBarry Smith#  We no longer make Unix manpages
267956e605aSBarry Smith#
268956e605aSBarry Smith#allunixmanpages:
269956e605aSBarry Smith#	-make ACTION=manpages tree
270956e605aSBarry Smith#	-cd src/fortran/custom; make manpages
271956e605aSBarry Smith#	-cd docs/man; catman -W .
272956e605aSBarry Smith#	-@chmod g+w docs/man/man*/*
273956e605aSBarry Smith# Deletes man pages (xman version)
274956e605aSBarry Smith#deletemanpages:
275956e605aSBarry Smith#	$(RM) -f $(PETSC_DIR)/Keywords $(PETSC_DIR)/docs/man/man*/*
276f6ff2982SSatish Balay
277