xref: /petsc/makefile (revision b5fa40b854c85470d5d07462c274d7c1a074cca8)
173f4d377SMatthew Knepley# $Id: makefile,v 1.353 2001/08/28 19:43:38 balay Exp $
211b6ed10SLois Curfman McInnes#
3cfd69a58SBarry Smith# This is the makefile for installing PETSc. See the file
4ba3fcebfSBarry Smith# docs/website/documentation/installation.html for directions on installing PETSc.
5cfd69a58SBarry Smith# See also bmake/common for additional commands.
611b6ed10SLois Curfman McInnes#
7716b9c40SSatish BalayALL: all
848b2c0e9SBarry SmithLOCDIR = .
9b16a3bb1SBarry SmithDIRS   = src include docs
1061523587SBarry Smith
11516d1546SSatish Balayinclude ${PETSC_DIR}/bmake/common/base
12516d1546SSatish Balayinclude ${PETSC_DIR}/bmake/common/test
1361523587SBarry Smith
14ca5c9d59SMatthew Knepley#
153677444aSSatish Balay# Basic targets to build PETSc libraries.
16fa527775SLois Curfman McInnes# all: builds the c, fortran, and f90 libraries
17*b5fa40b8SBarry Smithall:
18*b5fa40b8SBarry Smith	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} BOPT=${BOPT} chkpetsc_dir
1944ecba3fSMatthew Knepley	-@${MAKE} all_build 2>&1 | tee make_log_${PETSC_ARCH}_${BOPT}
206f02d409SBarry Smithall_build: chk_petsc_dir info info_h chklib_dir deletelibs blaslapack mpich build shared
21efd74e9bSBarry Smith#
22fa527775SLois Curfman McInnes# Prints information about the system and version of PETSc being compiled
23efd74e9bSBarry Smith#
24efd74e9bSBarry Smithinfo:
25efd74e9bSBarry Smith	-@echo "=========================================="
2611b6dc0cSBarry Smith	-@echo " "
27d76296fbSBarry Smith	-@echo "See docs/troubleshooting.html and docs/bugreporting.html"
28d76296fbSBarry Smith	-@echo "for help with installation problems. Please send EVERYTHING"
29d76296fbSBarry Smith	-@echo "printed out below when reporting problems"
3011b6dc0cSBarry Smith	-@echo " "
3111b6dc0cSBarry Smith	-@echo "To subscribe to the PETSc users mailing list, send mail to "
3211b6dc0cSBarry Smith	-@echo "majordomo@mcs.anl.gov with the message: "
338b6f49e5SSatish Balay	-@echo "subscribe petsc-announce"
3411b6dc0cSBarry Smith	-@echo " "
35d76296fbSBarry Smith	-@echo "=========================================="
361d91fb6eSBarry Smith	-@echo On `date` on `hostname`
3730fdcc7aSBarry Smith	-@echo Machine characteristics: `uname -a`
38efd74e9bSBarry Smith	-@echo "-----------------------------------------"
390387d3c6SKris Buschelman	-@echo "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS}"
40dffd13fbSMatthew Knepley	-@echo "C Compiler version: " `${C_CCV}`
410387d3c6SKris Buschelman	-@echo "Using C++ compiler: ${CXX_CC} ${COPTFLAGS} ${CCPPFLAGS}"
42dffd13fbSMatthew Knepley	-@echo "C++ Compiler version: " `${CXX_CCV}`
430387d3c6SKris Buschelman	-@echo "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}"
44dffd13fbSMatthew Knepley	-@echo "Fortran Compiler version: " `${C_FCV}`
4547794344SBarry Smith	-@echo "-----------------------------------------"
46bdd8b494SSatish Balay	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
47f265ae5cSBarry Smith	-@echo "-----------------------------------------"
48d77bb2e1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
4947794344SBarry Smith	-@echo "-----------------------------------------"
50e0e703c1SSatish Balay	-@echo "Using configuration flags:"
5119552e71SMatthew Knepley	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
5247794344SBarry Smith	-@echo "-----------------------------------------"
53d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
5447794344SBarry Smith	-@echo "-----------------------------------------"
55d77bb2e1SSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
5619552e71SMatthew Knepley	-@echo "Using PETSc arch: ${PETSC_ARCH}"
57efd74e9bSBarry Smith	-@echo "------------------------------------------"
58d77bb2e1SSatish Balay	-@echo "Using C linker: ${CLINKER}"
59d77bb2e1SSatish Balay	-@echo "Using Fortran linker: ${FLINKER}"
60f2b01315SBarry Smith	-@echo "Using libraries: ${PETSC_LIB}"
61e3353558SSatish Balay	-@echo "------------------------------------------"
62e3353558SSatish Balay	-@echo "Using mpirun: ${MPIRUN}"
63efd74e9bSBarry Smith	-@echo "=========================================="
64b8d81f61SBarry Smith#
65b8d81f61SBarry Smith#
6619552e71SMatthew KnepleyMINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
67b8d81f61SBarry Smithinfo_h:
68ddbfe947SBarry Smith	-@$(RM) -f MINFO ${MINFO}
69c5e9c7dfSBarry Smith	-@echo  "static char *petscmachineinfo = \"  " >> MINFO
7034a92de5SBarry Smith	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
71c5e9c7dfSBarry Smith	-@echo  Machine characteristics: `uname -a` "" >> MINFO
72f6a9982fSBarry Smith	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
7319552e71SMatthew Knepley	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
7493520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
7593520af8SSatish Balay	-@echo  "static char *petsccompilerinfo = \"  " >> MINFO
765323642bSKris Buschelman	-@echo  "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS} " >> MINFO
77dffd13fbSMatthew Knepley	-@echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1 ; true
78dffd13fbSMatthew Knepley	-@echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; true
795323642bSKris Buschelman	-@echo  "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}" >> MINFO
80dffd13fbSMatthew Knepley	-@echo  "Fortran Compiler version:" >> MINFO ; ${C_FCV} >> MINFO 2>&1 ; true
8193520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
8293520af8SSatish Balay	-@echo  "static char *petsccompilerflagsinfo = \"  " >> MINFO
83c5e9c7dfSBarry Smith	-@echo  "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" >> MINFO
84c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
85c5e9c7dfSBarry Smith	-@echo  "Using configuration flags:" >> MINFO
86c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
87c5e9c7dfSBarry Smith	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
8893520af8SSatish Balay	-@echo  "------------------------------------------\"; " >> MINFO
8993520af8SSatish Balay	-@echo  "static char *petsclinkerinfo = \"  " >> MINFO
90c5e9c7dfSBarry Smith	-@echo  "Using C linker: ${CLINKER}" >> MINFO
91c5e9c7dfSBarry Smith	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
9293520af8SSatish Balay	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
93dd6a0ae0SKris Buschelman	-@cat MINFO | ${SED} -e 's/\^M//' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}
949c0905fcSSatish Balay	-@$(RM) MINFO
95ce0f4ea0SKris Buschelman
963677444aSSatish Balay#
97fa527775SLois Curfman McInnes# Builds the PETSc libraries
98fa527775SLois Curfman McInnes# This target also builds fortran77 and f90 interface
99f6a9982fSBarry Smith# files and compiles .F files
1003677444aSSatish Balay#
101f6a9982fSBarry Smithbuild:
102efd74e9bSBarry Smith	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
10347794344SBarry Smith	-@echo "========================================="
10444ecba3fSMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
1055fde6e02SSatish Balay	-@${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
1060b3634f8SBarry Smith	-@echo "Completed building libraries"
10747794344SBarry Smith	-@echo "========================================="
10835ca7349SBarry Smith#
109c8fd01ffSBarry Smith#  Compiles the blas and lapack source code if found
110c8fd01ffSBarry Smithblaslapack:
111c8fd01ffSBarry Smith	-@if [ -d f2cblaslapack/${PETSC_ARCH} -a ! -s f2cblaslapack/${PETSC_ARCH}/libf2cblas.a ] ; then cd f2cblaslapack;\
112c8fd01ffSBarry Smith        echo "=========================================";\
113c8fd01ffSBarry Smith        echo "Building C Blas/Lapack libraries";\
114c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
115c8fd01ffSBarry Smith        ${MV} libf2cblas.a libf2clapack.a ${PETSC_ARCH};\
116c8fd01ffSBarry Smith        echo "Completed C building Blas/Lapack libraries";\
117c8fd01ffSBarry Smith        echo "========================================="; fi
118c8fd01ffSBarry Smith	-@if [ -d fblaslapack/${PETSC_ARCH} -a ! -s fblaslapack/${PETSC_ARCH}/libfblas.a ] ; then cd fblaslapack;\
119c8fd01ffSBarry Smith        echo "=========================================";\
120c8fd01ffSBarry Smith        echo "Building Fortran Blas/Lapack libraries";\
121c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
122c8fd01ffSBarry Smith        ${MV} libfblas.a libflapack.a ${PETSC_ARCH};\
123c8fd01ffSBarry Smith        echo "Completed building Fortran Blas/Lapack libraries";\
124c8fd01ffSBarry Smith        echo "========================================="; fi
125c8fd01ffSBarry Smith#
1266f02d409SBarry Smith#  Compiles MPICH if found
1276f02d409SBarry Smithmpich:
12815876681SBarry Smith	-@releasename=`ls -d mpich* 2> /dev/null`;\
1296f02d409SBarry Smith        if [ -d $${releasename}/${PETSC_ARCH} -a ! -d $${releasename}/${PETSC_ARCH}/lib ] ; then cd $${releasename} ;\
1306f02d409SBarry Smith          echo "=========================================";\
1316f02d409SBarry Smith          echo "Compiling and installing " $${releasename};\
1326f02d409SBarry Smith          make; make install; \
1336f02d409SBarry Smith          echo "=========================================";\
1346f02d409SBarry Smith        fi;
1356f02d409SBarry Smith#
1363677444aSSatish Balay# Builds PETSc test examples for a given BOPT and architecture
1378744090aSBarry Smith#
1380ce59502SBarry Smithtest: chkopts
13904f117c6SBarry Smith	-@echo "Running test examples to verify correct installation"
14004f117c6SBarry Smith	@cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
14104f117c6SBarry Smith	@if [ "${C_FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
14204f117c6SBarry Smith	-@echo "Completed test examples"
1430ce59502SBarry Smith
1443677444aSSatish Balaytestexamples: info chkopts
1453677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
1463677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1473677444aSSatish Balay	-@echo "machines some of the numbers may not match exactly."
1483677444aSSatish Balay	-@echo "========================================="
14919552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_1  tree
1503677444aSSatish Balay	-@echo "Completed compiling and running test examples"
1513677444aSSatish Balay	-@echo "========================================="
1523677444aSSatish Balaytestfortran: info chkopts
1533677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
1543677444aSSatish Balay	-@echo "========================================="
1553677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1563677444aSSatish Balay	-@echo "machines or the way Fortran formats numbers"
1573677444aSSatish Balay	-@echo "some of the results may not match exactly."
1583677444aSSatish Balay	-@echo "========================================="
15919552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3  tree
1603677444aSSatish Balay	-@echo "Completed compiling and running Fortran test examples"
1613677444aSSatish Balay	-@echo "========================================="
16201c5c36fSSatish Balaytestexamples_uni: info chkopts
16301c5c36fSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
16401c5c36fSSatish Balay	-@echo "Due to different numerical round-off on certain"
16501c5c36fSSatish Balay	-@echo "machines some of the numbers may not match exactly."
16601c5c36fSSatish Balay	-@echo "========================================="
16719552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_4  tree
16801c5c36fSSatish Balay	-@echo "Completed compiling and running uniprocessor test examples"
16901c5c36fSSatish Balay	-@echo "========================================="
1703677444aSSatish Balaytestfortran_uni: info chkopts
1713677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
1723677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1733677444aSSatish Balay	-@echo "machines some of the numbers may not match exactly."
1743677444aSSatish Balay	-@echo "========================================="
17519552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree
1763677444aSSatish Balay	-@echo "Completed compiling and running uniprocessor fortran test examples"
1773677444aSSatish Balay	-@echo "========================================="
178ad96cc0dSLois Curfman McInnes
179f3eacedaSSatish Balay# Ranlib on the libraries
1808c37ef55SBarry Smithranlib:
1815fde6e02SSatish Balay	${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
18261523587SBarry Smith
18311b6ed10SLois Curfman McInnes# Deletes PETSc libraries
184f3eacedaSSatish Balaydeletelibs: chkopts_basic
185b87434adSSatish Balay	-${RM} -f ${PETSC_LIB_DIR}/*
186d44968ceSBarry Smith
187a42cec9dSMatthew Knepley# Cleans up build
188a42cec9dSMatthew Knepleyallclean: deletelibs
18919552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
190a42cec9dSMatthew Knepley
191467fbd6dSBarry Smith#
192467fbd6dSBarry Smith#   Updates your PETSc version to the latest set of patches
193467fbd6dSBarry Smith#
194467fbd6dSBarry Smithupdate:
195467fbd6dSBarry Smith	-@bin/petscupdate
1963677444aSSatish Balay
1974918a6b0SSatish Balay#
1984918a6b0SSatish Balay# Check if PETSC_DIR variable specified is valid
1994918a6b0SSatish Balay#
2004918a6b0SSatish Balaychk_petsc_dir:
2014918a6b0SSatish Balay	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
2021390f061SBarry Smith	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
2031390f061SBarry Smith	  echo "You need to use / to separate directories, not \\!"; \
2041390f061SBarry Smith	  echo "Aborting build"; \
2054918a6b0SSatish Balay	  false; fi
2064918a6b0SSatish Balay
2073677444aSSatish Balay# ------------------------------------------------------------------
2083677444aSSatish Balay#
2093677444aSSatish Balay# All remaining actions are intended for PETSc developers only.
2103677444aSSatish Balay# PETSc users should not generally need to use these commands.
2113677444aSSatish Balay#
2123677444aSSatish Balay
21365783a8cSBarry Smith# To access the tags in EMACS, type M-x visit-tags-table and specify
21465783a8cSBarry Smith# the file petsc/TAGS.
21565783a8cSBarry Smith# 1) To move to where a PETSc function is defined, enter M-. and the
21665783a8cSBarry Smith#     function name.
21765783a8cSBarry Smith# 2) To search for a string and move to the first occurrence,
21865783a8cSBarry Smith#     use M-x tags-search and the string.
2197acb7333SLois Curfman McInnes#     To locate later occurrences, use M-,
22011b6ed10SLois Curfman McInnes# Builds all etags files
22111b6ed10SLois Curfman McInnesalletags:
22201c05c5cSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags
22309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_noexamples
22409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_examples
22509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_makefiles
2264fa9d4e7SBarry Smith# Builds complete etags list
22720563c6bSBarry Smithetags:
22809f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS
22909f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS
23009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcec alltree
23141fa366cSBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcej alltree
23209f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourceh alltree
23309f7043eSSatish Balay	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcef alltree
23409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesc alltree
23509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesf alltree
23609f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesch alltree
23709f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesfh alltree
23809f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_makefile alltree
23909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS etags_bmakefiles
2404fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_docs alltree
2414fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_scripts alltree
24211b6ed10SLois Curfman McInnes# Builds the etags file that excludes the examples directories
243bfce26a3SBarry Smithetags_noexamples:
24409f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_NO_EXAMPLES
24509f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_NO_EXAMPLES
24609f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcec alltree
24741fa366cSBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcej alltree
24809f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourceh alltree
24909f7043eSSatish Balay	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcef alltree
25009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_makefile alltree
25109f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES etags_bmakefiles
25209f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_docs alltree
25311b6ed10SLois Curfman McInnes# Builds the etags file for makefiles
254b16a3bb1SBarry Smithetags_makefiles:
2557e0368d4SSatish Balay	-${RM} ${TAGSDIR}/TAGS_MAKEFILES
2567e0368d4SSatish Balay	-touch ${TAGSDIR}/TAGS_MAKEFILES
2577e0368d4SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES ACTION=etags_makefile alltree
2587e0368d4SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES etags_bmakefiles
259dc80aa23SSatish Balay# Builds the etags file for examples
260dc80aa23SSatish Balayetags_examples:
26109f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_EXAMPLES
26209f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_EXAMPLES
26309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesc alltree
26409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesch alltree
26509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesf alltree
26609f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
2672176044fSSatish Balayetags_fexamples:
26809f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_FEXAMPLES
26909f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_FEXAMPLES
27009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_FEXAMPLES ACTION=etags_examplesf alltree
27109f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
272b38bb785SSatish Balay#
273f20f7ba3SSatish Balay# These are here for the target allci and allco, and etags
2743677444aSSatish Balay#
275b38bb785SSatish Balay
27623bef294SSatish BalayBMAKEFILES = bmake/common/base bmake/common/test \
277516d1546SSatish Balay	     bmake/common/bopt* bmake/*/rules bmake/*/variables bmake/*/packages \
2782bda9e70SSatish Balay	     bmake/*/petscconf.h bmake/*/petscfix.h bmake/config/packages.in \
2792905d4d4SKris Buschelman	     bmake/config/petscfix.h.in  bmake/config/rules.in  \
2802bda9e70SSatish Balay	     bmake/config/variables.in \
2817666ef6eSBarry Smith             bmake/*/buildtest bmake/adic.init bmake/adicmf.init
2822f1ebae6SLois Curfman McInnesDOCS	   = bmake/readme bmake/petscconf.defs
283d56c4d9fSBarry SmithSCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/crontab python/PETSc/Configure.py python/PETSc/Options.py \
284d56c4d9fSBarry Smith             python/PETSc/packages/ADIC.py python/PETSc/packages/MPE.py python/PETSc/packages/Mathematica.py \
285d56c4d9fSBarry Smith             python/PETSc/packages/PLAPACK.py python/PETSc/packages/Triangle.py python/PETSc/packages/Matlab.py \
286d56c4d9fSBarry Smith             python/PETSc/packages/PVODE.py python/PETSc/packages/BlasLapack.py python/PETSc/packages/MPI.py \
287d56c4d9fSBarry Smith             python/PETSc/packages/BlockSolve.py python/PETSc/packages/NetCDF.py python/PETSc/packages/ParMetis.py \
288d56c4d9fSBarry Smith             python/PETSc/packages/update.py
289d56c4d9fSBarry Smith
29011b6ed10SLois Curfman McInnes
2916b91f8d1SSatish Balayupdatewebdocs:
2926b91f8d1SSatish Balay	-chmod -R ug+w /mcs/tmp/petsc-tmp
2936b91f8d1SSatish Balay	-chgrp -R petsc /mcs/tmp/petsc-tmp
2946b91f8d1SSatish Balay	-/bin/rm -rf /mcs/tmp/petscdocs
2956b91f8d1SSatish Balay	-/bin/cp -r /mcs/tmp/petsc-tmp/docs /mcs/tmp/petscdocs
2966b91f8d1SSatish Balay	-maint/update-docs.py /mcs/tmp/petscdocs
2976b91f8d1SSatish Balay	-find /mcs/tmp/petscdocs -type d -name "*" -exec chmod g+w {} \;
2986b91f8d1SSatish Balay	-/bin/cp -r /mcs/tmp/petscdocs/* ${PETSC_DIR}/docs
2996b91f8d1SSatish Balay	-/bin/rm -rf /mcs/tmp/petscdocs
3006b91f8d1SSatish Balay
301ad56a76cSSatish Balaychk_loc:
302ad56a76cSSatish Balay	@if [ ${LOC}foo = foo ] ; then \
303ad56a76cSSatish Balay	  echo "*********************** ERROR ************************" ; \
304ad56a76cSSatish Balay	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
305ad56a76cSSatish Balay	  echo "******************************************************";  false; fi
3062496ca06SSatish Balay
307a2fc510eSBarry Smith# Builds all the documentation - should be done every night
308f1d13e97SSatish Balayalldoc: alldoc1 alldoc2
309f1d13e97SSatish Balay
310f1d13e97SSatish Balay# Build everything that goes into 'doc' dir except html sources
311f1d13e97SSatish Balayalldoc1: chk_loc deletemanualpages chk_concepts_dir
312130c9832SBarry Smith	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
313fe742e3dSSatish Balay	cd docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
314130c9832SBarry Smith	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
31548b2c0e9SBarry Smith	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
316130c9832SBarry Smith	-${OMAKE} ACTION=manexamples tree LOC=${LOC}
317130c9832SBarry Smith	-${OMAKE} manconcepts LOC=${LOC}
31848b2c0e9SBarry Smith	-${OMAKE} ACTION=getexlist tree LOC=${LOC}
31948b2c0e9SBarry Smith	-${OMAKE} ACTION=exampleconcepts tree LOC=${LOC}
32048b2c0e9SBarry Smith	-maint/helpindex.py ${PETSC_DIR} ${LOC}
321f1d13e97SSatish Balay	-maint/update-docs.py ${LOC}
322e01137a2SSatish Balay
323435da068SBarry Smith# Builds .html versions of the source
324f1d13e97SSatish Balayalldoc2: chk_loc
325cc4dcc40SBarry Smith	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
326435da068SBarry Smith
327efaa7783SSatish Balayalldocclean: deletemanualpages allcleanhtml
328efaa7783SSatish Balay
329efaa7783SSatish Balay# Deletes man pages (HTML version)
330efaa7783SSatish Balaydeletemanualpages: chk_loc
331efaa7783SSatish Balay	find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \;
332efaa7783SSatish Balay	${RM} ${LOC}/docs/tex/exampleconcepts
333efaa7783SSatish Balay	${RM} ${LOC}/docs/tex/manconcepts
334efaa7783SSatish Balay	${RM} ${LOC}/docs/manualpages/manualpages.cit
335efaa7783SSatish Balay	-maint/update-docs.py ${LOC} clean
336efaa7783SSatish Balay
337115a300dSBarry Smithallcleanhtml:
338efaa7783SSatish Balay	-${RM} include/adic/*.h.html include/esi/petsc/*.h.html
339cc4dcc40SBarry Smith	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
340395565bcSBarry Smith
341ad56a76cSSatish Balaychk_concepts_dir: chk_loc
342fe742e3dSSatish Balay	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
343bfe54af3SSatish Balay	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
34411b6ed10SLois Curfman McInnes# Builds Fortran stub files
34511b6ed10SLois Curfman McInnesallfortranstubs:
346d77bb2e1SSatish Balay	-@${RM} -f src/fortran/auto/*.c
3470c488147SSatish Balay	-@touch src/fortran/auto/makefile.src
348bbe92fcfSSatish Balay	-${OMAKE} ACTION=fortranstubs tree_basic
3496e1c4064SSatish Balay	-@cd src/fortran/auto; ${RM} makefile.src; echo SOURCEC = ` ls *.c | tr -s '\n' ' '` > makefile.src
350807270aaSBarry Smith	-@cd src/fortran/auto; ${OMAKE} fixfortran
351f6ff2982SSatish Balay
352d55938c2SBarry Smithallci:
35319552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
354b951964fSBarry Smith
355d55938c2SBarry Smithallco:
35619552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
357d55938c2SBarry Smith
358791d64f4SSatish Balay# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
359791d64f4SSatish Balayallrcslabel:
36019552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
361b334301eSBarry Smith#
362b334301eSBarry Smith#   The commands below are for generating ADIC versions of the code;
363b334301eSBarry Smith# they are not currently used.
364b334301eSBarry Smith#
3655eea60f9SBarry Smithalladicignore:
366b87434adSSatish Balay	-@${RM} ${INSTALL_LIB_DIR}/adicignore
36719552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
3685eea60f9SBarry Smith
3695eea60f9SBarry Smithalladic:
370d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC source code in all directories"
37167b024f7SSatish Balay	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
372d18b0ea7SBarry Smith	-@echo "========================================="
37347794344SBarry Smith	-@cd include ; \
37467b024f7SSatish Balay           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
37519552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
37647794344SBarry Smith	-@cd src/inline ; \
37719552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic
37877ed5343SBarry Smith	-@cd src/blaslapack ; \
37919552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
3806e81b665SBarry Smith
38147794344SBarry Smithalladiclib:
382d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC libraries in all directories"
383d77bb2e1SSatish Balay	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
384d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
385d77bb2e1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
386d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
387e0e703c1SSatish Balay	-@echo "Using configuration flags:"
388ba1077baSMatthew Knepley	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
389d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
390d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
391d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
392d77bb2e1SSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
39319552e71SMatthew Knepley	-@echo "Using PETSc arch: ${PETSC_ARCH}"
394d18b0ea7SBarry Smith	-@echo "========================================="
3955fde6e02SSatish Balay	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${LIB_SUFFIX}
39619552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
39777ed5343SBarry Smith	-@cd src/blaslapack ; \
39819552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
3997e351921SBarry Smith	-@cd src/adic/src ; \
40019552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib
4015eea60f9SBarry Smith
4029e417c50SSatish Balay# -------------------------------------------------------------------------------
4039e417c50SSatish Balay#
4049e417c50SSatish Balay# Some macros to check if the fortran interface is up-to-date.
4059e417c50SSatish Balay#
4069e417c50SSatish Balaycountfortranfunctions:
407d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
40885c7cd6cSSatish Balay	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
4099e417c50SSatish Balay	sed "s/_$$//" | sort > /tmp/countfortranfunctions
410b334301eSBarry Smith
4119e417c50SSatish Balaycountcfunctions:
41285c7cd6cSSatish Balay	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
41385c7cd6cSSatish Balay	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
4149e417c50SSatish Balay	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
4159e417c50SSatish Balay
4169e417c50SSatish Balaydifffortranfunctions: countfortranfunctions countcfunctions
4179e417c50SSatish Balay	-@echo -------------- Functions missing in the fortran interface ---------------------
4189700b7f8SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
4199e417c50SSatish Balay	-@echo ----------------- Functions missing in the C interface ------------------------
4209700b7f8SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
421d77bb2e1SSatish Balay	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
422b334301eSBarry Smith
4233f4c9a3aSSatish Balaycheckbadfortranstubs:
4243f4c9a3aSSatish Balay	-@echo "========================================="
4253f4c9a3aSSatish Balay	-@echo "Functions with MPI_Comm as an Argument"
4263f4c9a3aSSatish Balay	-@echo "========================================="
427d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
42885c7cd6cSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4293f4c9a3aSSatish Balay	-@echo "========================================="
4303f4c9a3aSSatish Balay	-@echo "Functions with a String as an Argument"
4313f4c9a3aSSatish Balay	-@echo "========================================="
432d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
43385c7cd6cSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4343f4c9a3aSSatish Balay	-@echo "========================================="
4353f4c9a3aSSatish Balay	-@echo "Functions with Pointers to PETSc Objects as Argument"
4363f4c9a3aSSatish Balay	-@echo "========================================="
437d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; \
43885c7cd6cSSatish Balay	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
43985c7cd6cSSatish Balay	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
4403f4c9a3aSSatish Balay	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
4413f4c9a3aSSatish Balay	for OBJ in $$_p_OBJ; do \
44285c7cd6cSSatish Balay	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
4433f4c9a3aSSatish Balay	cut -d'(' -f1 | cut -d' ' -f1,3; \
4443f4c9a3aSSatish Balay	done
4454556b810SBarry Smith#
4464556b810SBarry Smith# Automatically generates PETSc exercises in html from the tutorial examples.
447b6ea66eeSBarry Smith#
448b6ea66eeSBarry Smith# The introduction for each section is obtained from docs/manualpages/bop.${MANSEC} is under RCS and may be edited
449b6ea66eeSBarry Smith#  (used also in introductions to the manual pages)
450b6ea66eeSBarry Smith# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
451b6ea66eeSBarry Smith# The list of exercises is from TUTORIALS in each directory's makefile
452b6ea66eeSBarry Smith#
4534556b810SBarry Smith# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
4544556b810SBarry Smith# The pagemaker rule is in the file bmake/common (at the bottom)
4554556b810SBarry Smith#
456843ae28eSBarry Smith# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
45797e8d271SBarry Smith#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
458843ae28eSBarry Smith#
45997e8d271SBarry Smithexercises:
46097e8d271SBarry Smith	-@echo "========================================="
46197e8d271SBarry Smith	-@echo "Generating HTML tutorial exercises"
462467fbd6dSBarry Smith	-@${RM} docs/pageform.txt
46397e8d271SBarry Smith	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
46497e8d271SBarry Smith	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
465beb1b3a5SBarry Smith	-@echo "access_format=short"                        >> docs/pageform.txt
46697e8d271SBarry Smith	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
46797e8d271SBarry Smith	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
46897e8d271SBarry Smith	-@echo "Generating HTML for individual directories"
46997e8d271SBarry Smith	-@echo "========================================="
470beb1b3a5SBarry Smith	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
47197e8d271SBarry Smith	-@echo "Completed HTML for individual directories"
47297e8d271SBarry Smith	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
47397e8d271SBarry Smith	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
47497e8d271SBarry Smith	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
47597e8d271SBarry Smith	-@echo "========================================="
47697e8d271SBarry Smith
4778852b4e5SMatthew Knepley.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
478a42cec9dSMatthew Knepley        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples updatewebdocs alldoc allmanualpages \
479a42cec9dSMatthew Knepley        allhtml allcleanhtml allfortranstubs allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
480ca5c9d59SMatthew Knepley        start_configure configure_petsc configure_clean
481f7819401SBarry Smith
482f7819401SBarry Smithcitool:
483f7819401SBarry Smith	-@bk citool
484f7819401SBarry Smith	-@cd python/BuildSystem; bk citool
485f7819401SBarry Smith
486f7819401SBarry Smithpull:
487f7819401SBarry Smith	-@bk pull
488f7819401SBarry Smith	-@cd python/BuildSystem; bk pull
489f7819401SBarry Smith
490f7819401SBarry Smithpush:
491f7819401SBarry Smith	-@bk push
492f7819401SBarry Smith	-@cd python/BuildSystem; bk push
493f7819401SBarry Smith
494