xref: /petsc/makefile (revision 96150870c8b3266c6ae883e637fa7ccda1c3f864)
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\
14*96150870SBarry 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 "------------------------------------------"
410b3634f8SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
420b3634f8SBarry Smith           ACTION=testexamples_1  tree
430b3634f8SBarry Smith	$(RANLIB) $(PDIR)/*.a
440b3634f8SBarry Smith	-@echo "Completed compiling and running test examples"
450b3634f8SBarry Smith	-@echo "------------------------------------------"
460b3634f8SBarry Smith
470b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
480b3634f8SBarry Smithtestfortran: chkpetsc_dir
490b3634f8SBarry Smith	-@echo "Beginning to compile and run Fortran test examples"
509c69534bSBarry Smith	-@echo "Using compiler: $(FC) $(BASEOPTF)"
519c69534bSBarry Smith	-@echo "Using linker: $(FLINKER)"
529c69534bSBarry Smith	-@echo "Using libraries: $(PETSC_FORTRAN_LIB)  $(PETSC_LIB)"
530b3634f8SBarry Smith	-@echo "------------------------------------------"
540b3634f8SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
550b3634f8SBarry Smith           ACTION=testexamples_3  tree
560b3634f8SBarry Smith	$(RANLIB) $(PDIR)/*.a
570b3634f8SBarry Smith	-@echo "Completed compiling and running Fortran test examples"
580b3634f8SBarry Smith	-@echo "------------------------------------------"
5961523587SBarry Smith
6035ca7349SBarry Smith#
6111b6ed10SLois Curfman McInnes# Builds PETSc Fortran interface libary
6211b6ed10SLois Curfman McInnes# Note:  libfast cannot run on .F files on certain machines, so we
6335ca7349SBarry Smith# use lib and check for errors here.
6483f0b094SBarry Smithfortran: chkpetsc_dir
65f4c0a52aSLois Curfman McInnes	-$(RM) -f $(PDIR)/libpetscfortran.a
660b3634f8SBarry Smith	-@echo "Beginning to compile Fortran interface library"
670b3634f8SBarry Smith	-@echo "------------------------------------------"
68b16a3bb1SBarry Smith	-@cd src/fortran/custom; \
6935ca7349SBarry Smith          $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
7035ca7349SBarry Smith          grep -v clog trashz | grep -v "information sections" | \
7135ca7349SBarry Smith          egrep -i '(Error|warning|Can)' >> /dev/null;\
7235ca7349SBarry Smith          if [ "$$?" != 1 ]; then \
7335ca7349SBarry Smith          cat trashz ; fi; $(RM) trashz
74b16a3bb1SBarry Smith	-@cd src/fortran/auto; \
7535ca7349SBarry Smith          $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
7683f0b094SBarry Smith	$(RANLIB) $(PDIR)/libpetscfortran.a
770b3634f8SBarry Smith	-@echo "Completed compiling Fortran interface library"
780b3634f8SBarry Smith	-@echo "------------------------------------------"
7983f0b094SBarry Smith
808c37ef55SBarry Smithranlib:
814e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
8261523587SBarry Smith
8311b6ed10SLois Curfman McInnes# Deletes PETSc libraries
8461523587SBarry Smithdeletelibs:
854e04c1a0SBarry Smith	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
86d44968ceSBarry Smith
8711b6ed10SLois Curfman McInnes# Deletes man pages (xman version)
88d44968ceSBarry Smithdeletemanpages:
897857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/Keywords $(PETSC_DIR)/docs/man/man*/*
90d44968ceSBarry Smith
9111b6ed10SLois Curfman McInnes# Deletes man pages (HTML version)
92b346654fSBarry Smithdeletewwwpages:
937857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit
94b346654fSBarry Smith
9511b6ed10SLois Curfman McInnes# Deletes man pages (LaTeX version)
96b346654fSBarry Smithdeletelatexpages:
977857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
9820563c6bSBarry Smith
997acb7333SLois Curfman McInnes# To access the tags in emacs, type M-x visit-tags-table and specify
1007acb7333SLois Curfman McInnes# the file petsc/TAGS.  Then, to move to where a PETSc function is
1017acb7333SLois Curfman McInnes# defined, enter M-. and the function name.  To search for a string
1027acb7333SLois Curfman McInnes# and move to the first occurrence, use M-x tags-search and the string.
1037acb7333SLois Curfman McInnes# To locate later occurrences, use M-,
1047acb7333SLois Curfman McInnes
10511b6ed10SLois Curfman McInnes# Builds all etags files
10611b6ed10SLois Curfman McInnesalletags:
10711b6ed10SLois Curfman McInnes	-make etags
10811b6ed10SLois Curfman McInnes	-make etags_noexamples
10911b6ed10SLois Curfman McInnes	-make etags_makefiles
11011b6ed10SLois Curfman McInnes
11111b6ed10SLois Curfman McInnes# Builds the basic etags file.  This should be employed by most users.
11220563c6bSBarry Smithetags:
113edd2f0e1SBarry Smith	$(RM) TAGS
11470a6ad8cSBarry Smith	etags -f TAGS    src/*/impls/*/*.h src/*/impls/*/*/*.h
115ba6aed2eSLois Curfman McInnes	etags -a -f TAGS src/*/examples/*.c src/*/examples/*/*.c
116bdec0fbfSBarry Smith	etags -a -f TAGS src/*/*.h src/*/interface/*.c
117bdec0fbfSBarry Smith	etags -a -f TAGS src/*/src/*.c src/*/impls/*/*.c
1180429b4e3SLois Curfman McInnes	etags -a -f TAGS src/*/impls/*/*/*.c
1194c71ded4SBarry Smith	etags -a -f TAGS include/*.h include/*include/*.h bmake/common
12070a6ad8cSBarry Smith	etags -a -f TAGS src/*/impls/*.c src/*/utils/*.c
1210de55854SLois Curfman McInnes	etags -a -f TAGS makefile src/*/src/makefile
1220de55854SLois Curfman McInnes	etags -a -f TAGS src/*/interface/makefile src/makefile
123f5354500SBarry Smith	etags -a -f TAGS src/*/impls/makefile src/*/impls/*/makefile
1243ebb8ef7SBarry Smith	etags -a -f TAGS src/*/utils/makefile src/*/examples/makefile
1250de55854SLois Curfman McInnes	etags -a -f TAGS src/*/examples/*/makefile
1263ebb8ef7SBarry Smith	etags -a -f TAGS src/*/makefile src/*/impls/*/*/makefile
1272bf65771SLois Curfman McInnes	etags -a -f TAGS src/fortran/makefile src/fortran/auto/makefile
1282bf65771SLois Curfman McInnes	etags -a -f TAGS src/fortran/custom/makefile
1290de55854SLois Curfman McInnes	etags -a -f TAGS include/makefile include/*/makefile docs/makefile
1300675aaacSBarry Smith	etags -a -f TAGS bmake/common bmake/sun4/sun4* bmake/rs6000/rs6000*
131deb7fc1cSBarry Smith	etags -a -f TAGS bmake/solaris/solaris*
1320675aaacSBarry Smith	etags -a -f TAGS bmake/IRIX/IRIX* bmake/freebsd/freebsd*
133017faef8SBarry Smith	etags -a -f TAGS bmake/hpux/hpux* bmake/alpha/alpha*
1340675aaacSBarry Smith	etags -a -f TAGS bmake/t3d/t3d* bmake/paragon/paragon*
13570a6ad8cSBarry Smith	etags -a -f TAGS docs/tex/routin.tex  docs/tex/manual.tex
1366f817ba4SBarry Smith	etags -a -f TAGS docs/tex/intro.tex  docs/tex/part1.tex
1374c71ded4SBarry Smith	etags -a -f TAGS src/fortran/custom/*.c src/fortran/auto/*.c
1381987afe7SBarry Smith	etags -a -f TAGS src/*/examples/*.F
13928988994SBarry Smith	chmod g+w TAGS
140bfce26a3SBarry Smith
14111b6ed10SLois Curfman McInnes# Builds the etags file that excludes the examples directories
142bfce26a3SBarry Smithetags_noexamples:
143bfce26a3SBarry Smith	$(RM) TAGS_NO_EXAMPLES
144bfce26a3SBarry Smith	etags -f TAGS_NO_EXAMPLES src/*/impls/*/*.h src/*/impls/*/*/*.h
145c9589998SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/*.h src/*/interface/*.c
14664f8aa17SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/src/*.c  src/*/impls/*/*.c
1470429b4e3SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/impls/*/*/*.c
1484c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES include/*.h include/*include/*.h
149b16a3bb1SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/common
150464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/impls/*.c src/*/utils/*.c
1510de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES makefile src/*/src/makefile
1520de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/interface/makefile src/makefile
153464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/impls/makefile src/*/impls/*/makefile
154464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/utils/makefile
155464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/makefile src/*/impls/*/*/makefile
1562bf65771SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/fortran/makefile src/fortran/auto/makefile
1572bf65771SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/fortran/custom/makefile
1580de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES include/makefile include/*/makefile docs/makefile
159464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/common bmake/sun4/sun4*
160464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/rs6000/rs6000*
161464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/solaris/solaris*
162464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/IRIX/IRIX* bmake/freebsd/freebsd*
163464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/hpux/hpux* bmake/alpha/alpha*
164464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/t3d/t3d* bmake/paragon/paragon*
165464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/routin.tex  docs/tex/manual.tex
166464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/intro.tex  docs/tex/part1.tex
1674c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/fortran/auto/*.c
1684c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/fortran/custom/*.c
169bfce26a3SBarry Smith	chmod g+w TAGS_NO_EXAMPLES
170b16a3bb1SBarry Smith
17111b6ed10SLois Curfman McInnes# Builds the etags file for makefiles
172b16a3bb1SBarry Smithetags_makefiles:
173b16a3bb1SBarry Smith	$(RM) TAGS_MAKEFILES
174b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/common
1750de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES makefile src/*/src/makefile
1760de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/interface/makefile src/makefile
177b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES src/*/impls/makefile src/*/impls/*/makefile
1782328c152SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/utils/makefile src/*/interface/makefile
179b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES src/*/makefile src/*/impls/*/*/makefile
1800de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/examples/makefile src/*/examples/*/makefile
1812bf65771SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/fortran/makefile src/fortran/auto/makefile
1822bf65771SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/fortran/custom/makefile
1830de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES include/makefile include/*/makefile docs/makefile
184b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/common bmake/sun4/sun4*
185b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/rs6000/rs6000*
186b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/solaris/solaris*
187b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/IRIX/IRIX* bmake/freebsd/freebsd*
188b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/hpux/hpux* bmake/alpha/alpha*
189b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/t3d/t3d* bmake/paragon/paragon*
190b16a3bb1SBarry Smith	chmod g+w TAGS_MAKEFILES
19111b6ed10SLois Curfman McInnes
19211b6ed10SLois Curfman McInnes# ------------------------------------------------------------------
19311b6ed10SLois Curfman McInnes#
19411b6ed10SLois Curfman McInnes# All remaining actions are intended for PETSc developers only.
19511b6ed10SLois Curfman McInnes# PETSc users should not generally need to use these commands.
19611b6ed10SLois Curfman McInnes#
19711b6ed10SLois Curfman McInnes
19811b6ed10SLois Curfman McInnes# Builds all versions of the man pages
19911b6ed10SLois Curfman McInnesallmanpages: deletemanpages deletewwwpages deletelatexpages
20011b6ed10SLois Curfman McInnes	-make ACTION=manpages tree
20111b6ed10SLois Curfman McInnes	-make ACTION=wwwpages tree
20211b6ed10SLois Curfman McInnes	-make ACTION=latexpages tree
20311b6ed10SLois Curfman McInnes	-maint/wwwman
20411b6ed10SLois Curfman McInnes
205416022c9SBarry Smithalllatexpages: deletelatexpages
206416022c9SBarry Smith	-make ACTION=latexpages tree
207416022c9SBarry Smith
20811b6ed10SLois Curfman McInnes# Builds Fortran stub files
20911b6ed10SLois Curfman McInnesallfortranstubs:
21011b6ed10SLois Curfman McInnes	-@$(RM) $(PETSC_DIR)/fortran/auto/*.c
21111b6ed10SLois Curfman McInnes	-make ACTION=fortranstubs tree
21211b6ed10SLois Curfman McInnes
213