xref: /petsc/makefile (revision 531823f5e3fdd698c8c9830e75be215a57238e81)
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\
1496150870SBarry Smith           bmake/common bmake/*/* maint/autoftp
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
250b3634f8SBarry Smith	-@echo "Beginning to compile libraries in all directories"
260b3634f8SBarry Smith	-@echo "Using $(CC) $(PETSC_INCLUDE) $(CONF) $(PCONF) $(BASEOPT)"
270b3634f8SBarry Smith	-@echo "------------------------------------------"
28e35bd481SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
29f3848965SBarry Smith           ACTION=libfast  tree
304e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
310b3634f8SBarry Smith	-@echo "Completed building libraries"
320b3634f8SBarry Smith	-@echo "------------------------------------------"
330b3634f8SBarry Smith
340b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
350b3634f8SBarry Smithtestexamples: chkpetsc_dir
360b3634f8SBarry Smith	-@echo "Beginning to compile and run test examples"
379c69534bSBarry Smith	-@echo "Using compiler: $(CC) $(PETSC_INCLUDE) $(PCONF) $(BASEOPT)"
389c69534bSBarry Smith	-@echo "Using linker: $(CLINKER)"
399c69534bSBarry Smith	-@echo "Using libraries: $(PETSC_LIB)"
400b3634f8SBarry Smith	-@echo "------------------------------------------"
4131ca9999SBarry Smith	-@echo "Due to different numerical round-off on   "
429da4b979SBarry Smith	-@echo "certain machines some of the numbers may not  "
439da4b979SBarry Smith	-@echo "match exactly."
4431ca9999SBarry Smith	-@echo "------------------------------------------"
450b3634f8SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
460b3634f8SBarry Smith           ACTION=testexamples_1  tree
470b3634f8SBarry Smith	-@echo "Completed compiling and running test examples"
480b3634f8SBarry Smith	-@echo "------------------------------------------"
490b3634f8SBarry Smith
500b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
510b3634f8SBarry Smithtestfortran: chkpetsc_dir
520b3634f8SBarry Smith	-@echo "Beginning to compile and run Fortran test examples"
539c69534bSBarry Smith	-@echo "Using compiler: $(FC) $(BASEOPTF)"
549c69534bSBarry Smith	-@echo "Using linker: $(FLINKER)"
559c69534bSBarry Smith	-@echo "Using libraries: $(PETSC_FORTRAN_LIB)  $(PETSC_LIB)"
560b3634f8SBarry Smith	-@echo "------------------------------------------"
570b3634f8SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
580b3634f8SBarry Smith           ACTION=testexamples_3  tree
590b3634f8SBarry Smith	-@echo "Completed compiling and running Fortran test examples"
600b3634f8SBarry Smith	-@echo "------------------------------------------"
6161523587SBarry Smith
6235ca7349SBarry Smith#
6311b6ed10SLois Curfman McInnes# Builds PETSc Fortran interface libary
6411b6ed10SLois Curfman McInnes# Note:  libfast cannot run on .F files on certain machines, so we
6535ca7349SBarry Smith# use lib and check for errors here.
6683f0b094SBarry Smithfortran: chkpetsc_dir
67f4c0a52aSLois Curfman McInnes	-$(RM) -f $(PDIR)/libpetscfortran.a
680b3634f8SBarry Smith	-@echo "Beginning to compile Fortran interface library"
690b3634f8SBarry Smith	-@echo "------------------------------------------"
70b16a3bb1SBarry Smith	-@cd src/fortran/custom; \
7135ca7349SBarry Smith          $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
7235ca7349SBarry Smith          grep -v clog trashz | grep -v "information sections" | \
7335ca7349SBarry Smith          egrep -i '(Error|warning|Can)' >> /dev/null;\
7435ca7349SBarry Smith          if [ "$$?" != 1 ]; then \
7535ca7349SBarry Smith          cat trashz ; fi; $(RM) trashz
76b16a3bb1SBarry Smith	-@cd src/fortran/auto; \
7735ca7349SBarry Smith          $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
7883f0b094SBarry Smith	$(RANLIB) $(PDIR)/libpetscfortran.a
790b3634f8SBarry Smith	-@echo "Completed compiling Fortran interface library"
800b3634f8SBarry Smith	-@echo "------------------------------------------"
8183f0b094SBarry Smith
828c37ef55SBarry Smithranlib:
834e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
8461523587SBarry Smith
8511b6ed10SLois Curfman McInnes# Deletes PETSc libraries
8661523587SBarry Smithdeletelibs:
874e04c1a0SBarry Smith	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
88d44968ceSBarry Smith
8911b6ed10SLois Curfman McInnes# Deletes man pages (xman version)
90d44968ceSBarry Smithdeletemanpages:
917857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/Keywords $(PETSC_DIR)/docs/man/man*/*
92d44968ceSBarry Smith
9311b6ed10SLois Curfman McInnes# Deletes man pages (HTML version)
94b346654fSBarry Smithdeletewwwpages:
957857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit
96b346654fSBarry Smith
9711b6ed10SLois Curfman McInnes# Deletes man pages (LaTeX version)
98b346654fSBarry Smithdeletelatexpages:
997857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
10020563c6bSBarry Smith
1017acb7333SLois Curfman McInnes# To access the tags in emacs, type M-x visit-tags-table and specify
1027acb7333SLois Curfman McInnes# the file petsc/TAGS.  Then, to move to where a PETSc function is
1037acb7333SLois Curfman McInnes# defined, enter M-. and the function name.  To search for a string
1047acb7333SLois Curfman McInnes# and move to the first occurrence, use M-x tags-search and the string.
1057acb7333SLois Curfman McInnes# To locate later occurrences, use M-,
1067acb7333SLois Curfman McInnes
10711b6ed10SLois Curfman McInnes# Builds all etags files
10811b6ed10SLois Curfman McInnesalletags:
10911b6ed10SLois Curfman McInnes	-make etags
11011b6ed10SLois Curfman McInnes	-make etags_noexamples
11111b6ed10SLois Curfman McInnes	-make etags_makefiles
11211b6ed10SLois Curfman McInnes
11311b6ed10SLois Curfman McInnes# Builds the basic etags file.  This should be employed by most users.
11420563c6bSBarry Smithetags:
115edd2f0e1SBarry Smith	$(RM) TAGS
11670a6ad8cSBarry Smith	etags -f TAGS    src/*/impls/*/*.h src/*/impls/*/*/*.h
117ba6aed2eSLois Curfman McInnes	etags -a -f TAGS src/*/examples/*.c src/*/examples/*/*.c
118*531823f5SLois Curfman McInnes	etags -a -f TAGS src/*/*.h src/*/*/*.h src/*/interface/*.c
119bdec0fbfSBarry Smith	etags -a -f TAGS src/*/src/*.c src/*/impls/*/*.c
1200429b4e3SLois Curfman McInnes	etags -a -f TAGS src/*/impls/*/*/*.c
1214c71ded4SBarry Smith	etags -a -f TAGS include/*.h include/*include/*.h bmake/common
12270a6ad8cSBarry Smith	etags -a -f TAGS src/*/impls/*.c src/*/utils/*.c
1230de55854SLois Curfman McInnes	etags -a -f TAGS makefile src/*/src/makefile
1240de55854SLois Curfman McInnes	etags -a -f TAGS src/*/interface/makefile src/makefile
125f5354500SBarry Smith	etags -a -f TAGS src/*/impls/makefile src/*/impls/*/makefile
1263ebb8ef7SBarry Smith	etags -a -f TAGS src/*/utils/makefile src/*/examples/makefile
1270de55854SLois Curfman McInnes	etags -a -f TAGS src/*/examples/*/makefile
1283ebb8ef7SBarry Smith	etags -a -f TAGS src/*/makefile src/*/impls/*/*/makefile
1292bf65771SLois Curfman McInnes	etags -a -f TAGS src/fortran/makefile src/fortran/auto/makefile
1302bf65771SLois Curfman McInnes	etags -a -f TAGS src/fortran/custom/makefile
1310de55854SLois Curfman McInnes	etags -a -f TAGS include/makefile include/*/makefile docs/makefile
1320675aaacSBarry Smith	etags -a -f TAGS bmake/common bmake/sun4/sun4* bmake/rs6000/rs6000*
133deb7fc1cSBarry Smith	etags -a -f TAGS bmake/solaris/solaris*
1340675aaacSBarry Smith	etags -a -f TAGS bmake/IRIX/IRIX* bmake/freebsd/freebsd*
135017faef8SBarry Smith	etags -a -f TAGS bmake/hpux/hpux* bmake/alpha/alpha*
1360675aaacSBarry Smith	etags -a -f TAGS bmake/t3d/t3d* bmake/paragon/paragon*
1379da4b979SBarry Smith	etags -a -f TAGS docs/tex/routin.tex  docs/tex/manual.tex docs/tex/manual_tex.tex
1389da4b979SBarry Smith	etags -a -f TAGS docs/tex/intro.tex  docs/tex/part1.tex docs/tex/part2.tex
1394c71ded4SBarry Smith	etags -a -f TAGS src/fortran/custom/*.c src/fortran/auto/*.c
1401987afe7SBarry Smith	etags -a -f TAGS src/*/examples/*.F
14128988994SBarry Smith	chmod g+w TAGS
142bfce26a3SBarry Smith
14311b6ed10SLois Curfman McInnes# Builds the etags file that excludes the examples directories
144bfce26a3SBarry Smithetags_noexamples:
145bfce26a3SBarry Smith	$(RM) TAGS_NO_EXAMPLES
146bfce26a3SBarry Smith	etags -f TAGS_NO_EXAMPLES src/*/impls/*/*.h src/*/impls/*/*/*.h
147*531823f5SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/*.h src/*/*/*.h src/*/interface/*.c
14864f8aa17SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/src/*.c  src/*/impls/*/*.c
1490429b4e3SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/impls/*/*/*.c
1504c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES include/*.h include/*include/*.h
151b16a3bb1SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/common
152464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/impls/*.c src/*/utils/*.c
1530de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES makefile src/*/src/makefile
1540de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/interface/makefile src/makefile
155464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/impls/makefile src/*/impls/*/makefile
156464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/utils/makefile
157464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/makefile src/*/impls/*/*/makefile
1582bf65771SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/fortran/makefile src/fortran/auto/makefile
1592bf65771SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/fortran/custom/makefile
1600de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES include/makefile include/*/makefile docs/makefile
161464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/common bmake/sun4/sun4*
162464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/rs6000/rs6000*
163464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/solaris/solaris*
164464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/IRIX/IRIX* bmake/freebsd/freebsd*
165464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/hpux/hpux* bmake/alpha/alpha*
166464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/t3d/t3d* bmake/paragon/paragon*
167464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/routin.tex  docs/tex/manual.tex
168464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/intro.tex  docs/tex/part1.tex
1694c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/fortran/auto/*.c
1704c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/fortran/custom/*.c
171bfce26a3SBarry Smith	chmod g+w TAGS_NO_EXAMPLES
172b16a3bb1SBarry Smith
17311b6ed10SLois Curfman McInnes# Builds the etags file for makefiles
174b16a3bb1SBarry Smithetags_makefiles:
175b16a3bb1SBarry Smith	$(RM) TAGS_MAKEFILES
176b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/common
1770de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES makefile src/*/src/makefile
1780de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/interface/makefile src/makefile
179b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES src/*/impls/makefile src/*/impls/*/makefile
1802328c152SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/utils/makefile src/*/interface/makefile
181b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES src/*/makefile src/*/impls/*/*/makefile
1820de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/examples/makefile src/*/examples/*/makefile
1832bf65771SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/fortran/makefile src/fortran/auto/makefile
1842bf65771SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/fortran/custom/makefile
1850de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES include/makefile include/*/makefile docs/makefile
186b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/common bmake/sun4/sun4*
187b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/rs6000/rs6000*
188b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/solaris/solaris*
189b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/IRIX/IRIX* bmake/freebsd/freebsd*
190b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/hpux/hpux* bmake/alpha/alpha*
191b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/t3d/t3d* bmake/paragon/paragon*
192b16a3bb1SBarry Smith	chmod g+w TAGS_MAKEFILES
19311b6ed10SLois Curfman McInnes
19411b6ed10SLois Curfman McInnes# ------------------------------------------------------------------
19511b6ed10SLois Curfman McInnes#
19611b6ed10SLois Curfman McInnes# All remaining actions are intended for PETSc developers only.
19711b6ed10SLois Curfman McInnes# PETSc users should not generally need to use these commands.
19811b6ed10SLois Curfman McInnes#
19911b6ed10SLois Curfman McInnes
20011b6ed10SLois Curfman McInnes# Builds all versions of the man pages
20111b6ed10SLois Curfman McInnesallmanpages: deletemanpages deletewwwpages deletelatexpages
20211b6ed10SLois Curfman McInnes	-make ACTION=manpages tree
20311b6ed10SLois Curfman McInnes	-make ACTION=wwwpages tree
20411b6ed10SLois Curfman McInnes	-make ACTION=latexpages tree
20511b6ed10SLois Curfman McInnes	-maint/wwwman
20611b6ed10SLois Curfman McInnes
207416022c9SBarry Smithalllatexpages: deletelatexpages
208416022c9SBarry Smith	-make ACTION=latexpages tree
209416022c9SBarry Smith
21011b6ed10SLois Curfman McInnes# Builds Fortran stub files
21111b6ed10SLois Curfman McInnesallfortranstubs:
21211b6ed10SLois Curfman McInnes	-@$(RM) $(PETSC_DIR)/fortran/auto/*.c
21311b6ed10SLois Curfman McInnes	-make ACTION=fortranstubs tree
21411b6ed10SLois Curfman McInnes
215