1# $Id: makefile,v 1.256 1999/01/29 22:46:23 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_examplesh alltree 197 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_makefile alltree 198 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS etags_bmakefiles 199 -chmod g+w TAGS 200# Builds complete etags list; only for PETSc developers. 201etags_complete: 202 -${RM} ${PETSC_DIR}/TAGS_COMPLETE 203 -touch ${PETSC_DIR}/TAGS_COMPLETE 204 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_sourcec alltree 205 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_sourceh alltree 206 -cd src/fortran; make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_sourcef alltree 207 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_examplesc alltree 208 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_examplesf alltree 209 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_examplesh alltree 210 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_makefile alltree 211 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE etags_bmakefiles 212 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_COMPLETE ACTION=etags_docs alltree 213 -chmod g+w TAGS_COMPLETE 214# Builds the etags file that excludes the examples directories 215etags_noexamples: 216 -${RM} ${PETSC_DIR}/TAGS_NO_EXAMPLES 217 -touch ${PETSC_DIR}/TAGS_NO_EXAMPLES 218 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcec alltree 219 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES ACTION=etags_sourceh alltree 220 -cd src/fortran; make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS ACTION=etags_sourcef alltree 221 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES ACTION=etags_makefile alltree 222 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES etags_bmakefiles 223 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_NO_EXAMPLES ACTION=etags_docs alltree 224 -chmod g+w TAGS_NO_EXAMPLES 225# Builds the etags file for makefiles 226etags_makefiles: 227 -${RM} ${PETSC_DIR}/TAGS_MAKEFILE 228 -touch ${PETSC_DIR}/TAGS_MAKEFILE 229 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_MAKEFILE ACTION=etags_makefile alltree 230 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_MAKEFILE etags_bmakefiles 231 -chmod g+w TAGS_MAKEFILE 232# Builds the etags file for examples 233etags_examples: 234 -${RM} ${PETSC_DIR}/TAGS_EXAMPLES 235 -touch ${PETSC_DIR}/TAGS_EXAMPLES 236 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_EXAMPLES ACTION=etags_examplesc alltree 237 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_EXAMPLES ACTION=etags_examplesh alltree 238 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_EXAMPLES ACTION=etags_examplesf alltree 239 -chmod g+w TAGS_EXAMPLES 240etags_fexamples: 241 -${RM} ${PETSC_DIR}/TAGS_FEXAMPLES 242 -touch ${PETSC_DIR}/TAGS_FEXAMPLES 243 -make PETSC_DIR=${PETSC_DIR} TAGSFILE=${PETSC_DIR}/TAGS_FEXAMPLES ACTION=etags_examplesf alltree 244 -chmod g+w TAGS_FEXAMPLES 245# 246# These are here for the target allci and allco, and etags 247# 248 249BMAKEFILES = bmake/common* bmake/*/base* bmake/*/petscconf.h 250DOCS = maint/addlinks maint/builddist maint/buildlinks maint/wwwman \ 251 maint/xclude maint/crontab \ 252 maint/autoftp include/foldinclude/generateincludes \ 253 bin/petscviewinfo.text bin/petscoptsinfo.text \ 254 bmake/readme bmake/petscconf.defs 255 256# Deletes man pages (HTML version) 257deletemanualpages: 258 ${RM} -f ${PETSC_DIR}/docs/manualpages/man*/* \ 259 ${PETSC_DIR}/docs/manualpages/man?.html \ 260 ${PETSC_DIR}/docs/manualpages/manualpages.cit 261 262# Deletes man pages (LaTeX version) 263deletelatexpages: 264 ${RM} -f ${PETSC_DIR}/docs/tex/rsum/*sum*.tex 265 266# Builds all versions of the man pages 267allmanpages: allmanualpages alllatexpages 268allmanualpages: deletemanualpages 269 -${OMAKE} ACTION=manualpages_buildcite tree 270 -cd src/fortran/custom; ${OMAKE} manualpages_buildcite 271 -cd src/fortran/custom; ${OMAKE} manualpages 272 -${OMAKE} ACTION=manualpages tree 273 -maint/wwwindex.py ${PETSC_DIR} 274 -maint/examplesindex.tcl 275 -maint/htmlkeywords.tcl 276 -@chmod g+w docs/manualpages/man*/* 277 278alllatexpages: deletelatexpages 279 -${OMAKE} ACTION=latexpages tree 280 -cd src/fortran/custom; ${OMAKE} latexpages 281 -@chmod g+w docs/tex/rsum/* 282 283# Builds Fortran stub files 284allfortranstubs: 285 -@include/foldinclude/generateincludes 286 -@${RM} -f src/fortran/auto/*.c 287 -${OMAKE} ACTION=fortranstubs tree 288 -@cd src/fortran/auto; ${OMAKE} -f makefile fixfortran 289 chmod g+w src/fortran/auto/*.c 290 291allci: 292 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci alltree 293 294allco: 295 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co alltree 296 297# 298# The commands below are for generating ADIC versions of the code; 299# they are not currently used. 300# 301alladicignore: 302 -@${RM} ${PDIR}/adicignore 303 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore tree 304 305alladic: 306 -@echo "Beginning to compile ADIC source code in all directories" 307 -@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}" 308 -@echo "=========================================" 309 -@cd include ; \ 310 ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h 311 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic tree 312 -@cd src/inline ; \ 313 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic 314 -@cd src/blaslapack ; \ 315 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic tree 316 317alladiclib: 318 -@echo "Beginning to compile ADIC libraries in all directories" 319 -@echo "Using compiler: ${CC} ${COPTFLAGS}" 320 -@echo "-----------------------------------------" 321 -@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" 322 -@echo "-----------------------------------------" 323 -@echo "Using configuration flags:" 324 -@grep "define " bmake/${PETSC_ARCH}/petscconf.h 325 -@echo "-----------------------------------------" 326 -@echo "Using include paths: ${PETSC_INCLUDE}" 327 -@echo "-----------------------------------------" 328 -@echo "Using PETSc directory: ${PETSC_DIR}" 329 -@echo "Using PETSc arch: ${PETSC_ARCH}" 330 -@echo "=========================================" 331 -@${RM} -f ${PDIR}/*adic.a 332 -@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib tree 333 -@cd src/blaslapack ; \ 334 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib tree 335 -@cd src/adic/src ; \ 336 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib 337 338# ------------------------------------------------------------------------------- 339# 340# Some macros to check if the fortran interface is up-to-date. 341# 342countfortranfunctions: 343 -@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \ 344 cut -d'(' -f1 | tr -s '' ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \ 345 sed "s/_$$//" | sort > /tmp/countfortranfunctions 346 347countcfunctions: 348 -@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s '' ' ' | \ 349 cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '' '\012' | \ 350 tr 'A-Z' 'a-z' | sort > /tmp/countcfunctions 351 352difffortranfunctions: countfortranfunctions countcfunctions 353 -@echo -------------- Functions missing in the fortran interface --------------------- 354 -@diff /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2 355 -@echo ----------------- Functions missing in the C interface ------------------------ 356 -@diff /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2 357 -@${RM} /tmp/countcfunctions /tmp/countfortranfunctions 358 359checkbadfortranstubs: 360 -@echo "=========================================" 361 -@echo "Functions with MPI_Comm as an Argument" 362 -@echo "=========================================" 363 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \ 364 tr -s '' ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 365 -@echo "=========================================" 366 -@echo "Functions with a String as an Argument" 367 -@echo "=========================================" 368 -@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \ 369 tr -s '' ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3 370 -@echo "=========================================" 371 -@echo "Functions with Pointers to PETSc Objects as Argument" 372 -@echo "=========================================" 373 -@cd ${PETSC_DIR}/src/fortran/auto; \ 374 _p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s '' ' ' | \ 375 cut -d' ' -f 3 | tr -s '' '\012' | grep -v '{' | cut -d'*' -f1 | \ 376 sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \ 377 for OBJ in $$_p_OBJ; do \ 378 grep "$$OBJ \*" *.c | tr -s '' ' ' | tr -s ':' ' ' | \ 379 cut -d'(' -f1 | cut -d' ' -f1,3; \ 380 done 381# Builds noise routines (not yet publically available) 382# Note: libfast cannot run on .F files on certain machines, so we 383# use lib and check for errors here. 384noise: info chkpetsc_dir 385 -@echo "Beginning to compile noise routines" 386 -@echo "=========================================" 387 -@cd src/snes/interface/noise; \ 388 ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib > trashz 2>&1; \ 389 grep -v clog trashz | grep -v "information sections" | \ 390 egrep -i '(Error|warning|Can)' >> /dev/null;\ 391 if [ "$$?" != 1 ]; then \ 392 cat trashz ; fi; ${RM} trashz 393 ${RANLIB} ${PDIR}/libpetscsnes.a 394 -@chmod g+w ${PDIR}/libpetscsnes.a 395 -@echo "Completed compiling noise routines" 396 -@echo "=========================================" 397 398