1# $Id: makefile,v 1.191 1997/09/30 15:45:28 balay Exp balay $ 2# 3# This is the makefile for installing PETSc. See the file 4# Installation for directions on installing PETSc. 5# See also bmake/common for additional commands. 6# 7 8CFLAGS = 9SOURCEC = 10SOURCEF = 11DOCS = Changes Machines Readme maint/addlinks \ 12 maint/builddist FAQ Installation BugReporting\ 13 maint/buildlinks maint/wwwman maint/xclude maint/crontab\ 14 bmake/common bmake/*/base* maint/autoftp docs/www/sec/* \ 15 include/finclude/generateincludes bin/petscviewinfo.text \ 16 bin/petscoptsinfo.text 17OBJSC = 18OBJSF = 19LIBBASE = libpetscvec 20DIRS = src include docs 21 22include $(PETSC_DIR)/bmake/$(PETSC_ARCH)/base 23 24# 25# Prints information about the system and PETSc being compiled 26# 27info: 28 -@echo "==========================================" 29 -@echo On `date` on `hostname` 30 -@echo Machine characteristics: `uname -a` 31 -@echo "-----------------------------------------" 32 -@echo "Using C compiler: $(CC) $(COPTFLAGS)" 33 -@if [ "$(CCV)" != "unknown" ] ; then \ 34 echo "Compiler version:" ; \ 35 $(CCV) ; fi 36 -@echo "Using Fortran compiler: $(FC) $(FFLAGS) $(FOPTFLAGS)" 37 -@echo "-----------------------------------------" 38 -@grep PETSC_VERSION_NUMBER include/petsc.h | sed "s/........//" 39 -@echo "-----------------------------------------" 40 -@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)" 41 -@echo "-----------------------------------------" 42 -@echo "Using configuration flags: $(CONF)" 43 -@echo "-----------------------------------------" 44 -@echo "Using include paths: $(PETSC_INCLUDE)" 45 -@echo "-----------------------------------------" 46 -@echo "Using PETSc directory: $(PETSC_DIR)" 47 -@echo "Using PETSc arch: $(PETSC_ARCH)" 48 -@echo "------------------------------------------" 49 -@echo "Using C linker: $(CLINKER)" 50 -@echo "Using libraries: $(PETSC_LIB)" 51 -@echo "Using Fortran linker: $(FLINKER)" 52 -@echo "Using Fortran libraries: $(PETSC_FORTRAN_LIB)" 53 -@echo "==========================================" 54 55# Builds PETSc libraries for a given BOPT and architecture 56all: info chkpetsc_dir 57 -$(RM) -f $(PDIR)/* 58 -@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES" 59 -@echo "=========================================" 60 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \ 61 ACTION=libfast tree 62 -@cd $(PETSC_DIR)/src/sys/src ; \ 63 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) rs6000_time 64 $(RANLIB) $(PDIR)/*.a 65 -@chmod g+w $(PDIR)/*.a 66 -@echo "Completed building libraries" 67 -@echo "=========================================" 68 69# Builds PETSc test examples for a given BOPT and architecture 70testexamples: info chkopts 71 -@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES" 72 -@echo "Due to different numerical round-off on certain" 73 -@echo "machines some of the numbers may not match exactly." 74 -@echo "=========================================" 75 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \ 76 ACTION=testexamples_1 tree 77 -@echo "Completed compiling and running test examples" 78 -@echo "=========================================" 79 80# Builds PETSc test examples for a given BOPT and architecture 81testexamples_uni: info chkopts 82 -@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES" 83 -@echo "Due to different numerical round-off on certain" 84 -@echo "machines some of the numbers may not match exactly." 85 -@echo "=========================================" 86 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \ 87 ACTION=testexamples_4 tree 88 -@echo "Completed compiling and running uniprocessor test examples" 89 -@echo "=========================================" 90 91# 92# Builds PETSc Fortran interface libary 93# Note: libfast cannot run on .F files on certain machines, so we 94# use lib and check for errors here. 95fortran: info chkpetsc_dir 96 -@echo "BEGINNING TO COMPILE FORTRAN INTERFACE LIBRARY" 97 -@echo "=========================================" 98 -$(RM) -f $(PDIR)/libpetscfortran.* 99 -@cd src/fortran/custom; \ 100 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \ 101 grep -v clog trashz | grep -v "information sections" | \ 102 egrep -i '(Error|warning|Can)' >> /dev/null;\ 103 if [ "$$?" != 1 ]; then \ 104 cat trashz ; fi; $(RM) trashz 105 -@cd src/fortran/auto; \ 106 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast 107 $(RANLIB) $(PDIR)/libpetscfortran.a 108 -@chmod g+w $(PDIR)/*.a 109 -@echo "Completed compiling Fortran interface library" 110 -@echo "=========================================" 111 112# 113# Builds PETSc Fortran kernels; some numerical kernels have 114# a Fortran version that may give better performance on certain 115# machines. It always gives better performance for complex numbers. 116fortrankernels: info chkpetsc_dir 117 -$(RM) -f $(PDIR)/libpetsckernels.* 118 -@echo "BEGINNING TO COMPILE FORTRAN KERNELS LIBRARY" 119 -@echo "=========================================" 120 -@cd src/fortran/kernels; \ 121 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib 122 -@chmod g+w $(PDIR)/*.a 123 -@echo "Completed compiling Fortran kernels library" 124 -@echo "=========================================" 125 126# Builds PETSc test examples for a given BOPT and architecture 127testfortran: info chkopts 128 -@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES" 129 -@echo "=========================================" 130 -@echo "Due to different numerical round-off on certain" 131 -@echo "machines or the way Fortran formats numbers" 132 -@echo "some of the results may not match exactly." 133 -@echo "=========================================" 134 -@echo "On some machines you may get messages of the form" 135 -@echo "PetscScalarAddressToFortran:C and Fortran arrays are" 136 -@echo "not commonly aligned or are too far apart to be indexed" 137 -@echo "by an integer. Locations: C xxxc Fortran xxxf" 138 -@echo "Locations/sizeof(Scalar): C yyc Fortran yyf" 139 -@echo "This indicates that you may not be able to use the" 140 -@echo "PETSc routines VecGetArray() and MatGetArray() from Fortran" 141 -@echo "=========================================" 142 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) \ 143 ACTION=testexamples_3 tree 144 -@echo "Completed compiling and running Fortran test examples" 145 -@echo "=========================================" 146# 147# Builds PETSc Fortran90 interface libary 148# Note: libfast cannot run on .F files on certain machines, so we 149# use lib and check for errors here. 150# Note: F90 interface currently only supported in NAG F90 compiler 151fortran90: info chkpetsc_dir fortran 152 -@echo "BEGINNING TO COMPILE FORTRAN90 INTERFACE LIBRARY" 153 -@echo "=========================================" 154 -@cd src/fortran/f90; \ 155 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \ 156 grep -v clog trashz | grep -v "information sections" | \ 157 egrep -i '(Error|warning|Can)' >> /dev/null;\ 158 if [ "$$?" != 1 ]; then \ 159 cat trashz ; fi; $(RM) trashz 160 $(RANLIB) $(PDIR)/libpetscfortran.a 161 -@chmod g+w $(PDIR)/*.a 162 -@echo "Completed compiling Fortran90 interface library" 163 -@echo "=========================================" 164 165# Builds noise routines (not yet publically available) 166# Note: libfast cannot run on .F files on certain machines, so we 167# use lib and check for errors here. 168noise: info chkpetsc_dir 169 -@echo "Beginning to compile noise routines" 170 -@echo "=========================================" 171 -@cd src/snes/interface/noise; \ 172 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib > trashz 2>&1; \ 173 grep -v clog trashz | grep -v "information sections" | \ 174 egrep -i '(Error|warning|Can)' >> /dev/null;\ 175 if [ "$$?" != 1 ]; then \ 176 cat trashz ; fi; $(RM) trashz 177 $(RANLIB) $(PDIR)/libpetscsnes.a 178 -@chmod g+w $(PDIR)/libpetscsnes.a 179 -@echo "Completed compiling noise routines" 180 -@echo "=========================================" 181 182petscblas: info chkpetsc_dir 183 -$(RM) -f $(PDIR)/libpetscblas.* 184 -@echo "BEGINNING TO COMPILE C VERSION OF BLAS AND LAPACK" 185 -@echo "=========================================" 186 -@cd src/adic/blas; \ 187 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) libfast 188 -@cd src/adic/lapack; \ 189 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=libfast tree 190 $(RANLIB) $(PDIR)/libpetscblas.a 191 -@chmod g+w $(PDIR)/*.a 192 -@echo "Completed compiling C version of BLAS and LAPACK" 193 -@echo "=========================================" 194 195 196ranlib: 197 $(RANLIB) $(PDIR)/*.a 198 199# Deletes PETSc libraries 200deletelibs: 201 -$(RM) -f $(PDIR)/*.a $(PDIR)/complex/* $(PDIR)/c++/* 202 203# Deletes man pages (HTML version) 204deletewwwpages: 205 $(RM) -f $(PETSC_DIR)/docs/www/man*/* $(PETSC_DIR)/docs/www/www.cit \ 206 $(PETSC_DIR)/docs/www/man*.html 207 208# Deletes man pages (LaTeX version) 209deletelatexpages: 210 $(RM) -f $(PETSC_DIR)/docs/tex/rsum/*sum*.tex 211 212# To access the tags in emacs, type M-x visit-tags-table and specify 213# the file petsc/TAGS. Then, to move to where a PETSc function is 214# defined, enter M-. and the function name. To search for a string 215# and move to the first occurrence, use M-x tags-search and the string. 216# To locate later occurrences, use M-, 217 218TAGS_INCLUDE_FILES = include/*.h include/pinclude/*.h include/FINCLUDE/*.h 219TAGS_BMAKE_FILES = bmake/common bmake/*/base* 220TAGS_EXAMPLE_FILES = src/*/examples/*/*.[c,h,F,f] src/*/examples/*/*/*.[c,h,F,f] \ 221 src/benchmarks/*.c src/contrib/*/examples/*/*.[c,h,F,f] 222TAGS_DOC_FILES = docs/tex/manual/routin.tex docs/tex/manual/manual.tex \ 223 docs/tex/manual/manual_tex.tex docs/tex/manual/intro.tex \ 224 docs/tex/manual/part1.tex docs/tex/manual/part2.tex 225TAGS_SRC_FILES = src/*/*.[c,h] src/*/interface/*.[c,h] src/*/src/*.[c,h] \ 226 src/*/utils/*.[c,h] \ 227 src/*/impls/*.[c,h] src/*/impls/*/*.[c,h] src/*/impls/*/*/*.[c,h] \ 228 src/gvec/impls/*/*/*/*/*.[c,h] src/contrib/*/*.[c,h] \ 229 src/contrib/*/src/*.[c,h] src/fortran/custom/*.[c,h,F] 230TAGS_MAKEFILE_FILES = include/makefile include/*/makefile \ 231 makefile \ 232 src/makefile src/*/makefile src/*/src/makefile \ 233 src/*/interface/makefile \ 234 src/*/utils/makefile \ 235 src/*/impls/makefile src/*/impls/*/makefile src/*/impls/*/*/makefile \ 236 src/*/examples/makefile src/*/examples/*/makefile src/*/examples/*/*/makefile \ 237 src/gvec/impls/*/*/*/*/makefile src/gvec/impls/*/*/*/makefile \ 238 src/fortran/*/makefile \ 239 src/contrib/*/makefile src/contrib/*/src/makefile \ 240 src/contrib/*/examples/makefile src/contrib/*/examples/*/makefile \ 241 docs/makefile 242 243# Builds all etags files 244alletags: 245 -make etags_complete 246 -make etags 247 -make etags_noexamples 248 -make etags_makefiles 249 250# Builds the basic etags file. This should be employed by most users. 251etags: 252 $(RM) TAGS 253 etags -f TAGS $(TAGS_INCLUDE_FILES) 254 etags -a -f TAGS $(TAGS_SRC_FILES) 255 etags -a -f TAGS $(TAGS_EXAMPLE_FILES) 256 etags -a -f TAGS $(TAGS_MAKEFILE_FILES) 257 etags -a -f TAGS $(TAGS_BMAKE_FILES) 258 chmod g+w TAGS 259 260# Builds complete etags list; only for PETSc developers. 261etags_complete: 262 $(RM) TAGS_COMPLETE 263 etags -f TAGS_COMPLETE $(TAGS_SRC_FILES) 264 etags -a -f TAGS_COMPLETE $(TAGS_INCLUDE_FILES) 265 etags -a -f TAGS_COMPLETE $(TAGS_EXAMPLE_FILES) 266 etags -a -f TAGS_COMPLETE $(TAGS_MAKEFILE_FILES) 267 etags -a -f TAGS_COMPLETE $(TAGS_BMAKE_FILES) 268 etags -a -f TAGS_COMPLETE $(TAGS_DOC_FILES) 269 chmod g+w TAGS_COMPLETE 270 271# Builds the etags file that excludes the examples directories 272etags_noexamples: 273 $(RM) TAGS_NO_EXAMPLES 274 etags -f TAGS_NO_EXAMPLES $(TAGS_SRC_FILES) 275 etags -a -f TAGS_NO_EXAMPLES $(TAGS_INCLUDE_FILES) 276 etags -a -f TAGS_NO_EXAMPLES $(TAGS_MAKEFILE_FILES) 277 etags -a -f TAGS_NO_EXAMPLES $(TAGS_BMAKE_FILES) 278 etags -a -f TAGS_NO_EXAMPLES $(TAGS_DOC_FILES) 279 chmod g+w TAGS_NO_EXAMPLES 280 281# Builds the etags file for makefiles 282etags_makefiles: 283 $(RM) TAGS_MAKEFILES 284 etags -f TAGS_MAKEFILES $(TAGS_MAKEFILE_FILES) 285 etags -a -f TAGS_MAKEFILES $(TAGS_BMAKE_FILES) 286 chmod g+w TAGS_MAKEFILES 287 288# Builds the etags file for examples 289etags_examples: 290 $(RM) TAGS_EXAMPLES 291 etags -f TAGS_EXAMPLES $(TAGS_EXAMPLE_FILES) 292 chmod g+w TAGS_EXAMPLES 293 294# 295# ctags builds the tags file required for VI. 296# To use the tags file do the following: 297# 1. within vi invole the command - :set tags=/home/bsmith/petsc/tags 298# or add the command to your ~/.exrc file - set tags=/home/bsmith/petsc/tags 299# 2. now to go to a tag do - :tag TAGNAME for eg - :tag MatCreate 300# 301ctags: 302 $(RM) tags 303 ctags -w -f tags $(TAGS_INCLUDE_FILES) 304 ctags -w -a -f tags $(TAGS_SRC_FILES) 305 ctags -w -a -f tags $(TAGS_EXAMPLE_FILES) 306 ctags -w -a -f tags $(TAGS_MAKEFILE_FILES) 307 ctags -w -a -f tags $(TAGS_BMAKE_FILES) 308 chmod g+w tags 309 310# ------------------------------------------------------------------ 311# 312# All remaining actions are intended for PETSc developers only. 313# PETSc users should not generally need to use these commands. 314# 315 316# Builds all versions of the man pages 317allmanpages: allwwwpages alllatexpages 318allwwwpages: deletewwwpages 319 -make ACTION=wwwpages_buildcite tree 320 -cd src/fortran/custom; make wwwpages_buildcite 321 -cd src/fortran/custom; make wwwpages 322 -make ACTION=wwwpages tree 323 -maint/wwwman 324 -maint/examplesindex.tcl -www 325 -maint/htmlkeywords.tcl 326 -@chmod g+w docs/www/man*/* 327 328#This is similar to allwwwpages except -www -> -wwwhome 329#The wwwmanpages built this way can pe placed at PETSc Home Page 330allwwwhomepages: deletewwwpages 331 -make ACTION=wwwpages_buildcite tree 332 -cd src/fortran/custom; make wwwpages_buildcite 333 -cd src/fortran/custom; make wwwpages 334 -make ACTION=wwwpages tree 335 -maint/wwwman 336 -maint/examplesindex.tcl -wwwhome 337 -maint/htmlkeywords.tcl -wwwhome 338 -@chmod g+w docs/www/man*/* 339 340alllatexpages: deletelatexpages 341 -make ACTION=latexpages tree 342 -cd src/fortran/custom; make latexpages 343 -@chmod g+w docs/tex/rsum/* 344 345# Builds Fortran stub files 346allfortranstubs: 347 -@include/finclude/generateincludes 348 -@$(RM) -f src/fortran/auto/*.c 349 -make ACTION=fortranstubs tree 350 chmod g+w src/fortran/auto/*.c 351 352allci: 353 -@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) ci 354 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=ci tree 355 356allco: 357 -@cd src/fortran/custom ; $(OMAKE) BOPT=$(BOPT) co 358 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=co tree 359 360# 361# The commands below are for generating ADIC versions of the code; 362# they are not currently used. 363# 364CFLAGS = $(CPPFLAGS) $(CONF) 365alladicignore: 366 -@$(RM) $(PDIR)/adicignore 367 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adicignore tree 368 369alladic: 370 -@echo "Beginning to compile ADIC source code in all directories" 371 -@echo "Using ADIC compiler: $(ADIC_CC) $(CFLAGS)" 372 -@echo "=========================================" 373 -@cd include ; \ 374 $(ADIC_CC) -s -f 1 $(CFLAGS) petsc.h 375 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adic tree 376 -@cd src/inline ; \ 377 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic 378 -@cd src/adic/blas ; \ 379 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adic 380 -@cd src/adic/lapack ; \ 381 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adic tree 382 383alladiclib: 384 -@echo "Beginning to compile ADIC libraries in all directories" 385 -@echo "Using compiler: $(CC) $(COPTFLAGS)" 386 -@echo "-----------------------------------------" 387 -@echo "Using PETSc flags: $(PETSCFLAGS) $(PCONF)" 388 -@echo "-----------------------------------------" 389 -@echo "Using configuration flags: $(CONF)" 390 -@echo "-----------------------------------------" 391 -@echo "Using include paths: $(PETSC_INCLUDE)" 392 -@echo "-----------------------------------------" 393 -@echo "Using PETSc directory: $(PETSC_DIR)" 394 -@echo "Using PETSc arch: $(PETSC_ARCH)" 395 -@echo "=========================================" 396 -@$(RM) -f $(PDIR)/*adic.a 397 -@$(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adiclib tree 398 -@cd src/adic/blas ; \ 399 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) adiclib 400 -@cd src/adic/lapack ; \ 401 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) ACTION=adiclib tree 402 -@cd src/adic/src ; \ 403 $(OMAKE) BOPT=$(BOPT) PETSC_ARCH=$(PETSC_ARCH) lib 404 405# ------------------------------------------------------------------------------- 406# 407# Some macros to check if the fortran interface is up-to-date. 408# 409countfortranfunctions: 410 -@cd $(PETSC_DIR)/src/fortran; egrep '^void' custom/*.c auto/*.c | \ 411 cut -d'(' -f1 | tr -s '' ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \ 412 sed "s/_$$//" | sort > /tmp/countfortranfunctions 413 414countcfunctions: 415 -@ grep extern $(PETSC_DIR)/include/*.h *.h | grep "(" | tr -s '' ' ' | \ 416 cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '' '\012' | \ 417 tr 'A-Z' 'a-z' | sort > /tmp/countcfunctions 418 419difffortranfunctions: countfortranfunctions countcfunctions 420 -@echo -------------- Functions missing in the fortran interface --------------------- 421 -@diff /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 422 -@echo ----------------- Functions missing in the C interface ------------------------ 423 -@diff /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 424 -@$(RM) /tmp/countcfunctions /tmp/countfortranfunctions 425 426checkbadfortranstubs: 427 -@echo "=========================================" 428 -@echo "Functions with MPI_Comm as an Argument" 429 -@echo "=========================================" 430 -@cd $(PETSC_DIR)/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \ 431 tr -s '' ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 432 -@echo "=========================================" 433 -@echo "Functions with a String as an Argument" 434 -@echo "=========================================" 435 -@cd $(PETSC_DIR)/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \ 436 tr -s '' ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 437 -@echo "=========================================" 438 -@echo "Functions with Pointers to PETSc Objects as Argument" 439 -@echo "=========================================" 440 -@cd $(PETSC_DIR)/src/fortran/auto; \ 441 _p_OBJ=`grep _p_ $(PETSC_DIR)/include/*.h | tr -s '' ' ' | \ 442 cut -d' ' -f 3 | tr -s '' '\012' | grep -v '{' | cut -d'*' -f1 | \ 443 sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ 444 for OBJ in $$_p_OBJ; do \ 445 grep "$$OBJ \*" *.c | tr -s '' ' ' | tr -s ':' ' ' | \ 446 cut -d'(' -f1 | cut -d' ' -f1,3; \ 447 done 448