1# 2# This is the makefile for installing PETSc. See the file 3# Installation for directions on installing PETSc. 4# See also bmake/common for additional commands. 5# 6 7#PETSC_DIR = . 8 9CFLAGS = 10SOURCEC = 11SOURCEF = 12DOCS = Changes Machines Readme maint/addlinks \ 13 maint/builddist FAQ Installation BugReporting\ 14 maint/buildlinks maint/wwwman maint/xclude maint/crontab\ 15 bmake/common bmake/*/base* maint/autoftp docs/www/sec/* \ 16 include/finclude/generateincludes bin/petscviewinfo.text \ 17 bin/petscoptsinfo.text 18OBJSC = 19OBJSF = 20LIBBASE = libpetscvec 21DIRS = src include docs 22 23include $(PETSC_DIR)/bmake/$(PETSC_ARCH)/base 24 25# Builds PETSc libraries for a given BOPT and architecture 26all: chkpetsc_dir 27 -$(RM) -f $(PDIR)/* 28 -@echo "Beginning to compile libraries in all directories" 29 -@echo "Using compiler: $(CC) $(COPTFLAGS)" 30 -@echo "-----------------------------------------" 31 -@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)" 32 -@echo "-----------------------------------------" 33 -@echo "Using configuration flags: $(CONF)" 34 -@echo "-----------------------------------------" 35 -@echo "Using include paths: $(PETSC_INCLUDE)" 36 -@echo "-----------------------------------------" 37 -@echo "Using PETSc directory: $(PETSC_DIR)" 38 -@echo "Using PETSc arch: $(PETSC_ARCH)" 39 -@echo "=========================================" 40 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \ 41 ACTION=libfast tree 42 -@cd $(PETSC_DIR)/src/sys/src ; \ 43 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) rs6000_time 44 $(RANLIB) $(PDIR)/*.a 45 -@chmod g+w $(PDIR)/*.a 46 -@echo "Completed building libraries" 47 -@echo "=========================================" 48 49# Builds PETSc test examples for a given BOPT and architecture 50testexamples: chkopts 51 -@echo "Beginning to compile and run test examples" 52 -@echo "Using compiler: $(CC) $(COPTFLAGS)" 53 -@echo "-----------------------------------------" 54 -@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)" 55 -@echo "-----------------------------------------" 56 -@echo "Using include paths: $(PETSC_INCLUDE)" 57 -@echo "-----------------------------------------" 58 -@echo "Using PETSc directory: $(PETSC_DIR)" 59 -@echo "Using PETSc arch: $(PETSC_ARCH)" 60 -@echo "------------------------------------------" 61 -@echo "Using linker: $(CLINKER)" 62 -@echo "Using libraries: $(PETSC_LIB)" 63 -@echo "------------------------------------------" 64 -@echo "Due to different numerical round-off on certain" 65 -@echo "machines some of the numbers may not match exactly." 66 -@echo "=========================================" 67 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \ 68 ACTION=testexamples_1 tree 69 -@echo "Completed compiling and running test examples" 70 -@echo "=========================================" 71 72# Builds PETSc test examples for a given BOPT and architecture 73testexamples_uni: chkopts 74 -@echo "Beginning to compile and run uniprocessor test examples" 75 -@echo "Using compiler: $(CC) $(COPTFLAGS)" 76 -@echo "Using linker: $(CLINKER)" 77 -@echo "------------------------------------------" 78 -@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)" 79 -@echo "------------------------------------------" 80 -@echo "Using include paths: $(PETSC_INCLUDE)" 81 -@echo "------------------------------------------" 82 -@echo "Using PETSc directory: $(PETSC_DIR)" 83 -@echo "Using PETSc arch: $(PETSC_ARCH)" 84 -@echo "------------------------------------------" 85 -@echo "Using linker: $(CLINKER)" 86 -@echo "Using libraries: $(PETSC_LIB)" 87 -@echo "------------------------------------------" 88 -@echo "Due to different numerical round-off on certain" 89 -@echo "machines some of the numbers may not match exactly." 90 -@echo "=========================================" 91 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \ 92 ACTION=testexamples_4 tree 93 -@echo "Completed compiling and running uniprocessor test examples" 94 -@echo "=========================================" 95 96# 97# Builds PETSc Fortran interface libary 98# Note: libfast cannot run on .F files on certain machines, so we 99# use lib and check for errors here. 100fortran: chkpetsc_dir 101 -$(RM) -f $(PDIR)/libpetscfortran.* 102 -@echo "Beginning to compile Fortran interface library" 103 -@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)" 104 -@echo "Using C/C++ compiler: $(CC) $(COPTFLAGS)" 105 -@echo "------------------------------------------" 106 -@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)" 107 -@echo "------------------------------------------" 108 -@echo "Using configuration flags: $(CONF)" 109 -@echo "------------------------------------------" 110 -@echo "Using include paths: $(PETSC_INCLUDE)" 111 -@echo "------------------------------------------" 112 -@echo "Using PETSc directory: $(PETSC_DIR)" 113 -@echo "Using PETSc arch: $(PETSC_ARCH)" 114 -@echo "=========================================" 115 -@cd src/fortran/custom; \ 116 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \ 117 grep -v clog trashz | grep -v "information sections" | \ 118 egrep -i '(Error|warning|Can)' >> /dev/null;\ 119 if [ "$$?" != 1 ]; then \ 120 cat trashz ; fi; $(RM) trashz 121 -@cd src/fortran/auto; \ 122 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast 123 $(RANLIB) $(PDIR)/libpetscfortran.a 124 -@chmod g+w $(PDIR)/*.a 125 -@echo "Completed compiling Fortran interface library" 126 -@echo "=========================================" 127 128# Builds PETSc test examples for a given BOPT and architecture 129testfortran: chkopts 130 -@echo "Beginning to compile and run Fortran test examples" 131 -@echo "Using compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)" 132 -@echo "Using linker: $(FLINKER)" 133 -@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)" 134 -@echo "------------------------------------------" 135 -@echo "Using PETSc directory: $(PETSC_DIR)" 136 -@echo "Using PETSc arch: $(PETSC_ARCH)" 137 -@echo "------------------------------------------" 138 -@echo "Using linker: $(FLINKER)" 139 -@echo "Using libraries: $(PETSC_FORTRAN_LIB) $(PETSC_LIB)" 140 -@echo "=========================================" 141 -@echo "Due to different numerical round-off on certain" 142 -@echo "machines or the way Fortran formats numbers" 143 -@echo "some of the results may not match exactly." 144 -@echo "=========================================" 145 -@echo "On some machines you may get messages of the form" 146 -@echo "PetscScalarAddressToFortran:C and Fortran arrays are" 147 -@echo "not commonly aligned or are too far apart to be indexed" 148 -@echo "by an integer. Locations: C xxxc Fortran xxxf" 149 -@echo "Locations/sizeof(Scalar): C yyc Fortran yyf" 150 -@echo "This indicates that you may not be able to use the" 151 -@echo "PETSc routines VecGetArray() and MatGetArray() from Fortran" 152 -@echo "=========================================" 153 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \ 154 ACTION=testexamples_3 tree 155 -@echo "Completed compiling and running Fortran test examples" 156 -@echo "=========================================" 157 158ranlib: 159 $(RANLIB) $(PDIR)/*.a 160 161# Deletes PETSc libraries 162deletelibs: 163 -$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/* 164 165 166# Deletes man pages (HTML version) 167deletewwwpages: 168 $(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit \ 169 $(PETSC_DIR)/docs/www/man*.html 170 171# Deletes man pages (LaTeX version) 172deletelatexpages: 173 $(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex 174 175# To access the tags in emacs, type M-x visit-tags-table and specify 176# the file petsc/TAGS. Then, to move to where a PETSc function is 177# defined, enter M-. and the function name. To search for a string 178# and move to the first occurrence, use M-x tags-search and the string. 179# To locate later occurrences, use M-, 180 181TAGS_INCLUDE_FILES = include/*.h include/pinclude/*.h include/FINCLUDE/*.h 182TAGS_BMAKE_FILES = bmake/common bmake/*/base* 183TAGS_EXAMPLE_FILES = src/*/examples/*/*.[c,h,F,f] src/*/examples/*/*/*.[c,h,F,f] \ 184 src/benchmarks/*.c src/contrib/*/examples/*/*.[c,h,F,f] 185TAGS_DOC_FILES = docs/tex/manual/routin.tex docs/tex/manual/manual.tex \ 186 docs/tex/manual/manual_tex.tex docs/tex/manual/intro.tex \ 187 docs/tex/manual/part1.tex docs/tex/manual/part2.tex 188TAGS_SRC_FILES = src/*/*.[c,h] src/*/interface/*.[c,h] src/*/src/*.[c,h] \ 189 src/*/utils/*.[c,h] \ 190 src/*/impls/*.[c,h] src/*/impls/*/*.[c,h] src/*/impls/*/*/*.[c,h] \ 191 src/gvec/impls/*/*/*/*/*.[c,h] src/contrib/*/*.[c,h] src/contrib/*/src/*.[c,h] \ 192 src/fortran/custom/*.[c,h,F] 193TAGS_MAKEFILE_FILES = include/makefile include/*/makefile \ 194 makefile \ 195 src/makefile src/*/makefile src/*/src/makefile \ 196 src/*/interface/makefile \ 197 src/*/utils/makefile \ 198 src/*/impls/makefile src/*/impls/*/makefile src/*/impls/*/*/makefile \ 199 src/*/examples/makefile src/*/examples/*/makefile src/*/examples/*/*/makefile \ 200 src/gvec/impls/*/*/*/*/makefile src/gvec/impls/*/*/*/makefile \ 201 src/fortran/*/makefile \ 202 src/contrib/*/makefile src/contrib/*/src/makefile \ 203 src/contrib/*/examples/makefile src/contrib/*/examples/*/makefile \ 204 docs/makefile 205 206# Builds all etags files 207alletags: 208 -make etags_complete 209 -make etags 210 -make etags_noexamples 211 -make etags_makefiles 212 213# Builds the basic etags file. This should be employed by most users. 214etags: 215 $(RM) TAGS 216 etags -f TAGS $(TAGS_INCLUDE_FILES) 217 etags -a -f TAGS $(TAGS_SRC_FILES) 218 etags -a -f TAGS $(TAGS_EXAMPLE_FILES) 219 etags -a -f TAGS $(TAGS_MAKEFILE_FILES) 220 etags -a -f TAGS $(TAGS_BMAKE_FILES) 221 chmod g+w TAGS 222 223# Builds complete etags list; only for PETSc developers. 224etags_complete: 225 $(RM) TAGS_COMPLETE 226 etags -f TAGS_COMPLETE $(TAGS_SRC_FILES) 227 etags -a -f TAGS_COMPLETE $(TAGS_INCLUDE_FILES) 228 etags -a -f TAGS_COMPLETE $(TAGS_EXAMPLE_FILES) 229 etags -a -f TAGS_COMPLETE $(TAGS_MAKEFILE_FILES) 230 etags -a -f TAGS_COMPLETE $(TAGS_BMAKE_FILES) 231 etags -a -f TAGS_COMPLETE $(TAGS_DOC_FILES) 232 chmod g+w TAGS_COMPLETE 233 234# Builds the etags file that excludes the examples directories 235etags_noexamples: 236 $(RM) TAGS_NO_EXAMPLES 237 etags -f TAGS_NO_EXAMPLES $(TAGS_SRC_FILES) 238 etags -a -f TAGS_NO_EXAMPLES $(TAGS_INCLUDE_FILES) 239 etags -a -f TAGS_NO_EXAMPLES $(TAGS_MAKEFILE_FILES) 240 etags -a -f TAGS_NO_EXAMPLES $(TAGS_BMAKE_FILES) 241 etags -a -f TAGS_NO_EXAMPLES $(TAGS_DOC_FILES) 242 chmod g+w TAGS_NO_EXAMPLES 243 244# Builds the etags file for makefiles 245etags_makefiles: 246 $(RM) TAGS_MAKEFILES 247 etags -f TAGS_MAKEFILES $(TAGS_MAKEFILE_FILES) 248 etags -a -f TAGS_MAKEFILES $(TAGS_BMAKE_FILES) 249 chmod g+w TAGS_MAKEFILES 250 251# 252# ctags builds the tags file required for VI. 253# To use the tags file do the following: 254# 1. within vi invole the command - :set tags=/home/bsmith/petsc/tags 255# or add the command to your ~/.exrc file - set tags=/home/bsmith/petsc/tags 256# 2. now to go to a tag do - :tag TAGNAME for eg - :tag MatCreate 257# 258ctags: 259 $(RM) tags 260 ctags -w -f tags $(TAGS_INCLUDE_FILES) 261 ctags -w -a -f tags $(TAGS_SRC_FILES) 262 ctags -w -a -f tags $(TAGS_EXAMPLE_FILES) 263 ctags -w -a -f tags $(TAGS_MAKEFILE_FILES) 264 ctags -w -a -f tags $(TAGS_BMAKE_FILES) 265 chmod g+w tags 266 267# ------------------------------------------------------------------ 268# 269# All remaining actions are intended for PETSc developers only. 270# PETSc users should not generally need to use these commands. 271# 272 273# Builds all versions of the man pages 274allmanpages: allwwwpages alllatexpages 275allwwwpages: deletewwwpages 276 -make ACTION=wwwpages_buildcite tree 277 -cd src/fortran/custom; make wwwpages_buildcite 278 -cd src/fortran/custom; make wwwpages 279 -make ACTION=wwwpages tree 280 -maint/wwwman 281 -maint/examplesindex.tcl -www 282 -maint/htmlkeywords.tcl 283 -@chmod g+w docs/www/man*/* 284alllatexpages: deletelatexpages 285 -make ACTION=latexpages tree 286 -cd src/fortran/custom; make latexpages 287 -@chmod g+w docs/tex/rsum/* 288 289# Builds Fortran stub files 290allfortranstubs: 291 -@include/finclude/generateincludes 292 -@$(RM) -f $(PETSC_DIR)/src/fortran/auto/*.c 293 -make ACTION=fortranstubs tree 294 chmod g+w $(PETSC_DIR)/src/fortran/auto/*.c 295 296allci: 297 -@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) ci 298 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=ci tree 299 300allco: 301 -@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) co 302 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=co tree 303 304alladicignore: 305 -@$(RM) $(PDIR)/adicignore 306 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adicignore tree 307 308CFLAGS = $(CPPFLAGS) $(CONF) 309 310alladic: 311 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adic tree 312 -@cd include ; \ 313 $(ADIC_CC) -s -f 1 $(CFLAGS) petsc.h 314 -@cd src/inline ; \ 315 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic 316 317alladiclib: 318 -@$(RM) -f $(PDIR)/*adic.a 319 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adiclib tree 320 321# 322# We no longer make Unix manpages 323# 324#allunixmanpages: 325# -make ACTION=manpages tree 326# -cd src/fortran/custom; make manpages 327# -cd docs/man; catman -W . 328# -@chmod g+w docs/man/man*/* 329# Deletes man pages (xman version) 330#deletemanpages: 331# $(RM) -f $(PETSC_DIR)/Keywords $(PETSC_DIR)/docs/man/man*/* 332 333