1# $Id: makefile,v 1.263 1999/02/02 20:31:24 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# 7ALL: all 8 9DIRS = src include docs 10 11include ${PETSC_DIR}/bmake/${PETSC_ARCH}/base 12 13# 14# Basic targets to build PETSc libraries. 15# all : builds the c, fortran,f90 libraries 16# fortran : builds the fortran libary 17# f90 : builds the fortran and the f90 libraries. 18# 19all : info chkpetsc_dir deletelibs build_c build_fortrankernels \ 20 build_fortran shared 21fortran : info chkpetsc_dir build_fortran 22fortran90 : fortran build_fortran90 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} ${CCPPFLAGS}" 33 -@if [ -n "${CCV}" -a "${CCV}" != "unknown" ] ; then \ 34 echo "Compiler version:" `${CCV}` ; fi 35 -@echo "Using Fortran compiler: ${FC} ${FOPTFLAGS} ${FCPPFLAGS}" 36 -@echo "-----------------------------------------" 37 -@grep PETSC_VERSION_NUMBER include/petsc.h | sed "s/........//" 38 -@echo "-----------------------------------------" 39 -@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" 40 -@echo "-----------------------------------------" 41 -@echo "Using configuration flags:" 42 -@grep "define " bmake/${PETSC_ARCH}/petscconf.h 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 Fortran linker: ${FLINKER}" 51 -@echo "Using libraries: ${PETSC_LIB}" 52 -@echo "==========================================" 53 54# 55# Build the PETSc libraries 56# This target also builds fortran interface files, and f90 57# interface files. (except compiling *.F files) 58# 59build_c: 60 -@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES" 61 -@echo "=========================================" 62 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=libfast tree 63 -@cd ${PETSC_DIR}/src/sys/src/time ; \ 64 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} rs6000_time 65 ${RANLIB} ${PDIR}/*.a 66 -@chmod g+w ${PDIR}/*.a 67 -@echo "Completed building libraries" 68 -@echo "=========================================" 69 70# 71# Builds PETSc Fortran interface libary 72# Note: libfast cannot run on .F files on certain machines, so we 73# use lib and check for errors here. 74 75build_fortran: 76 -@echo "BEGINNING TO COMPILE FORTRAN INTERFACE LIBRARY" 77 -@echo "=========================================" 78 -@cd src/fortran/custom; \ 79 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} libf > trashz 2>&1; \ 80 grep -v clog trashz | grep -v "information sections" | \ 81 egrep -i '(Error|warning|Can)' >> /dev/null;\ 82 if [ "$$?" != 1 ]; then \ 83 cat trashz ; fi; ${RM} trashz 84 ${RANLIB} ${PDIR}/libpetscfortran.a 85 -@chmod g+w ${PDIR}/*.a 86 -@echo "Completed compiling Fortran interface library" 87 -@echo "=========================================" 88 89# 90# Builds PETSc Fortran kernels; some numerical kernels have 91# a Fortran version that may give better performance on certain 92# machines. These always provide better performance for complex numbers. 93# 94build_fortrankernels: chkpetsc_dir 95 -@echo "BEGINNING TO COMPILE FORTRAN KERNELS LIBRARY" 96 -@echo "=========================================" 97 -@cd src/fortran/kernels; \ 98 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} libf 99 -@chmod g+w ${PDIR}/*.a 100 -@echo "Completed compiling Fortran kernels library" 101 -@echo "=========================================" 102 103petscblas: info chkpetsc_dir 104 -${RM} -f ${PDIR}/libpetscblas.* 105 -@echo "BEGINNING TO COMPILE C VERSION OF BLAS AND LAPACK" 106 -@echo "=========================================" 107 -@cd src/blaslapack; \ 108 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=libfast tree 109 ${RANLIB} ${PDIR}/libpetscblas.a 110 -@chmod g+w ${PDIR}/*.a 111 -@echo "Completed compiling C version of BLAS and LAPACK" 112 -@echo "=========================================" 113 114 115# Builds PETSc test examples for a given BOPT and architecture 116testexamples: info chkopts 117 -@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES" 118 -@echo "Due to different numerical round-off on certain" 119 -@echo "machines some of the numbers may not match exactly." 120 -@echo "=========================================" 121 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} \ 122 ACTION=testexamples_1 tree 123 -@echo "Completed compiling and running test examples" 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 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} \ 135 ACTION=testexamples_3 tree 136 -@echo "Completed compiling and running Fortran test examples" 137 -@echo "=========================================" 138 139# Builds PETSc test examples for a given BOPT and architecture 140testexamples_uni: info chkopts 141 -@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES" 142 -@echo "Due to different numerical round-off on certain" 143 -@echo "machines some of the numbers may not match exactly." 144 -@echo "=========================================" 145 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} \ 146 ACTION=testexamples_4 tree 147 -@echo "Completed compiling and running uniprocessor test examples" 148 -@echo "=========================================" 149testfortran_uni: info chkopts 150 -@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES" 151 -@echo "Due to different numerical round-off on certain" 152 -@echo "machines some of the numbers may not match exactly." 153 -@echo "=========================================" 154 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} \ 155 ACTION=testexamples_9 tree 156 -@echo "Completed compiling and running uniprocessor fortran test examples" 157 -@echo "=========================================" 158 159# Ranlib on the libraries 160ranlib: 161 ${RANLIB} ${PDIR}/*.a 162 163# Deletes PETSc libraries 164deletelibs: chkopts_basic 165 -${RM} -f ${PDIR}/* 166 167 168# ------------------------------------------------------------------ 169# 170# All remaining actions are intended for PETSc developers only. 171# PETSc users should not generally need to use these commands. 172# 173 174# To access the tags in EMACS, type M-x visit-tags-table and specify 175# the file petsc/TAGS. 176# 1) To move to where a PETSc function is defined, enter M-. and the 177# function name. 178# 2) To search for a string and move to the first occurrence, 179# use M-x tags-search and the string. 180# To locate later occurrences, use M-, 181# Builds all etags files 182alletags: 183 -${OMAKE} etags_complete 184 -${OMAKE} etags_noexamples 185 -${OMAKE} etags_examples 186 -${OMAKE} etags_makefiles 187# Builds the basic etags file. This should be employed by most users. 188etags: 189 -${RM} ${PETSC_DIR}/TAGS 190 -touch ${PETSC_DIR}/TAGS 191 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_sourcec alltree 192 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_sourceh alltree 193 -cd src/fortran; make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_sourcef alltree 194 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_examplesc alltree 195 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_examplesf alltree 196 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_examplesch alltree 197 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_examplesfh alltree 198 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_makefile alltree 199 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS etags_bmakefiles 200 -chmod g+w TAGS 201# Builds complete etags list; only for PETSc developers. 202etags_complete: 203 -${RM} ${PETSC_DIR}/TAGS_COMPLETE 204 -touch ${PETSC_DIR}/TAGS_COMPLETE 205 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_sourcec alltree 206 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_sourceh alltree 207 -cd src/fortran; make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_sourcef alltree 208 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_examplesc alltree 209 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_examplesf alltree 210 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_examplesch alltree 211 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_examplesfh alltree 212 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_makefile alltree 213 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE etags_bmakefiles 214 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_docs alltree 215 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_scripts alltree 216 -chmod g+w TAGS_COMPLETE 217# Builds the etags file that excludes the examples directories 218etags_noexamples: 219 -${RM} ${PETSC_DIR}/TAGS_NO_EXAMPLES 220 -touch ${PETSC_DIR}/TAGS_NO_EXAMPLES 221 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcec alltree 222 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES ACTION=etags_sourceh alltree 223 -cd src/fortran; make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcef alltree 224 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES ACTION=etags_makefile alltree 225 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES etags_bmakefiles 226 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES ACTION=etags_docs alltree 227 -chmod g+w TAGS_NO_EXAMPLES 228# Builds the etags file for makefiles 229etags_makefiles: 230 -${RM} ${PETSC_DIR}/TAGS_MAKEFILE 231 -touch ${PETSC_DIR}/TAGS_MAKEFILE 232 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_MAKEFILE ACTION=etags_makefile alltree 233 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_MAKEFILE etags_bmakefiles 234 -chmod g+w TAGS_MAKEFILE 235# Builds the etags file for examples 236etags_examples: 237 -${RM} ${PETSC_DIR}/TAGS_EXAMPLES 238 -touch ${PETSC_DIR}/TAGS_EXAMPLES 239 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_EXAMPLES ACTION=etags_examplesc alltree 240 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_EXAMPLES ACTION=etags_examplesch alltree 241 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_EXAMPLES ACTION=etags_examplesf alltree 242 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree 243 -chmod g+w TAGS_EXAMPLES 244etags_fexamples: 245 -${RM} ${PETSC_DIR}/TAGS_FEXAMPLES 246 -touch ${PETSC_DIR}/TAGS_FEXAMPLES 247 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_FEXAMPLES ACTION=etags_examplesf alltree 248 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree 249 -chmod g+w TAGS_FEXAMPLES 250# 251# These are here for the target allci and allco, and etags 252# 253 254BMAKEFILES = bmake/common* bmake/*/base* bmake/*/petscconf.h 255DOCS = bin/petscviewinfo.text bin/petscoptsinfo.text \ 256 bmake/README bmake/petscconf.defs 257SCRIPTS = maint/addlinks maint/builddist maint/buildlinks maint/wwwman \ 258 maint/xclude maint/crontab \ 259 maint/autoftp include/foldinclude/generateincludes 260 261# Deletes man pages (HTML version) 262deletemanualpages: 263 ${RM} -f ${PETSC_DIR}/docs/manualpages/*/*.html \ 264 ${PETSC_DIR}/docs/manualpages/manualpages.cit 265 266# Deletes man pages (LaTeX version) 267deletelatexpages: 268 ${RM} -f ${PETSC_DIR}/docs/tex/rsum/*sum*.tex 269 270# Builds all versions of the man pages 271allmanpages: allmanualpages alllatexpages 272allmanualpages: deletemanualpages 273 -${OMAKE} ACTION=manualpages_buildcite tree 274 -${OMAKE} ACTION=manualpages tree 275 -maint/wwwindex.py ${PETSC_DIR} 276 -maint/examplesindex.tcl 277 -maint/htmlkeywords.tcl 278 -@chmod g+w docs/manualpages/*/*.html 279 280alllatexpages: deletelatexpages 281 -${OMAKE} ACTION=latexpages tree 282 -@chmod g+w docs/tex/rsum/* 283 284# Builds Fortran stub files 285allfortranstubs: 286 -@include/foldinclude/generateincludes 287 -@${RM} -f src/fortran/auto/*.c 288 -${OMAKE} ACTION=fortranstubs tree 289 -@cd src/fortran/auto; ${OMAKE} -f makefile fixfortran 290 chmod g+w src/fortran/auto/*.c 291 292allci: 293 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci alltree 294 295allco: 296 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co alltree 297 298# 299# The commands below are for generating ADIC versions of the code; 300# they are not currently used. 301# 302alladicignore: 303 -@${RM} ${PDIR}/adicignore 304 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore tree 305 306alladic: 307 -@echo "Beginning to compile ADIC source code in all directories" 308 -@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}" 309 -@echo "=========================================" 310 -@cd include ; \ 311 ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h 312 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic tree 313 -@cd src/inline ; \ 314 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic 315 -@cd src/blaslapack ; \ 316 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic tree 317 318alladiclib: 319 -@echo "Beginning to compile ADIC libraries in all directories" 320 -@echo "Using compiler: ${CC} ${COPTFLAGS}" 321 -@echo "-----------------------------------------" 322 -@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" 323 -@echo "-----------------------------------------" 324 -@echo "Using configuration flags:" 325 -@grep "define " bmake/${PETSC_ARCH}/petscconf.h 326 -@echo "-----------------------------------------" 327 -@echo "Using include paths: ${PETSC_INCLUDE}" 328 -@echo "-----------------------------------------" 329 -@echo "Using PETSc directory: ${PETSC_DIR}" 330 -@echo "Using PETSc arch: ${PETSC_ARCH}" 331 -@echo "=========================================" 332 -@${RM} -f ${PDIR}/*adic.a 333 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib tree 334 -@cd src/blaslapack ; \ 335 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib tree 336 -@cd src/adic/src ; \ 337 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib 338 339# ------------------------------------------------------------------------------- 340# 341# Some macros to check if the fortran interface is up-to-date. 342# 343countfortranfunctions: 344 -@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \ 345 cut -d'(' -f1 | tr -s '' ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \ 346 sed "s/_$$//" | sort > /tmp/countfortranfunctions 347 348countcfunctions: 349 -@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s '' ' ' | \ 350 cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '' '\012' | \ 351 tr 'A-Z' 'a-z' | sort > /tmp/countcfunctions 352 353difffortranfunctions: countfortranfunctions countcfunctions 354 -@echo -------------- Functions missing in the fortran interface --------------------- 355 -@diff /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 356 -@echo ----------------- Functions missing in the C interface ------------------------ 357 -@diff /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 358 -@${RM} /tmp/countcfunctions /tmp/countfortranfunctions 359 360checkbadfortranstubs: 361 -@echo "=========================================" 362 -@echo "Functions with MPI_Comm as an Argument" 363 -@echo "=========================================" 364 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \ 365 tr -s '' ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 366 -@echo "=========================================" 367 -@echo "Functions with a String as an Argument" 368 -@echo "=========================================" 369 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \ 370 tr -s '' ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 371 -@echo "=========================================" 372 -@echo "Functions with Pointers to PETSc Objects as Argument" 373 -@echo "=========================================" 374 -@cd ${PETSC_DIR}/src/fortran/auto; \ 375 _p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s '' ' ' | \ 376 cut -d' ' -f 3 | tr -s '' '\012' | grep -v '{' | cut -d'*' -f1 | \ 377 sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ 378 for OBJ in $$_p_OBJ; do \ 379 grep "$$OBJ \*" *.c | tr -s '' ' ' | tr -s ':' ' ' | \ 380 cut -d'(' -f1 | cut -d' ' -f1,3; \ 381 done 382# Builds noise routines (not yet publically available) 383# Note: libfast cannot run on .F files on certain machines, so we 384# use lib and check for errors here. 385noise: info chkpetsc_dir 386 -@echo "Beginning to compile noise routines" 387 -@echo "=========================================" 388 -@cd src/snes/interface/noise; \ 389 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib > trashz 2>&1; \ 390 grep -v clog trashz | grep -v "information sections" | \ 391 egrep -i '(Error|warning|Can)' >> /dev/null;\ 392 if [ "$$?" != 1 ]; then \ 393 cat trashz ; fi; ${RM} trashz 394 ${RANLIB} ${PDIR}/libpetscsnes.a 395 -@chmod g+w ${PDIR}/libpetscsnes.a 396 -@echo "Completed compiling noise routines" 397 -@echo "=========================================" 398 399