xref: /petsc/makefile (revision 6f02d4097e46a690810f536e8c3b39ab8d64ca6e)
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
47fc3c18eSBarry Smith# docs/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
178852b4e5SMatthew Knepleyall:
1844ecba3fSMatthew Knepley	-@${MAKE} all_build 2>&1 | tee make_log_${PETSC_ARCH}_${BOPT}
19*6f02d409SBarry Smithall_build: chk_petsc_dir info info_h chklib_dir deletelibs blaslapack mpich build shared
20efd74e9bSBarry Smith#
21fa527775SLois Curfman McInnes# Prints information about the system and version of PETSc being compiled
22efd74e9bSBarry Smith#
23efd74e9bSBarry Smithinfo:
24efd74e9bSBarry Smith	-@echo "=========================================="
2511b6dc0cSBarry Smith	-@echo " "
26d76296fbSBarry Smith	-@echo "See docs/troubleshooting.html and docs/bugreporting.html"
27d76296fbSBarry Smith	-@echo "for help with installation problems. Please send EVERYTHING"
28d76296fbSBarry Smith	-@echo "printed out below when reporting problems"
2911b6dc0cSBarry Smith	-@echo " "
3011b6dc0cSBarry Smith	-@echo "To subscribe to the PETSc users mailing list, send mail to "
3111b6dc0cSBarry Smith	-@echo "majordomo@mcs.anl.gov with the message: "
328b6f49e5SSatish Balay	-@echo "subscribe petsc-announce"
3311b6dc0cSBarry Smith	-@echo " "
34d76296fbSBarry Smith	-@echo "=========================================="
351d91fb6eSBarry Smith	-@echo On `date` on `hostname`
3630fdcc7aSBarry Smith	-@echo Machine characteristics: `uname -a`
37efd74e9bSBarry Smith	-@echo "-----------------------------------------"
380387d3c6SKris Buschelman	-@echo "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS}"
39dffd13fbSMatthew Knepley	-@echo "C Compiler version: " `${C_CCV}`
400387d3c6SKris Buschelman	-@echo "Using C++ compiler: ${CXX_CC} ${COPTFLAGS} ${CCPPFLAGS}"
41dffd13fbSMatthew Knepley	-@echo "C++ Compiler version: " `${CXX_CCV}`
420387d3c6SKris Buschelman	-@echo "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}"
43dffd13fbSMatthew Knepley	-@echo "Fortran Compiler version: " `${C_FCV}`
4447794344SBarry Smith	-@echo "-----------------------------------------"
45bdd8b494SSatish Balay	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
46f265ae5cSBarry Smith	-@echo "-----------------------------------------"
47d77bb2e1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
4847794344SBarry Smith	-@echo "-----------------------------------------"
49e0e703c1SSatish Balay	-@echo "Using configuration flags:"
5019552e71SMatthew Knepley	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
5147794344SBarry Smith	-@echo "-----------------------------------------"
52d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
5347794344SBarry Smith	-@echo "-----------------------------------------"
54d77bb2e1SSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
5519552e71SMatthew Knepley	-@echo "Using PETSc arch: ${PETSC_ARCH}"
56efd74e9bSBarry Smith	-@echo "------------------------------------------"
57d77bb2e1SSatish Balay	-@echo "Using C linker: ${CLINKER}"
58d77bb2e1SSatish Balay	-@echo "Using Fortran linker: ${FLINKER}"
59f2b01315SBarry Smith	-@echo "Using libraries: ${PETSC_LIB}"
60e3353558SSatish Balay	-@echo "------------------------------------------"
61e3353558SSatish Balay	-@echo "Using mpirun: ${MPIRUN}"
62efd74e9bSBarry Smith	-@echo "=========================================="
63b8d81f61SBarry Smith#
64b8d81f61SBarry Smith#
6519552e71SMatthew KnepleyMINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
66b8d81f61SBarry Smithinfo_h:
67ddbfe947SBarry Smith	-@$(RM) -f MINFO ${MINFO}
68c5e9c7dfSBarry Smith	-@echo  "static char *petscmachineinfo = \"  " >> MINFO
6934a92de5SBarry Smith	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
70c5e9c7dfSBarry Smith	-@echo  Machine characteristics: `uname -a` "" >> MINFO
71f6a9982fSBarry Smith	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
7219552e71SMatthew Knepley	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
7393520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
7493520af8SSatish Balay	-@echo  "static char *petsccompilerinfo = \"  " >> MINFO
755323642bSKris Buschelman	-@echo  "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS} " >> MINFO
76dffd13fbSMatthew Knepley	-@echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1 ; true
77dffd13fbSMatthew Knepley	-@echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; true
785323642bSKris Buschelman	-@echo  "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}" >> MINFO
79dffd13fbSMatthew Knepley	-@echo  "Fortran Compiler version:" >> MINFO ; ${C_FCV} >> MINFO 2>&1 ; true
8093520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
8193520af8SSatish Balay	-@echo  "static char *petsccompilerflagsinfo = \"  " >> MINFO
82c5e9c7dfSBarry Smith	-@echo  "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" >> MINFO
83c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
84c5e9c7dfSBarry Smith	-@echo  "Using configuration flags:" >> MINFO
85c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
86c5e9c7dfSBarry Smith	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
8793520af8SSatish Balay	-@echo  "------------------------------------------\"; " >> MINFO
8893520af8SSatish Balay	-@echo  "static char *petsclinkerinfo = \"  " >> MINFO
89c5e9c7dfSBarry Smith	-@echo  "Using C linker: ${CLINKER}" >> MINFO
90c5e9c7dfSBarry Smith	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
9193520af8SSatish Balay	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
92dd6a0ae0SKris Buschelman	-@cat MINFO | ${SED} -e 's/\^M//' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}
939c0905fcSSatish Balay	-@$(RM) MINFO
94ce0f4ea0SKris Buschelman
953677444aSSatish Balay#
96fa527775SLois Curfman McInnes# Builds the PETSc libraries
97fa527775SLois Curfman McInnes# This target also builds fortran77 and f90 interface
98f6a9982fSBarry Smith# files and compiles .F files
993677444aSSatish Balay#
100f6a9982fSBarry Smithbuild:
101efd74e9bSBarry Smith	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
10247794344SBarry Smith	-@echo "========================================="
10344ecba3fSMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
1045fde6e02SSatish Balay	-@${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
1050b3634f8SBarry Smith	-@echo "Completed building libraries"
10647794344SBarry Smith	-@echo "========================================="
10735ca7349SBarry Smith#
108c8fd01ffSBarry Smith#  Compiles the blas and lapack source code if found
109c8fd01ffSBarry Smithblaslapack:
110c8fd01ffSBarry Smith	-@if [ -d f2cblaslapack/${PETSC_ARCH} -a ! -s f2cblaslapack/${PETSC_ARCH}/libf2cblas.a ] ; then cd f2cblaslapack;\
111c8fd01ffSBarry Smith        echo "=========================================";\
112c8fd01ffSBarry Smith        echo "Building C Blas/Lapack libraries";\
113c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
114c8fd01ffSBarry Smith        ${MV} libf2cblas.a libf2clapack.a ${PETSC_ARCH};\
115c8fd01ffSBarry Smith        echo "Completed C building Blas/Lapack libraries";\
116c8fd01ffSBarry Smith        echo "========================================="; fi
117c8fd01ffSBarry Smith	-@if [ -d fblaslapack/${PETSC_ARCH} -a ! -s fblaslapack/${PETSC_ARCH}/libfblas.a ] ; then cd fblaslapack;\
118c8fd01ffSBarry Smith        echo "=========================================";\
119c8fd01ffSBarry Smith        echo "Building Fortran Blas/Lapack libraries";\
120c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
121c8fd01ffSBarry Smith        ${MV} libfblas.a libflapack.a ${PETSC_ARCH};\
122c8fd01ffSBarry Smith        echo "Completed building Fortran Blas/Lapack libraries";\
123c8fd01ffSBarry Smith        echo "========================================="; fi
124c8fd01ffSBarry Smith#
125*6f02d409SBarry Smith#  Compiles MPICH if found
126*6f02d409SBarry Smithmpich:
127*6f02d409SBarry Smith	-@releasename=`ls -d mpich*`;\
128*6f02d409SBarry Smith        if [ -d $${releasename}/${PETSC_ARCH} -a ! -d $${releasename}/${PETSC_ARCH}/lib ] ; then cd $${releasename} ;\
129*6f02d409SBarry Smith          echo "=========================================";\
130*6f02d409SBarry Smith          echo "Compiling and installing " $${releasename};\
131*6f02d409SBarry Smith          make; make install; \
132*6f02d409SBarry Smith          echo "=========================================";\
133*6f02d409SBarry Smith        fi;
134*6f02d409SBarry Smith#
1353677444aSSatish Balay# Builds PETSc test examples for a given BOPT and architecture
1368744090aSBarry Smith#
1370ce59502SBarry Smithtest: chkopts
13804f117c6SBarry Smith	-@echo "Running test examples to verify correct installation"
13904f117c6SBarry Smith	@cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
14004f117c6SBarry Smith	@if [ "${C_FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
14104f117c6SBarry Smith	-@echo "Completed test examples"
1420ce59502SBarry Smith
1433677444aSSatish Balaytestexamples: info chkopts
1443677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
1453677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1463677444aSSatish Balay	-@echo "machines some of the numbers may not match exactly."
1473677444aSSatish Balay	-@echo "========================================="
14819552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_1  tree
1493677444aSSatish Balay	-@echo "Completed compiling and running test examples"
1503677444aSSatish Balay	-@echo "========================================="
1513677444aSSatish Balaytestfortran: info chkopts
1523677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
1533677444aSSatish Balay	-@echo "========================================="
1543677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1553677444aSSatish Balay	-@echo "machines or the way Fortran formats numbers"
1563677444aSSatish Balay	-@echo "some of the results may not match exactly."
1573677444aSSatish Balay	-@echo "========================================="
15819552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3  tree
1593677444aSSatish Balay	-@echo "Completed compiling and running Fortran test examples"
1603677444aSSatish Balay	-@echo "========================================="
16101c5c36fSSatish Balaytestexamples_uni: info chkopts
16201c5c36fSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
16301c5c36fSSatish Balay	-@echo "Due to different numerical round-off on certain"
16401c5c36fSSatish Balay	-@echo "machines some of the numbers may not match exactly."
16501c5c36fSSatish Balay	-@echo "========================================="
16619552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_4  tree
16701c5c36fSSatish Balay	-@echo "Completed compiling and running uniprocessor test examples"
16801c5c36fSSatish Balay	-@echo "========================================="
1693677444aSSatish Balaytestfortran_uni: info chkopts
1703677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
1713677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1723677444aSSatish Balay	-@echo "machines some of the numbers may not match exactly."
1733677444aSSatish Balay	-@echo "========================================="
17419552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree
1753677444aSSatish Balay	-@echo "Completed compiling and running uniprocessor fortran test examples"
1763677444aSSatish Balay	-@echo "========================================="
177ad96cc0dSLois Curfman McInnes
178f3eacedaSSatish Balay# Ranlib on the libraries
1798c37ef55SBarry Smithranlib:
1805fde6e02SSatish Balay	${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
18161523587SBarry Smith
18211b6ed10SLois Curfman McInnes# Deletes PETSc libraries
183f3eacedaSSatish Balaydeletelibs: chkopts_basic
184b87434adSSatish Balay	-${RM} -f ${PETSC_LIB_DIR}/*
185d44968ceSBarry Smith
186a42cec9dSMatthew Knepley# Cleans up build
187a42cec9dSMatthew Knepleyallclean: deletelibs
18819552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
189a42cec9dSMatthew Knepley
190467fbd6dSBarry Smith#
191467fbd6dSBarry Smith#   Updates your PETSc version to the latest set of patches
192467fbd6dSBarry Smith#
193467fbd6dSBarry Smithupdate:
194467fbd6dSBarry Smith	-@bin/petscupdate
1953677444aSSatish Balay
1964918a6b0SSatish Balay#
1974918a6b0SSatish Balay# Check if PETSC_DIR variable specified is valid
1984918a6b0SSatish Balay#
1994918a6b0SSatish Balaychk_petsc_dir:
2004918a6b0SSatish Balay	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
2011390f061SBarry Smith	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
2021390f061SBarry Smith	  echo "You need to use / to separate directories, not \\!"; \
2031390f061SBarry Smith	  echo "Aborting build"; \
2044918a6b0SSatish Balay	  false; fi
2054918a6b0SSatish Balay
2063677444aSSatish Balay# ------------------------------------------------------------------
2073677444aSSatish Balay#
2083677444aSSatish Balay# All remaining actions are intended for PETSc developers only.
2093677444aSSatish Balay# PETSc users should not generally need to use these commands.
2103677444aSSatish Balay#
2113677444aSSatish Balay
21265783a8cSBarry Smith# To access the tags in EMACS, type M-x visit-tags-table and specify
21365783a8cSBarry Smith# the file petsc/TAGS.
21465783a8cSBarry Smith# 1) To move to where a PETSc function is defined, enter M-. and the
21565783a8cSBarry Smith#     function name.
21665783a8cSBarry Smith# 2) To search for a string and move to the first occurrence,
21765783a8cSBarry Smith#     use M-x tags-search and the string.
2187acb7333SLois Curfman McInnes#     To locate later occurrences, use M-,
21911b6ed10SLois Curfman McInnes# Builds all etags files
22011b6ed10SLois Curfman McInnesalletags:
22101c05c5cSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags
22209f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_noexamples
22309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_examples
22409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_makefiles
2254fa9d4e7SBarry Smith# Builds complete etags list
22620563c6bSBarry Smithetags:
22709f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS
22809f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS
22909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcec alltree
23041fa366cSBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcej alltree
23109f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourceh alltree
23209f7043eSSatish Balay	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcef alltree
23309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesc alltree
23409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesf alltree
23509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesch alltree
23609f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesfh alltree
23709f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_makefile alltree
23809f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS etags_bmakefiles
2394fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_docs alltree
2404fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_scripts alltree
24111b6ed10SLois Curfman McInnes# Builds the etags file that excludes the examples directories
242bfce26a3SBarry Smithetags_noexamples:
24309f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_NO_EXAMPLES
24409f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_NO_EXAMPLES
24509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcec alltree
24641fa366cSBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcej alltree
24709f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourceh alltree
24809f7043eSSatish Balay	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcef alltree
24909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_makefile alltree
25009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES etags_bmakefiles
25109f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_docs alltree
25211b6ed10SLois Curfman McInnes# Builds the etags file for makefiles
253b16a3bb1SBarry Smithetags_makefiles:
2547e0368d4SSatish Balay	-${RM} ${TAGSDIR}/TAGS_MAKEFILES
2557e0368d4SSatish Balay	-touch ${TAGSDIR}/TAGS_MAKEFILES
2567e0368d4SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES ACTION=etags_makefile alltree
2577e0368d4SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES etags_bmakefiles
258dc80aa23SSatish Balay# Builds the etags file for examples
259dc80aa23SSatish Balayetags_examples:
26009f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_EXAMPLES
26109f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_EXAMPLES
26209f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesc alltree
26309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesch alltree
26409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesf alltree
26509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
2662176044fSSatish Balayetags_fexamples:
26709f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_FEXAMPLES
26809f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_FEXAMPLES
26909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_FEXAMPLES ACTION=etags_examplesf alltree
27009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
271b38bb785SSatish Balay#
272f20f7ba3SSatish Balay# These are here for the target allci and allco, and etags
2733677444aSSatish Balay#
274b38bb785SSatish Balay
27523bef294SSatish BalayBMAKEFILES = bmake/common/base bmake/common/test \
276516d1546SSatish Balay	     bmake/common/bopt* bmake/*/rules bmake/*/variables bmake/*/packages \
2772bda9e70SSatish Balay	     bmake/*/petscconf.h bmake/*/petscfix.h bmake/config/packages.in \
2782905d4d4SKris Buschelman	     bmake/config/petscfix.h.in  bmake/config/rules.in  \
2792bda9e70SSatish Balay	     bmake/config/variables.in \
2807666ef6eSBarry Smith             bmake/*/buildtest bmake/adic.init bmake/adicmf.init
2812f1ebae6SLois Curfman McInnesDOCS	   = bmake/readme bmake/petscconf.defs
282d56c4d9fSBarry SmithSCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/crontab python/PETSc/Configure.py python/PETSc/Options.py \
283d56c4d9fSBarry Smith             python/PETSc/packages/ADIC.py python/PETSc/packages/MPE.py python/PETSc/packages/Mathematica.py \
284d56c4d9fSBarry Smith             python/PETSc/packages/PLAPACK.py python/PETSc/packages/Triangle.py python/PETSc/packages/Matlab.py \
285d56c4d9fSBarry Smith             python/PETSc/packages/PVODE.py python/PETSc/packages/BlasLapack.py python/PETSc/packages/MPI.py \
286d56c4d9fSBarry Smith             python/PETSc/packages/BlockSolve.py python/PETSc/packages/NetCDF.py python/PETSc/packages/ParMetis.py \
287d56c4d9fSBarry Smith             python/PETSc/packages/update.py
288d56c4d9fSBarry Smith
28911b6ed10SLois Curfman McInnes
2906b91f8d1SSatish Balayupdatewebdocs:
2916b91f8d1SSatish Balay	-chmod -R ug+w /mcs/tmp/petsc-tmp
2926b91f8d1SSatish Balay	-chgrp -R petsc /mcs/tmp/petsc-tmp
2936b91f8d1SSatish Balay	-/bin/rm -rf /mcs/tmp/petscdocs
2946b91f8d1SSatish Balay	-/bin/cp -r /mcs/tmp/petsc-tmp/docs /mcs/tmp/petscdocs
2956b91f8d1SSatish Balay	-maint/update-docs.py /mcs/tmp/petscdocs
2966b91f8d1SSatish Balay	-find /mcs/tmp/petscdocs -type d -name "*" -exec chmod g+w {} \;
2976b91f8d1SSatish Balay	-/bin/cp -r /mcs/tmp/petscdocs/* ${PETSC_DIR}/docs
2986b91f8d1SSatish Balay	-/bin/rm -rf /mcs/tmp/petscdocs
2996b91f8d1SSatish Balay
300ad56a76cSSatish Balaychk_loc:
301ad56a76cSSatish Balay	@if [ ${LOC}foo = foo ] ; then \
302ad56a76cSSatish Balay	  echo "*********************** ERROR ************************" ; \
303ad56a76cSSatish Balay	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
304ad56a76cSSatish Balay	  echo "******************************************************";  false; fi
3052496ca06SSatish Balay
306a2fc510eSBarry Smith# Builds all the documentation - should be done every night
307f1d13e97SSatish Balayalldoc: alldoc1 alldoc2
308f1d13e97SSatish Balay
309f1d13e97SSatish Balay# Build everything that goes into 'doc' dir except html sources
310f1d13e97SSatish Balayalldoc1: chk_loc deletemanualpages chk_concepts_dir
311130c9832SBarry Smith	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
312fe742e3dSSatish Balay	cd docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
313130c9832SBarry Smith	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
31448b2c0e9SBarry Smith	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
315130c9832SBarry Smith	-${OMAKE} ACTION=manexamples tree LOC=${LOC}
316130c9832SBarry Smith	-${OMAKE} manconcepts LOC=${LOC}
31748b2c0e9SBarry Smith	-${OMAKE} ACTION=getexlist tree LOC=${LOC}
31848b2c0e9SBarry Smith	-${OMAKE} ACTION=exampleconcepts tree LOC=${LOC}
31948b2c0e9SBarry Smith	-maint/helpindex.py ${PETSC_DIR} ${LOC}
320f1d13e97SSatish Balay	-maint/update-docs.py ${LOC}
321e01137a2SSatish Balay
322435da068SBarry Smith# Builds .html versions of the source
323f1d13e97SSatish Balayalldoc2: chk_loc
324cc4dcc40SBarry Smith	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
325435da068SBarry Smith
326efaa7783SSatish Balayalldocclean: deletemanualpages allcleanhtml
327efaa7783SSatish Balay
328efaa7783SSatish Balay# Deletes man pages (HTML version)
329efaa7783SSatish Balaydeletemanualpages: chk_loc
330efaa7783SSatish Balay	find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \;
331efaa7783SSatish Balay	${RM} ${LOC}/docs/tex/exampleconcepts
332efaa7783SSatish Balay	${RM} ${LOC}/docs/tex/manconcepts
333efaa7783SSatish Balay	${RM} ${LOC}/docs/manualpages/manualpages.cit
334efaa7783SSatish Balay	-maint/update-docs.py ${LOC} clean
335efaa7783SSatish Balay
336115a300dSBarry Smithallcleanhtml:
337efaa7783SSatish Balay	-${RM} include/adic/*.h.html include/esi/petsc/*.h.html
338cc4dcc40SBarry Smith	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
339395565bcSBarry Smith
340ad56a76cSSatish Balaychk_concepts_dir: chk_loc
341fe742e3dSSatish Balay	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
342bfe54af3SSatish Balay	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
34311b6ed10SLois Curfman McInnes# Builds Fortran stub files
34411b6ed10SLois Curfman McInnesallfortranstubs:
345d77bb2e1SSatish Balay	-@${RM} -f src/fortran/auto/*.c
3460c488147SSatish Balay	-@touch src/fortran/auto/makefile.src
347bbe92fcfSSatish Balay	-${OMAKE} ACTION=fortranstubs tree_basic
3486e1c4064SSatish Balay	-@cd src/fortran/auto; ${RM} makefile.src; echo SOURCEC = ` ls *.c | tr -s '\n' ' '` > makefile.src
349807270aaSBarry Smith	-@cd src/fortran/auto; ${OMAKE} fixfortran
350f6ff2982SSatish Balay
351d55938c2SBarry Smithallci:
35219552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
353b951964fSBarry Smith
354d55938c2SBarry Smithallco:
35519552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
356d55938c2SBarry Smith
357791d64f4SSatish Balay# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
358791d64f4SSatish Balayallrcslabel:
35919552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
360b334301eSBarry Smith#
361b334301eSBarry Smith#   The commands below are for generating ADIC versions of the code;
362b334301eSBarry Smith# they are not currently used.
363b334301eSBarry Smith#
3645eea60f9SBarry Smithalladicignore:
365b87434adSSatish Balay	-@${RM} ${INSTALL_LIB_DIR}/adicignore
36619552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
3675eea60f9SBarry Smith
3685eea60f9SBarry Smithalladic:
369d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC source code in all directories"
37067b024f7SSatish Balay	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
371d18b0ea7SBarry Smith	-@echo "========================================="
37247794344SBarry Smith	-@cd include ; \
37367b024f7SSatish Balay           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
37419552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
37547794344SBarry Smith	-@cd src/inline ; \
37619552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic
37777ed5343SBarry Smith	-@cd src/blaslapack ; \
37819552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
3796e81b665SBarry Smith
38047794344SBarry Smithalladiclib:
381d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC libraries in all directories"
382d77bb2e1SSatish Balay	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
383d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
384d77bb2e1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
385d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
386e0e703c1SSatish Balay	-@echo "Using configuration flags:"
387ba1077baSMatthew Knepley	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
388d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
389d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
390d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
391d77bb2e1SSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
39219552e71SMatthew Knepley	-@echo "Using PETSc arch: ${PETSC_ARCH}"
393d18b0ea7SBarry Smith	-@echo "========================================="
3945fde6e02SSatish Balay	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${LIB_SUFFIX}
39519552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
39677ed5343SBarry Smith	-@cd src/blaslapack ; \
39719552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
3987e351921SBarry Smith	-@cd src/adic/src ; \
39919552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib
4005eea60f9SBarry Smith
4019e417c50SSatish Balay# -------------------------------------------------------------------------------
4029e417c50SSatish Balay#
4039e417c50SSatish Balay# Some macros to check if the fortran interface is up-to-date.
4049e417c50SSatish Balay#
4059e417c50SSatish Balaycountfortranfunctions:
406d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
40785c7cd6cSSatish Balay	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
4089e417c50SSatish Balay	sed "s/_$$//" | sort > /tmp/countfortranfunctions
409b334301eSBarry Smith
4109e417c50SSatish Balaycountcfunctions:
41185c7cd6cSSatish Balay	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
41285c7cd6cSSatish Balay	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
4139e417c50SSatish Balay	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
4149e417c50SSatish Balay
4159e417c50SSatish Balaydifffortranfunctions: countfortranfunctions countcfunctions
4169e417c50SSatish Balay	-@echo -------------- Functions missing in the fortran interface ---------------------
4179700b7f8SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
4189e417c50SSatish Balay	-@echo ----------------- Functions missing in the C interface ------------------------
4199700b7f8SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
420d77bb2e1SSatish Balay	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
421b334301eSBarry Smith
4223f4c9a3aSSatish Balaycheckbadfortranstubs:
4233f4c9a3aSSatish Balay	-@echo "========================================="
4243f4c9a3aSSatish Balay	-@echo "Functions with MPI_Comm as an Argument"
4253f4c9a3aSSatish Balay	-@echo "========================================="
426d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
42785c7cd6cSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4283f4c9a3aSSatish Balay	-@echo "========================================="
4293f4c9a3aSSatish Balay	-@echo "Functions with a String as an Argument"
4303f4c9a3aSSatish Balay	-@echo "========================================="
431d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
43285c7cd6cSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4333f4c9a3aSSatish Balay	-@echo "========================================="
4343f4c9a3aSSatish Balay	-@echo "Functions with Pointers to PETSc Objects as Argument"
4353f4c9a3aSSatish Balay	-@echo "========================================="
436d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; \
43785c7cd6cSSatish Balay	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
43885c7cd6cSSatish Balay	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
4393f4c9a3aSSatish Balay	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
4403f4c9a3aSSatish Balay	for OBJ in $$_p_OBJ; do \
44185c7cd6cSSatish Balay	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
4423f4c9a3aSSatish Balay	cut -d'(' -f1 | cut -d' ' -f1,3; \
4433f4c9a3aSSatish Balay	done
4444556b810SBarry Smith#
4454556b810SBarry Smith# Automatically generates PETSc exercises in html from the tutorial examples.
446b6ea66eeSBarry Smith#
447b6ea66eeSBarry Smith# The introduction for each section is obtained from docs/manualpages/bop.${MANSEC} is under RCS and may be edited
448b6ea66eeSBarry Smith#  (used also in introductions to the manual pages)
449b6ea66eeSBarry Smith# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
450b6ea66eeSBarry Smith# The list of exercises is from TUTORIALS in each directory's makefile
451b6ea66eeSBarry Smith#
4524556b810SBarry Smith# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
4534556b810SBarry Smith# The pagemaker rule is in the file bmake/common (at the bottom)
4544556b810SBarry Smith#
455843ae28eSBarry Smith# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
45697e8d271SBarry Smith#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
457843ae28eSBarry Smith#
45897e8d271SBarry Smithexercises:
45997e8d271SBarry Smith	-@echo "========================================="
46097e8d271SBarry Smith	-@echo "Generating HTML tutorial exercises"
461467fbd6dSBarry Smith	-@${RM} docs/pageform.txt
46297e8d271SBarry Smith	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
46397e8d271SBarry Smith	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
464beb1b3a5SBarry Smith	-@echo "access_format=short"                        >> docs/pageform.txt
46597e8d271SBarry Smith	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
46697e8d271SBarry Smith	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
46797e8d271SBarry Smith	-@echo "Generating HTML for individual directories"
46897e8d271SBarry Smith	-@echo "========================================="
469beb1b3a5SBarry Smith	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
47097e8d271SBarry Smith	-@echo "Completed HTML for individual directories"
47197e8d271SBarry Smith	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
47297e8d271SBarry Smith	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
47397e8d271SBarry Smith	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
47497e8d271SBarry Smith	-@echo "========================================="
47597e8d271SBarry Smith
4768852b4e5SMatthew Knepley.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
477a42cec9dSMatthew Knepley        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples updatewebdocs alldoc allmanualpages \
478a42cec9dSMatthew Knepley        allhtml allcleanhtml allfortranstubs allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
479ca5c9d59SMatthew Knepley        start_configure configure_petsc configure_clean
480f7819401SBarry Smith
481f7819401SBarry Smithcitool:
482f7819401SBarry Smith	-@bk citool
483f7819401SBarry Smith	-@cd python/BuildSystem; bk citool
484f7819401SBarry Smith
485f7819401SBarry Smithpull:
486f7819401SBarry Smith	-@bk pull
487f7819401SBarry Smith	-@cd python/BuildSystem; bk pull
488f7819401SBarry Smith
489f7819401SBarry Smithpush:
490f7819401SBarry Smith	-@bk push
491f7819401SBarry Smith	-@cd python/BuildSystem; bk push
492f7819401SBarry Smith
493