xref: /petsc/makefile (revision 0b3634f8f4da7cac8744b671a33f0207f2031a04)
111b6ed10SLois Curfman McInnes#
211b6ed10SLois Curfman McInnes# This makefile contains some basic commands for building PETSc.
311b6ed10SLois Curfman McInnes# See bmake/common for additional commands.
411b6ed10SLois Curfman McInnes#
511b6ed10SLois Curfman McInnes
60de55854SLois Curfman McInnesPETSC_DIR = .
761523587SBarry Smith
855659b69SBarry SmithCFLAGS   =  -I$(PETSC_DIR)/include -I.. -I$(PETSC_DIR) $(CONF) $(PCONF)
961523587SBarry SmithSOURCEC  =
1061523587SBarry SmithSOURCEF  =
116f817ba4SBarry SmithSOURCEH  = Changes Machines Readme maint/addlinks maint/buildtest \
12bcfa8486SBarry Smith           maint/builddist FAQ Installation Performance BugReporting\
13deb7fc1cSBarry Smith           maint/buildlinks maint/wwwman maint/xclude maint/crontab\
1420957fcfSLois Curfman McInnes           bmake/common bmake/*/*
1561523587SBarry SmithOBJSC    =
1661523587SBarry SmithOBJSF    =
1761523587SBarry SmithLIBBASE  = libpetscvec
18b16a3bb1SBarry SmithDIRS     = src include docs
1961523587SBarry Smith
200de55854SLois Curfman McInnesinclude $(PETSC_DIR)/bmake/$(PETSC_ARCH)/$(PETSC_ARCH)
2161523587SBarry Smith
2211b6ed10SLois Curfman McInnes# Builds PETSc libraries for a given BOPT and architecture
237857610eSBarry Smithall: chkpetsc_dir
244e04c1a0SBarry Smith	-$(RM) -f $(PDIR)/*.a
25*0b3634f8SBarry Smith	-@echo "Beginning to compile libraries in all directories"
26*0b3634f8SBarry Smith	-@echo "Using $(CC) $(PETSC_INCLUDE) $(CONF) $(PCONF) $(BASEOPT)"
27*0b3634f8SBarry Smith	-@echo "------------------------------------------"
28e35bd481SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
29f3848965SBarry Smith           ACTION=libfast  tree
304e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
31*0b3634f8SBarry Smith	-@echo "Completed building libraries"
32*0b3634f8SBarry Smith	-@echo "------------------------------------------"
33*0b3634f8SBarry Smith
34*0b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
35*0b3634f8SBarry Smithtestexamples: chkpetsc_dir
36*0b3634f8SBarry Smith	-@echo "Beginning to compile and run test examples"
37*0b3634f8SBarry Smith	-@echo "Using $(CLINKER)  $(PETSC_LIB)"
38*0b3634f8SBarry Smith	-@echo "------------------------------------------"
39*0b3634f8SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
40*0b3634f8SBarry Smith           ACTION=testexamples_1  tree
41*0b3634f8SBarry Smith	$(RANLIB) $(PDIR)/*.a
42*0b3634f8SBarry Smith	-@echo "Completed compiling and running test examples"
43*0b3634f8SBarry Smith	-@echo "------------------------------------------"
44*0b3634f8SBarry Smith
45*0b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
46*0b3634f8SBarry Smithtestfortran: chkpetsc_dir
47*0b3634f8SBarry Smith	-@echo "Beginning to compile and run Fortran test examples"
48*0b3634f8SBarry Smith	-@echo "Using $(FLINKER) $(PETSC_FORTRAN_LIB) \
49*0b3634f8SBarry Smith                $(PETSC_LIB)"
50*0b3634f8SBarry Smith	-@echo "------------------------------------------"
51*0b3634f8SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
52*0b3634f8SBarry Smith           ACTION=testexamples_3  tree
53*0b3634f8SBarry Smith	$(RANLIB) $(PDIR)/*.a
54*0b3634f8SBarry Smith	-@echo "Completed compiling and running Fortran test examples"
55*0b3634f8SBarry Smith	-@echo "------------------------------------------"
5661523587SBarry Smith
5735ca7349SBarry Smith#
5811b6ed10SLois Curfman McInnes# Builds PETSc Fortran interface libary
5911b6ed10SLois Curfman McInnes# Note:  libfast cannot run on .F files on certain machines, so we
6035ca7349SBarry Smith# use lib and check for errors here.
6183f0b094SBarry Smithfortran: chkpetsc_dir
62*0b3634f8SBarry Smith	-@echo "Beginning to compile Fortran interface library"
63*0b3634f8SBarry Smith	-@echo "------------------------------------------"
64b16a3bb1SBarry Smith	-@cd src/fortran/custom; \
6535ca7349SBarry Smith          $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
6635ca7349SBarry Smith          grep -v clog trashz | grep -v "information sections" | \
6735ca7349SBarry Smith          egrep -i '(Error|warning|Can)' >> /dev/null;\
6835ca7349SBarry Smith          if [ "$$?" != 1 ]; then \
6935ca7349SBarry Smith          cat trashz ; fi; $(RM) trashz
70b16a3bb1SBarry Smith	-@cd src/fortran/auto; \
7135ca7349SBarry Smith          $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
7283f0b094SBarry Smith	$(RANLIB) $(PDIR)/libpetscfortran.a
73*0b3634f8SBarry Smith	-@echo "Completed compiling Fortran interface library"
74*0b3634f8SBarry Smith	-@echo "------------------------------------------"
7583f0b094SBarry Smith
768c37ef55SBarry Smithranlib:
774e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
7861523587SBarry Smith
7911b6ed10SLois Curfman McInnes# Deletes PETSc libraries
8061523587SBarry Smithdeletelibs:
814e04c1a0SBarry Smith	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
82d44968ceSBarry Smith
8311b6ed10SLois Curfman McInnes# Deletes man pages (xman version)
84d44968ceSBarry Smithdeletemanpages:
857857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/Keywords $(PETSC_DIR)/docs/man/man*/*
86d44968ceSBarry Smith
8711b6ed10SLois Curfman McInnes# Deletes man pages (HTML version)
88b346654fSBarry Smithdeletewwwpages:
897857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit
90b346654fSBarry Smith
9111b6ed10SLois Curfman McInnes# Deletes man pages (LaTeX version)
92b346654fSBarry Smithdeletelatexpages:
937857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
9420563c6bSBarry Smith
957acb7333SLois Curfman McInnes# To access the tags in emacs, type M-x visit-tags-table and specify
967acb7333SLois Curfman McInnes# the file petsc/TAGS.  Then, to move to where a PETSc function is
977acb7333SLois Curfman McInnes# defined, enter M-. and the function name.  To search for a string
987acb7333SLois Curfman McInnes# and move to the first occurrence, use M-x tags-search and the string.
997acb7333SLois Curfman McInnes# To locate later occurrences, use M-,
1007acb7333SLois Curfman McInnes
10111b6ed10SLois Curfman McInnes# Builds all etags files
10211b6ed10SLois Curfman McInnesalletags:
10311b6ed10SLois Curfman McInnes	-make etags
10411b6ed10SLois Curfman McInnes	-make etags_noexamples
10511b6ed10SLois Curfman McInnes	-make etags_makefiles
10611b6ed10SLois Curfman McInnes
10711b6ed10SLois Curfman McInnes# Builds the basic etags file.  This should be employed by most users.
10820563c6bSBarry Smithetags:
109edd2f0e1SBarry Smith	$(RM) TAGS
11070a6ad8cSBarry Smith	etags -f TAGS    src/*/impls/*/*.h src/*/impls/*/*/*.h
111ba6aed2eSLois Curfman McInnes	etags -a -f TAGS src/*/examples/*.c src/*/examples/*/*.c
112bdec0fbfSBarry Smith	etags -a -f TAGS src/*/*.h src/*/interface/*.c
113bdec0fbfSBarry Smith	etags -a -f TAGS src/*/src/*.c src/*/impls/*/*.c
1140429b4e3SLois Curfman McInnes	etags -a -f TAGS src/*/impls/*/*/*.c
1154c71ded4SBarry Smith	etags -a -f TAGS include/*.h include/*include/*.h bmake/common
11670a6ad8cSBarry Smith	etags -a -f TAGS src/*/impls/*.c src/*/utils/*.c
1170de55854SLois Curfman McInnes	etags -a -f TAGS makefile src/*/src/makefile
1180de55854SLois Curfman McInnes	etags -a -f TAGS src/*/interface/makefile src/makefile
119f5354500SBarry Smith	etags -a -f TAGS src/*/impls/makefile src/*/impls/*/makefile
1203ebb8ef7SBarry Smith	etags -a -f TAGS src/*/utils/makefile src/*/examples/makefile
1210de55854SLois Curfman McInnes	etags -a -f TAGS src/*/examples/*/makefile
1223ebb8ef7SBarry Smith	etags -a -f TAGS src/*/makefile src/*/impls/*/*/makefile
1232bf65771SLois Curfman McInnes	etags -a -f TAGS src/fortran/makefile src/fortran/auto/makefile
1242bf65771SLois Curfman McInnes	etags -a -f TAGS src/fortran/custom/makefile
1250de55854SLois Curfman McInnes	etags -a -f TAGS include/makefile include/*/makefile docs/makefile
1260675aaacSBarry Smith	etags -a -f TAGS bmake/common bmake/sun4/sun4* bmake/rs6000/rs6000*
127deb7fc1cSBarry Smith	etags -a -f TAGS bmake/solaris/solaris*
1280675aaacSBarry Smith	etags -a -f TAGS bmake/IRIX/IRIX* bmake/freebsd/freebsd*
129017faef8SBarry Smith	etags -a -f TAGS bmake/hpux/hpux* bmake/alpha/alpha*
1300675aaacSBarry Smith	etags -a -f TAGS bmake/t3d/t3d* bmake/paragon/paragon*
13170a6ad8cSBarry Smith	etags -a -f TAGS docs/tex/routin.tex  docs/tex/manual.tex
1326f817ba4SBarry Smith	etags -a -f TAGS docs/tex/intro.tex  docs/tex/part1.tex
1334c71ded4SBarry Smith	etags -a -f TAGS src/fortran/custom/*.c src/fortran/auto/*.c
1341987afe7SBarry Smith	etags -a -f TAGS src/*/examples/*.F
13528988994SBarry Smith	chmod g+w TAGS
136bfce26a3SBarry Smith
13711b6ed10SLois Curfman McInnes# Builds the etags file that excludes the examples directories
138bfce26a3SBarry Smithetags_noexamples:
139bfce26a3SBarry Smith	$(RM) TAGS_NO_EXAMPLES
140bfce26a3SBarry Smith	etags -f TAGS_NO_EXAMPLES src/*/impls/*/*.h src/*/impls/*/*/*.h
141c9589998SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/*.h src/*/interface/*.c
14264f8aa17SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/src/*.c  src/*/impls/*/*.c
1430429b4e3SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/impls/*/*/*.c
1444c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES include/*.h include/*include/*.h
145b16a3bb1SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/common
146464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/impls/*.c src/*/utils/*.c
1470de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES makefile src/*/src/makefile
1480de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/interface/makefile src/makefile
149464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/impls/makefile src/*/impls/*/makefile
150464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/utils/makefile
151464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/makefile src/*/impls/*/*/makefile
1522bf65771SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/fortran/makefile src/fortran/auto/makefile
1532bf65771SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/fortran/custom/makefile
1540de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES include/makefile include/*/makefile docs/makefile
155464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/common bmake/sun4/sun4*
156464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/rs6000/rs6000*
157464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/solaris/solaris*
158464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/IRIX/IRIX* bmake/freebsd/freebsd*
159464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/hpux/hpux* bmake/alpha/alpha*
160464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/t3d/t3d* bmake/paragon/paragon*
161464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/routin.tex  docs/tex/manual.tex
162464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/intro.tex  docs/tex/part1.tex
1634c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/fortran/auto/*.c
1644c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/fortran/custom/*.c
165bfce26a3SBarry Smith	chmod g+w TAGS_NO_EXAMPLES
166b16a3bb1SBarry Smith
16711b6ed10SLois Curfman McInnes# Builds the etags file for makefiles
168b16a3bb1SBarry Smithetags_makefiles:
169b16a3bb1SBarry Smith	$(RM) TAGS_MAKEFILES
170b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/common
1710de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES makefile src/*/src/makefile
1720de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/interface/makefile src/makefile
173b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES src/*/impls/makefile src/*/impls/*/makefile
1742328c152SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/utils/makefile src/*/interface/makefile
175b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES src/*/makefile src/*/impls/*/*/makefile
1760de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/examples/makefile src/*/examples/*/makefile
1772bf65771SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/fortran/makefile src/fortran/auto/makefile
1782bf65771SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/fortran/custom/makefile
1790de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES include/makefile include/*/makefile docs/makefile
180b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/common bmake/sun4/sun4*
181b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/rs6000/rs6000*
182b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/solaris/solaris*
183b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/IRIX/IRIX* bmake/freebsd/freebsd*
184b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/hpux/hpux* bmake/alpha/alpha*
185b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/t3d/t3d* bmake/paragon/paragon*
186b16a3bb1SBarry Smith	chmod g+w TAGS_MAKEFILES
18711b6ed10SLois Curfman McInnes
18811b6ed10SLois Curfman McInnes# ------------------------------------------------------------------
18911b6ed10SLois Curfman McInnes#
19011b6ed10SLois Curfman McInnes# All remaining actions are intended for PETSc developers only.
19111b6ed10SLois Curfman McInnes# PETSc users should not generally need to use these commands.
19211b6ed10SLois Curfman McInnes#
19311b6ed10SLois Curfman McInnes
19411b6ed10SLois Curfman McInnes# Builds all versions of the man pages
19511b6ed10SLois Curfman McInnesallmanpages: deletemanpages deletewwwpages deletelatexpages
19611b6ed10SLois Curfman McInnes	-make ACTION=manpages tree
19711b6ed10SLois Curfman McInnes	-make ACTION=wwwpages tree
19811b6ed10SLois Curfman McInnes	-make ACTION=latexpages tree
19911b6ed10SLois Curfman McInnes	-maint/wwwman
20011b6ed10SLois Curfman McInnes
201416022c9SBarry Smithalllatexpages: deletelatexpages
202416022c9SBarry Smith	-make ACTION=latexpages tree
203416022c9SBarry Smith
20411b6ed10SLois Curfman McInnes# Builds Fortran stub files
20511b6ed10SLois Curfman McInnesallfortranstubs:
20611b6ed10SLois Curfman McInnes	-@$(RM) $(PETSC_DIR)/fortran/auto/*.c
20711b6ed10SLois Curfman McInnes	-make ACTION=fortranstubs tree
20811b6ed10SLois Curfman McInnes
209