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