xref: /petsc/makefile (revision 72936c9dc739294f77410643e1280bcc07c500a7)
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	 =
116daaf66cSBarry SmithSOURCEH	 = Changes Machines Readme maint/addlinks \
12bcfa8486SBarry Smith	   maint/builddist FAQ Installation Performance BugReporting\
13deb7fc1cSBarry Smith	   maint/buildlinks maint/wwwman maint/xclude maint/crontab\
146daaf66cSBarry Smith	   bmake/common bmake/sun4/* bmake/paragon/* bmake/linux/* \
156daaf66cSBarry Smith	   bmake/rs6000/* bmake/alpha/* bmake/IRIX/* bmake/IRIX64/* \
166daaf66cSBarry Smith	   bmake/hpux/* bmake/t3d/* bmake/freebsd/* bmake/solaris/* \
176daaf66cSBarry Smith	   maint/autoftp
1861523587SBarry SmithOBJSC	 =
1961523587SBarry SmithOBJSF	 =
2061523587SBarry SmithLIBBASE	 = libpetscvec
21b16a3bb1SBarry SmithDIRS	 = src include docs
2261523587SBarry Smith
230de55854SLois Curfman McInnesinclude $(PETSC_DIR)/bmake/$(PETSC_ARCH)/$(PETSC_ARCH)
2461523587SBarry Smith
2511b6ed10SLois Curfman McInnes# Builds PETSc libraries for a given BOPT and architecture
267857610eSBarry Smithall: chkpetsc_dir
274e04c1a0SBarry Smith	-$(RM) -f $(PDIR)/*.a
280b3634f8SBarry Smith	-@echo "Beginning to compile libraries in all directories"
290b3634f8SBarry Smith	-@echo "Using $(CC) $(PETSC_INCLUDE) $(CONF) $(PCONF) $(BASEOPT)"
300b3634f8SBarry Smith	-@echo "------------------------------------------"
31e35bd481SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
32f3848965SBarry Smith	   ACTION=libfast  tree
334e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
340b3634f8SBarry Smith	-@echo "Completed building libraries"
350b3634f8SBarry Smith	-@echo "------------------------------------------"
360b3634f8SBarry Smith
370b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
380b3634f8SBarry Smithtestexamples: chkpetsc_dir
390b3634f8SBarry Smith	-@echo "Beginning to compile and run test examples"
409c69534bSBarry Smith	-@echo "Using compiler: $(CC) $(PETSC_INCLUDE) $(PCONF) $(BASEOPT)"
419c69534bSBarry Smith	-@echo "Using linker: $(CLINKER)"
429c69534bSBarry Smith	-@echo "Using libraries: $(PETSC_LIB)"
430b3634f8SBarry Smith	-@echo "------------------------------------------"
44eb817c50SBarry Smith	-@echo "Due to different numerical round-off on certain"
45eb817c50SBarry Smith	-@echo "machines some of the numbers may not match exactly."
4631ca9999SBarry Smith	-@echo "------------------------------------------"
470b3634f8SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
480b3634f8SBarry Smith	   ACTION=testexamples_1  tree
490b3634f8SBarry Smith	-@echo "Completed compiling and running test examples"
500b3634f8SBarry Smith	-@echo "------------------------------------------"
510b3634f8SBarry Smith
520b3634f8SBarry Smith# Builds PETSc test examples for a given BOPT and architecture
538475343bSBarry Smithtestexamples_uni: chkpetsc_dir
548475343bSBarry Smith	-@echo "Beginning to compile and run uniprocessor test examples"
558475343bSBarry Smith	-@echo "Using compiler: $(CC) $(PETSC_INCLUDE) $(PCONF) $(BASEOPT)"
568475343bSBarry Smith	-@echo "Using linker: $(CLINKER)"
578475343bSBarry Smith	-@echo "Using libraries: $(PETSC_LIB)"
588475343bSBarry Smith	-@echo "------------------------------------------"
598475343bSBarry Smith	-@echo "Due to different numerical round-off on certain"
608475343bSBarry Smith	-@echo "machines some of the numbers may not match exactly."
618475343bSBarry Smith	-@echo "------------------------------------------"
628475343bSBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
638475343bSBarry Smith	   ACTION=testexamples_4  tree
648475343bSBarry Smith	-@echo "Completed compiling and running uniprocessor test examples"
658475343bSBarry Smith	-@echo "------------------------------------------"
668475343bSBarry Smith
678475343bSBarry Smith# Builds PETSc test examples for a given BOPT and architecture
680b3634f8SBarry Smithtestfortran: chkpetsc_dir
690b3634f8SBarry Smith	-@echo "Beginning to compile and run Fortran test examples"
709c69534bSBarry Smith	-@echo "Using compiler: $(FC) $(BASEOPTF)"
719c69534bSBarry Smith	-@echo "Using linker: $(FLINKER)"
729c69534bSBarry Smith	-@echo "Using libraries: $(PETSC_FORTRAN_LIB)  $(PETSC_LIB)"
730b3634f8SBarry Smith	-@echo "------------------------------------------"
740b3634f8SBarry Smith	-@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \
750b3634f8SBarry Smith	   ACTION=testexamples_3  tree
760b3634f8SBarry Smith	-@echo "Completed compiling and running Fortran test examples"
770b3634f8SBarry Smith	-@echo "------------------------------------------"
7861523587SBarry Smith
7935ca7349SBarry Smith#
8011b6ed10SLois Curfman McInnes# Builds PETSc Fortran interface libary
8111b6ed10SLois Curfman McInnes# Note:	 libfast cannot run on .F files on certain machines, so we
8235ca7349SBarry Smith# use lib and check for errors here.
8383f0b094SBarry Smithfortran: chkpetsc_dir
84f4c0a52aSLois Curfman McInnes	-$(RM) -f $(PDIR)/libpetscfortran.a
850b3634f8SBarry Smith	-@echo "Beginning to compile Fortran interface library"
860b3634f8SBarry Smith	-@echo "------------------------------------------"
87b16a3bb1SBarry Smith	-@cd src/fortran/custom; \
8835ca7349SBarry Smith	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \
8935ca7349SBarry Smith	  grep -v clog trashz | grep -v "information sections" | \
9035ca7349SBarry Smith	  egrep -i '(Error|warning|Can)' >> /dev/null;\
9135ca7349SBarry Smith	  if [ "$$?" != 1 ]; then \
9235ca7349SBarry Smith	  cat trashz ; fi; $(RM) trashz
93b16a3bb1SBarry Smith	-@cd src/fortran/auto; \
9435ca7349SBarry Smith	  $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast
9583f0b094SBarry Smith	$(RANLIB) $(PDIR)/libpetscfortran.a
960b3634f8SBarry Smith	-@echo "Completed compiling Fortran interface library"
970b3634f8SBarry Smith	-@echo "------------------------------------------"
9883f0b094SBarry Smith
998c37ef55SBarry Smithranlib:
1004e04c1a0SBarry Smith	$(RANLIB) $(PDIR)/*.a
10161523587SBarry Smith
10211b6ed10SLois Curfman McInnes# Deletes PETSc libraries
10361523587SBarry Smithdeletelibs:
1044e04c1a0SBarry Smith	-$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/*
105d44968ceSBarry Smith
10611b6ed10SLois Curfman McInnes# Deletes man pages (xman version)
107d44968ceSBarry Smithdeletemanpages:
1087857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/Keywords $(PETSC_DIR)/docs/man/man*/*
109d44968ceSBarry Smith
11011b6ed10SLois Curfman McInnes# Deletes man pages (HTML version)
111b346654fSBarry Smithdeletewwwpages:
1127857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit
113b346654fSBarry Smith
11411b6ed10SLois Curfman McInnes# Deletes man pages (LaTeX version)
115b346654fSBarry Smithdeletelatexpages:
1167857610eSBarry Smith	$(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex
11720563c6bSBarry Smith
1187acb7333SLois Curfman McInnes# To access the tags in emacs, type M-x visit-tags-table and specify
1197acb7333SLois Curfman McInnes# the file petsc/TAGS.	Then, to move to where a PETSc function is
1207acb7333SLois Curfman McInnes# defined, enter M-. and the function name.  To search for a string
1217acb7333SLois Curfman McInnes# and move to the first occurrence, use M-x tags-search and the string.
1227acb7333SLois Curfman McInnes# To locate later occurrences, use M-,
1237acb7333SLois Curfman McInnes
12411b6ed10SLois Curfman McInnes# Builds all etags files
12511b6ed10SLois Curfman McInnesalletags:
12611b6ed10SLois Curfman McInnes	-make etags
12711b6ed10SLois Curfman McInnes	-make etags_noexamples
12811b6ed10SLois Curfman McInnes	-make etags_makefiles
12911b6ed10SLois Curfman McInnes
13011b6ed10SLois Curfman McInnes# Builds the basic etags file.	This should be employed by most users.
13120563c6bSBarry Smithetags:
132edd2f0e1SBarry Smith	$(RM) TAGS
13370a6ad8cSBarry Smith	etags -f TAGS	 src/*/impls/*/*.h src/*/impls/*/*/*.h
134ba6aed2eSLois Curfman McInnes	etags -a -f TAGS src/*/examples/*.c src/*/examples/*/*.c
135531823f5SLois Curfman McInnes	etags -a -f TAGS src/*/*.h src/*/*/*.h src/*/interface/*.c
136bdec0fbfSBarry Smith	etags -a -f TAGS src/*/src/*.c src/*/impls/*/*.c
1370429b4e3SLois Curfman McInnes	etags -a -f TAGS src/*/impls/*/*/*.c
1384c71ded4SBarry Smith	etags -a -f TAGS include/*.h include/*include/*.h bmake/common
13970a6ad8cSBarry Smith	etags -a -f TAGS src/*/impls/*.c src/*/utils/*.c
1400de55854SLois Curfman McInnes	etags -a -f TAGS makefile src/*/src/makefile
1410de55854SLois Curfman McInnes	etags -a -f TAGS src/*/interface/makefile src/makefile
142f5354500SBarry Smith	etags -a -f TAGS src/*/impls/makefile src/*/impls/*/makefile
1433ebb8ef7SBarry Smith	etags -a -f TAGS src/*/utils/makefile src/*/examples/makefile
1440de55854SLois Curfman McInnes	etags -a -f TAGS src/*/examples/*/makefile
1453ebb8ef7SBarry Smith	etags -a -f TAGS src/*/makefile src/*/impls/*/*/makefile
1462bf65771SLois Curfman McInnes	etags -a -f TAGS src/fortran/makefile src/fortran/auto/makefile
1472bf65771SLois Curfman McInnes	etags -a -f TAGS src/fortran/custom/makefile
148fea641f4SSatish Balay	etags -a -f TAGS include/makefile include/*/makefile
1490675aaacSBarry Smith	etags -a -f TAGS bmake/common bmake/sun4/sun4* bmake/rs6000/rs6000*
150deb7fc1cSBarry Smith	etags -a -f TAGS bmake/solaris/solaris*
1510675aaacSBarry Smith	etags -a -f TAGS bmake/IRIX/IRIX* bmake/freebsd/freebsd*
152017faef8SBarry Smith	etags -a -f TAGS bmake/hpux/hpux* bmake/alpha/alpha*
1530675aaacSBarry Smith	etags -a -f TAGS bmake/t3d/t3d* bmake/paragon/paragon*
1544c71ded4SBarry Smith	etags -a -f TAGS src/fortran/custom/*.c src/fortran/auto/*.c
15562ce5da9SLois Curfman McInnes	etags -a -f TAGS src/*/examples/*.F src/fortran/custom/*.F
156*72936c9dSBarry Smith	etags -a -f TAGS docs/tex/manual/routin.tex docs/tex/manual/manual.tex
157*72936c9dSBarry Smith	etags -a -f TAGS docs/tex/manual/manual_tex.tex
158*72936c9dSBarry Smith	etags -a -f TAGS docs/tex/manual/intro.tex docs/tex/manual/part1.tex
159*72936c9dSBarry Smith	etags -a -f TAGS docs/tex/manual/part2.tex
160*72936c9dSBarry Smith	etags -a -f TAGS docs/tex/manual/intro.tex docs/makefile
16128988994SBarry Smith	chmod g+w TAGS
162bfce26a3SBarry Smith
16311b6ed10SLois Curfman McInnes# Builds the etags file that excludes the examples directories
164bfce26a3SBarry Smithetags_noexamples:
165bfce26a3SBarry Smith	$(RM) TAGS_NO_EXAMPLES
166bfce26a3SBarry Smith	etags -f TAGS_NO_EXAMPLES src/*/impls/*/*.h src/*/impls/*/*/*.h
167531823f5SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/*.h src/*/*/*.h src/*/interface/*.c
16864f8aa17SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/src/*.c  src/*/impls/*/*.c
1690429b4e3SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/impls/*/*/*.c
1704c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES include/*.h include/*include/*.h
171b16a3bb1SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/common
172464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/impls/*.c src/*/utils/*.c
1730de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES makefile src/*/src/makefile
1740de55854SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/*/interface/makefile src/makefile
175464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/impls/makefile src/*/impls/*/makefile
176464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/utils/makefile
177464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/*/makefile src/*/impls/*/*/makefile
1782bf65771SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/fortran/makefile src/fortran/auto/makefile
1792bf65771SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/fortran/custom/makefile
180fea641f4SSatish Balay	etags -a -f TAGS_NO_EXAMPLES include/makefile include/*/makefile
181464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/common bmake/sun4/sun4*
182464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/rs6000/rs6000*
183464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/solaris/solaris*
184464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/IRIX/IRIX* bmake/freebsd/freebsd*
185464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/hpux/hpux* bmake/alpha/alpha*
186464493b3SBarry Smith	etags -a -f TAGS_NO_EXAMPLES bmake/t3d/t3d* bmake/paragon/paragon*
1874c71ded4SBarry Smith	etags -a -f TAGS_NO_EXAMPLES src/fortran/auto/*.c
18862ce5da9SLois Curfman McInnes	etags -a -f TAGS_NO_EXAMPLES src/fortran/custom/*.c src/fortran/custom/*.F
189*72936c9dSBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/manual/routin.tex
190*72936c9dSBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/manual/manual.tex
191*72936c9dSBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/manual/intro.tex
192*72936c9dSBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/manual/part1.tex
193*72936c9dSBarry Smith	etags -a -f TAGS_NO_EXAMPLES docs/tex/manual/part2.tex
194fea641f4SSatish Balay	etags -a -f TAGS_NO_EXAMPLES docs/makefile
195bfce26a3SBarry Smith	chmod g+w TAGS_NO_EXAMPLES
196b16a3bb1SBarry Smith
19711b6ed10SLois Curfman McInnes# Builds the etags file for makefiles
198b16a3bb1SBarry Smithetags_makefiles:
199b16a3bb1SBarry Smith	$(RM) TAGS_MAKEFILES
200b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/common
2010de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES makefile src/*/src/makefile
2020de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/interface/makefile src/makefile
203b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES src/*/impls/makefile src/*/impls/*/makefile
2042328c152SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/utils/makefile src/*/interface/makefile
205b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES src/*/makefile src/*/impls/*/*/makefile
2060de55854SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/*/examples/makefile src/*/examples/*/makefile
2072bf65771SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/fortran/makefile src/fortran/auto/makefile
2082bf65771SLois Curfman McInnes	etags -a -f TAGS_MAKEFILES src/fortran/custom/makefile
209fea641f4SSatish Balay	etags -a -f TAGS_MAKEFILES include/makefile include/*/makefile
210b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/common bmake/sun4/sun4*
211b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/rs6000/rs6000*
212b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/solaris/solaris*
213b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/IRIX/IRIX* bmake/freebsd/freebsd*
214b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/hpux/hpux* bmake/alpha/alpha*
215b16a3bb1SBarry Smith	etags -a -f TAGS_MAKEFILES bmake/t3d/t3d* bmake/paragon/paragon*
216fea641f4SSatish Balay	etags -a -f TAGS_MAKEFILES docs/makefile
217b16a3bb1SBarry Smith	chmod g+w TAGS_MAKEFILES
21811b6ed10SLois Curfman McInnes
21911b6ed10SLois Curfman McInnes# ------------------------------------------------------------------
22011b6ed10SLois Curfman McInnes#
22111b6ed10SLois Curfman McInnes# All remaining actions are intended for PETSc developers only.
22211b6ed10SLois Curfman McInnes# PETSc users should not generally need to use these commands.
22311b6ed10SLois Curfman McInnes#
22411b6ed10SLois Curfman McInnes
22511b6ed10SLois Curfman McInnes# Builds all versions of the man pages
22611b6ed10SLois Curfman McInnesallmanpages: deletemanpages deletewwwpages deletelatexpages
22711b6ed10SLois Curfman McInnes	-make ACTION=manpages tree
22811b6ed10SLois Curfman McInnes	-make ACTION=wwwpages tree
22911b6ed10SLois Curfman McInnes	-make ACTION=latexpages tree
23011b6ed10SLois Curfman McInnes	-maint/wwwman
23111b6ed10SLois Curfman McInnes
232416022c9SBarry Smithalllatexpages: deletelatexpages
233416022c9SBarry Smith	-make ACTION=latexpages tree
234416022c9SBarry Smith
23511b6ed10SLois Curfman McInnes# Builds Fortran stub files
23611b6ed10SLois Curfman McInnesallfortranstubs:
23735aab85fSBarry Smith	-@include/finclude/generateincludes
2384b0e389bSBarry Smith	-@$(RM) -f $(PETSC_DIR)/src/fortran/auto/*.c
23911b6ed10SLois Curfman McInnes	-make ACTION=fortranstubs tree
2404b0e389bSBarry Smith	chmod g+w $(PETSC_DIR)/src/fortran/auto/*.c
24111b6ed10SLois Curfman McInnes
24235aab85fSBarry Smith
243