xref: /petsc/makefile (revision 6d220f77c1e883d67e313fa57e6577efcd2b37a0)
111b6ed10SLois Curfman McInnes#
261108934SBarry Smith# This is the makefile for installing PETSc. See
361108934SBarry Smith# http://www.mcs.anl.gov/petsc/petsc-2/documentation/installation.html for directions on installing PETSc.
4cfd69a58SBarry Smith# See also bmake/common for additional commands.
511b6ed10SLois Curfman McInnes#
6716b9c40SSatish BalayALL: all
748b2c0e9SBarry SmithLOCDIR = .
8de21bb36SSatish BalayDIRS   = src include
961523587SBarry Smith
10516d1546SSatish Balayinclude ${PETSC_DIR}/bmake/common/base
11516d1546SSatish Balayinclude ${PETSC_DIR}/bmake/common/test
1261523587SBarry Smith
13ca5c9d59SMatthew Knepley#
143677444aSSatish Balay# Basic targets to build PETSc libraries.
15fa527775SLois Curfman McInnes# all: builds the c, fortran, and f90 libraries
16b5fa40b8SBarry Smithall:
17ab901514SBarry Smith	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  chkpetsc_dir
18ab901514SBarry Smith	-@${OMAKE} all_build 2>&1 | tee make_log_${PETSC_ARCH}
19*6d220f77SSatish Balay	@egrep -i "( error | error:)" make_log_${PETSC_ARCH} > /dev/null; if [ "$$?" = "0" ]; then \
20*6d220f77SSatish Balay           echo "********************************************************************"; \
21*6d220f77SSatish Balay           echo "  Error during compile, check make_log_${PETSC_ARCH}"; \
22*6d220f77SSatish Balay           echo "  Send it and configure.log to petsc-maint@mcs.anl.gov";\
23*6d220f77SSatish Balay           echo "********************************************************************"; \
24*6d220f77SSatish Balay           exit 1; fi
25*6d220f77SSatish Balay
26b5d30489SBarry Smithall_build: chk_petsc_dir chklib_dir info info_h deletelibs  build shared
27efd74e9bSBarry Smith#
28fa527775SLois Curfman McInnes# Prints information about the system and version of PETSc being compiled
29efd74e9bSBarry Smith#
30efd74e9bSBarry Smithinfo:
31efd74e9bSBarry Smith	-@echo "=========================================="
3211b6dc0cSBarry Smith	-@echo " "
33b270bd72SBarry Smith	-@echo "See docs/faq.html and docs/bugreporting.html"
34d76296fbSBarry Smith	-@echo "for help with installation problems. Please send EVERYTHING"
35d76296fbSBarry Smith	-@echo "printed out below when reporting problems"
3611b6dc0cSBarry Smith	-@echo " "
3711b6dc0cSBarry Smith	-@echo "To subscribe to the PETSc users mailing list, send mail to "
3811b6dc0cSBarry Smith	-@echo "majordomo@mcs.anl.gov with the message: "
398b6f49e5SSatish Balay	-@echo "subscribe petsc-announce"
4011b6dc0cSBarry Smith	-@echo " "
41d76296fbSBarry Smith	-@echo "=========================================="
421d91fb6eSBarry Smith	-@echo On `date` on `hostname`
4330fdcc7aSBarry Smith	-@echo Machine characteristics: `uname -a`
44b270bd72SBarry Smith	-@echo "config/configure.py run at " ${CONFIGURE_RUN_TIME}
45b270bd72SBarry Smith	-@echo "config/configure.py options " ${CONFIGURE_OPTIONS}
46efd74e9bSBarry Smith	-@echo "-----------------------------------------"
47e481929fSSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
48e481929fSSatish Balay	-@echo "Using PETSc arch: ${PETSC_ARCH}"
4947794344SBarry Smith	-@echo "-----------------------------------------"
50bdd8b494SSatish Balay	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
51f265ae5cSBarry Smith	-@echo "-----------------------------------------"
52e0e703c1SSatish Balay	-@echo "Using configuration flags:"
5319552e71SMatthew Knepley	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
5447794344SBarry Smith	-@echo "-----------------------------------------"
55d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
56e481929fSSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
57efd74e9bSBarry Smith	-@echo "------------------------------------------"
58abc0a331SBarry Smith	-@echo "Using C/C++ compiler: ${CC} ${COPTFLAGS} ${CPPFLAGS}"
59e481929fSSatish Balay	-@echo "C/C++ Compiler version: " `${CCV}`
60e481929fSSatish Balay	-@if [ "${FC}" != "" ]; then \
61abc0a331SBarry Smith	   echo "Using Fortran compiler: ${FC} ${FOPTFLAGS} ${FPPFLAGS}";\
62e481929fSSatish Balay	   echo "Fortran Compiler version: " `${FCV}`;\
63e481929fSSatish Balay         fi
64e481929fSSatish Balay	-@echo "-----------------------------------------"
65abc0a331SBarry Smith	-@echo "Using C/C++ linker: ${CC_LINKER}"
66e481929fSSatish Balay	-@if [ "${FC}" != "" ]; then \
67abc0a331SBarry Smith	   echo "Using Fortran linker: ${FC_LINKER}";\
68e6ee457dSBarry Smith         fi
69e481929fSSatish Balay	-@echo "-----------------------------------------"
70f2b01315SBarry Smith	-@echo "Using libraries: ${PETSC_LIB}"
71e3353558SSatish Balay	-@echo "------------------------------------------"
72e3353558SSatish Balay	-@echo "Using mpirun: ${MPIRUN}"
73efd74e9bSBarry Smith	-@echo "=========================================="
74b8d81f61SBarry Smith#
75b8d81f61SBarry Smith#
7619552e71SMatthew KnepleyMINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
77b8d81f61SBarry Smithinfo_h:
78ddbfe947SBarry Smith	-@$(RM) -f MINFO ${MINFO}
792fc52814SBarry Smith	-@echo  "static const char *petscmachineinfo = \"  " >> MINFO
8034a92de5SBarry Smith	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
81b270bd72SBarry Smith	-@echo  "config/configure.py run at " ${CONFIGURE_RUN_TIME} >> MINFO
82b270bd72SBarry Smith	-@echo  "config/configure.py options " ${CONFIGURE_OPTIONS} >> MINFO
83c5e9c7dfSBarry Smith	-@echo  Machine characteristics: `uname -a` "" >> MINFO
84f6a9982fSBarry Smith	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
8519552e71SMatthew Knepley	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
8693520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
872fc52814SBarry Smith	-@echo  "static const char *petsccompilerinfo = \"  " >> MINFO
88abc0a331SBarry Smith	-@echo  "Using C compiler: ${CC} ${COPTFLAGS} ${CCPPFLAGS} " >> MINFO
89dffd13fbSMatthew Knepley	-@echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1 ; true
90dffd13fbSMatthew Knepley	-@echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; true
91abc0a331SBarry Smith	-@echo  "Using Fortran compiler: ${FC} ${FOPTFLAGS} ${FCPPFLAGS}" >> MINFO
92770ba9b7SSatish Balay	-@echo  "Fortran Compiler version:" >> MINFO ; ${FCV} >> MINFO 2>&1 ; true
9393520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
942fc52814SBarry Smith	-@echo  "static const char *petsccompilerflagsinfo = \"  " >> MINFO
95c5e9c7dfSBarry Smith	-@echo  "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" >> MINFO
96c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
97c5e9c7dfSBarry Smith	-@echo  "Using configuration flags:" >> MINFO
98c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
99c5e9c7dfSBarry Smith	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
10093520af8SSatish Balay	-@echo  "------------------------------------------\"; " >> MINFO
1012fc52814SBarry Smith	-@echo  "static const char *petsclinkerinfo = \"  " >> MINFO
102c5e9c7dfSBarry Smith	-@echo  "Using C linker: ${CLINKER}" >> MINFO
103c5e9c7dfSBarry Smith	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
10493520af8SSatish Balay	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
105a2d9a622SKris Buschelman	-@cat MINFO | ${SED} -e 's/\^M//g' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> MINFO_
106aa0c092eSKris Buschelman	-@cat MINFO_ | ${SED} -e 's/\
1070e98dc4aSKris Buschelman//g'  > /dev/null; foobar=$$?; \
108a2d9a622SKris Buschelman          if [ "$$foobar" = "0" ]; then \
109a2d9a622SKris Buschelman	    cat MINFO_ | ${SED} -e 's/\
110a2d9a622SKris Buschelman//g' > ${MINFO}; \
111f194edaeSKris Buschelman          else cat MINFO | ${SED} -e 's/\^M//g' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}; \
112ce0f4ea0SKris Buschelman          fi
1133677444aSSatish Balay	-@$(RM) MINFO MINFO_
114fa527775SLois Curfman McInnes
115fa527775SLois Curfman McInnes#
116f6a9982fSBarry Smith# Builds the PETSc libraries
1173677444aSSatish Balay# This target also builds fortran77 and f90 interface
118f6a9982fSBarry Smith# files and compiles .F files
119efd74e9bSBarry Smith#
12047794344SBarry Smithbuild:
121ab901514SBarry Smith	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
122e5175200SBarry Smith	-@echo "========================================="
1230b3634f8SBarry Smith	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
12447794344SBarry Smith	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
12535ca7349SBarry Smith	-@echo "Completed building libraries"
1269d6c0ac5SBarry Smith	-@echo "========================================="
1278744090aSBarry Smith#
1282492ecdbSBarry Smith# Builds PETSc test examples for a given architecture
12904f117c6SBarry Smith#
130ab901514SBarry Smithtest:
131c53b3f23SSatish Balay	-@echo "Running test examples to verify correct installation"
13204f117c6SBarry Smith	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
1330ce59502SBarry Smith	@if [ "${FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
1342492ecdbSBarry Smith	-@echo "Completed test examples"
1353677444aSSatish Balay
1363677444aSSatish Balaytestexamples: info
1373677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
1383677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
139ab901514SBarry Smith	-@echo "machines some of the numbers may not match exactly."
1403677444aSSatish Balay	-@echo "========================================="
1413677444aSSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_1  tree
1422492ecdbSBarry Smith	-@echo "Completed compiling and running test examples"
1433677444aSSatish Balay	-@echo "========================================="
1443677444aSSatish Balaytestfortran: info
1453677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
1463677444aSSatish Balay	-@echo "========================================="
1473677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1483677444aSSatish Balay	-@echo "machines or the way Fortran formats numbers"
149770ba9b7SSatish Balay	-@echo "some of the results may not match exactly."
150ab901514SBarry Smith	-@echo "========================================="
1516d2f2efaSKris Buschelman	-@if [ "${FC}" != "" ]; then \
1526d2f2efaSKris Buschelman            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3 tree; \
1536d2f2efaSKris Buschelman            echo "Completed compiling and running Fortran test examples"; \
1544b5d664cSKris Buschelman          else \
1553677444aSSatish Balay            echo "Error: No FORTRAN compiler available"; \
1562492ecdbSBarry Smith          fi
15701c5c36fSSatish Balay	-@echo "========================================="
15801c5c36fSSatish Balaytestexamples_uni: info
15901c5c36fSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
16001c5c36fSSatish Balay	-@echo "Due to different numerical round-off on certain"
161ab901514SBarry Smith	-@echo "machines some of the numbers may not match exactly."
16201c5c36fSSatish Balay	-@echo "========================================="
16301c5c36fSSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_4  tree
1642492ecdbSBarry Smith	-@echo "Completed compiling and running uniprocessor test examples"
1653677444aSSatish Balay	-@echo "========================================="
1663677444aSSatish Balaytestfortran_uni: info
1673677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
1683677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
169770ba9b7SSatish Balay	-@echo "machines some of the numbers may not match exactly."
170ab901514SBarry Smith	-@echo "========================================="
1716d2f2efaSKris Buschelman	-@if [ "${FC}" != "" ]; then \
1726d2f2efaSKris Buschelman            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree; \
1736d2f2efaSKris Buschelman            echo "Completed compiling and running uniprocessor fortran test examples"; \
1744b5d664cSKris Buschelman          else \
1756d2f2efaSKris Buschelman            echo "Error: No FORTRAN compiler available"; \
1763677444aSSatish Balay          fi
177ad96cc0dSLois Curfman McInnes	-@
178f3eacedaSSatish Balay	-@echo "========================================="
1798c37ef55SBarry Smith
180e5175200SBarry Smith# Ranlib on the libraries
18161523587SBarry Smithranlib:
18211b6ed10SLois Curfman McInnes	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
1832492ecdbSBarry Smith
184b87434adSSatish Balay# Deletes PETSc libraries
185d44968ceSBarry Smithdeletelibs:
186a42cec9dSMatthew Knepley	-${RM} -f ${PETSC_LIB_DIR}/*
187a42cec9dSMatthew Knepley
188ab901514SBarry Smith# Cleans up build
189a42cec9dSMatthew Knepleyallclean: deletelibs
1903677444aSSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
1914918a6b0SSatish Balay
1924918a6b0SSatish Balay
1934918a6b0SSatish Balay#
1944918a6b0SSatish Balay# Check if PETSC_DIR variable specified is valid
1954918a6b0SSatish Balay#
1961390f061SBarry Smithchk_petsc_dir:
1971390f061SBarry Smith	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
1981390f061SBarry Smith	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
1994918a6b0SSatish Balay	  echo "You need to use / to separate directories, not \\!"; \
20075910670SSatish Balay	  echo "Aborting build"; \
20175910670SSatish Balay	  false; fi
2023c94ec11SBarry Smith#
2030e98dc4aSKris Buschelman#
204fe0e97ccSBarry Smithinstall:
2053c94ec11SBarry Smith	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
2063c94ec11SBarry Smith	  echo "Install directory is current directory; nothing needs to be done";\
2073c94ec11SBarry Smith        else \
208de21bb36SSatish Balay	  echo Installing PETSc at ${INSTALL_DIR};\
2093c94ec11SBarry Smith          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
2103c94ec11SBarry Smith	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
211de21bb36SSatish Balay          fi;\
2123c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR} ]; then \
2133c94ec11SBarry Smith	    ${MKDIR} ${INSTALL_DIR} ; \
2143c94ec11SBarry Smith          fi;\
215de21bb36SSatish Balay          cp -fr include ${INSTALL_DIR};\
2163c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR}/bmake ]; then \
2173c94ec11SBarry Smith	    ${MKDIR} ${INSTALL_DIR}/bmake ; \
2183c94ec11SBarry Smith          fi;\
2193c94ec11SBarry Smith          cp -f bmake/adic* bmake/variables ${INSTALL_DIR}/bmake ; \
2203c94ec11SBarry Smith          cp -fr bmake/common ${INSTALL_DIR}/bmake;\
2213c94ec11SBarry Smith          cp -fr bmake/${PETSC_ARCH} ${INSTALL_DIR}/bmake;\
222de21bb36SSatish Balay          cp -fr bin ${INSTALL_DIR};\
2233c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR}/lib ]; then \
2243c94ec11SBarry Smith	    ${MKDIR} ${INSTALL_DIR}/lib ; \
2253c94ec11SBarry Smith          fi;\
226de21bb36SSatish Balay          for i in lib/lib*; do \
2273c94ec11SBarry Smith            if [ ! -d ${INSTALL_DIR}/$${i} ]; then \
2283c94ec11SBarry Smith              ${MKDIR} ${INSTALL_DIR}/$${i};\
2293c94ec11SBarry Smith            fi; \
2303c94ec11SBarry Smith            if [ -d $${i}/${PETSC_ARCH} ]; then \
231ab901514SBarry Smith              cp -fr $${i}/${PETSC_ARCH} ${INSTALL_DIR}/$${i};\
2323c94ec11SBarry Smith              ${RANLIB}  ${INSTALL_DIR}/$${i}/*.a > /dev/null 2>&1 ;\
2333c94ec11SBarry Smith              ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${INSTALL_DIR} shared; \
2343c94ec11SBarry Smith            fi;\
2353c94ec11SBarry Smith          done;\
236853b99e9SBarry Smith          echo "sh/bash: PETSC_DIR="${INSTALL_DIR}"; export PETSC_DIR";\
2373c94ec11SBarry Smith          echo "csh/tcsh: setenv PETSC_DIR "${INSTALL_DIR} ;\
2383c94ec11SBarry Smith          echo "Then do make test to verify correct install";\
2393c94ec11SBarry Smith        fi;
2400e98dc4aSKris Buschelman
2413c94ec11SBarry Smithinstall_src:
2423c94ec11SBarry Smith	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
2433c94ec11SBarry Smith	  echo "You did not set a directory to install to";\
2443c94ec11SBarry Smith        else \
245de21bb36SSatish Balay	  echo Installing PETSc source at ${INSTALL_DIR};\
2463c94ec11SBarry Smith          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
2473c94ec11SBarry Smith	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
248de21bb36SSatish Balay          fi;\
2493c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR} ]; then \
2503c94ec11SBarry Smith	    ${MKDIR} ${INSTALL_DIR} ; \
2513c94ec11SBarry Smith          fi;\
2523c94ec11SBarry Smith          cp -fr src ${INSTALL_DIR};\
2533c94ec11SBarry Smith        fi;
2540e98dc4aSKris Buschelman
2553c94ec11SBarry Smithinstall_docs:
2563c94ec11SBarry Smith	-@if [ "${INSTALL_DIR}" = "${PETSC_DIR}" ]; then \
2573c94ec11SBarry Smith	  echo "You did not set a directory to install to";\
2583c94ec11SBarry Smith        else \
259de21bb36SSatish Balay	  echo Installing PETSc documentation at ${INSTALL_DIR};\
2603c94ec11SBarry Smith          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
2613c94ec11SBarry Smith	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
262de21bb36SSatish Balay          fi;\
2633c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR} ]; then \
2643c94ec11SBarry Smith	    ${MKDIR} ${INSTALL_DIR} ; \
2653c94ec11SBarry Smith          fi;\
2663c94ec11SBarry Smith          cp -fr docs ${INSTALL_DIR};\
2673677444aSSatish Balay          ${RM} -fr docs/tex;\
2683677444aSSatish Balay        fi;
2693677444aSSatish Balay# ------------------------------------------------------------------
2703677444aSSatish Balay#
2713677444aSSatish Balay# All remaining actions are intended for PETSc developers only.
2723677444aSSatish Balay# PETSc users should not generally need to use these commands.
27365783a8cSBarry Smith#
27465783a8cSBarry Smith
27565783a8cSBarry Smith# To access the tags in EMACS, type M-x visit-tags-table and specify
27665783a8cSBarry Smith# the file petsc/TAGS.
27765783a8cSBarry Smith# 1) To move to where a PETSc function is defined, enter M-. and the
27865783a8cSBarry Smith#     function name.
2797acb7333SLois Curfman McInnes# 2) To search for a string and move to the first occurrence,
28011b6ed10SLois Curfman McInnes#     use M-x tags-search and the string.
28111b6ed10SLois Curfman McInnes#     To locate later occurrences, use M-,
282bfcd69bfSBarry Smith# Builds all etags files
2830c805e24SSatish Balayalletags:
2849d6c0ac5SBarry Smith	-@maint/generateetags.py
2859d6c0ac5SBarry Smith	-@find python -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
2869d6c0ac5SBarry Smith
287b38bb785SSatish Balayallfortranstubs:
288f20f7ba3SSatish Balay	-@maint/generatefortranstubs.py ${BFORT}
2893677444aSSatish Balay#
290b38bb785SSatish Balay# These are here for the target allci and allco, and etags
29140dd3bbbSBarry Smith#
2929e28597bSBarry Smith
293f587520bSBarry SmithBMAKEFILES = bmake/common/base bmake/common/test bmake/adic.init bmake/adicmf.init
294f587520bSBarry SmithDOCS	   = bmake/readme
29540dd3bbbSBarry SmithSCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/bugReport.py maint/buildconfigtest maint/builddistlite \
2962e111b49SBarry Smith             maint/buildtest maint/checkBuilds.py maint/copylognightly maint/copylognightly.tao maint/countfiles maint/findbadfiles \
2978a8e0b3aSBarry Smith             maint/fixinclude maint/getexlist maint/getpdflabels.py maint/helpindex.py maint/hosts.local maint/hosts.solaris  \
298f587520bSBarry Smith             maint/lex.py  maint/mapnameslatex.py maint/startnightly maint/startnightly.tao maint/submitPatch.py \
2999d6c0ac5SBarry Smith             maint/update-docs.py  maint/wwwindex.py maint/xcludebackup maint/xcludecblas maint/zap maint/zapall \
300d56c4d9fSBarry Smith             python/PETSc/Configure.py python/PETSc/Options.py \
301ad56a76cSSatish Balay             python/PETSc/packages/*.py python/PETSc/utilities/*.py
3020e98dc4aSKris Buschelman
303ad56a76cSSatish Balaychk_loc:
304ad56a76cSSatish Balay	@if [ ${LOC}foo = foo ] ; then \
305ad56a76cSSatish Balay	  echo "*********************** ERROR ************************" ; \
306de21bb36SSatish Balay	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
3072496ca06SSatish Balay	  echo "******************************************************";  false; fi
308a2fc510eSBarry Smith	@${MKDIR} ${LOC}/docs/manualpages
309f1d13e97SSatish Balay
310f1d13e97SSatish Balay# Builds all the documentation - should be done every night
311f1d13e97SSatish Balayalldoc: alldoc1 alldoc2
312f1d13e97SSatish Balay
313130c9832SBarry Smith# Build everything that goes into 'doc' dir except html sources
314ae6175c4SSatish Balayalldoc1: chk_loc deletemanualpages chk_concepts_dir
315130c9832SBarry Smith	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
31648b2c0e9SBarry Smith	cd src/docs/tex/manual; ${OMAKE} build_manual.pdf LOC=${LOC}
317e901ffdcSSatish Balay	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
318130c9832SBarry Smith	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
319e901ffdcSSatish Balay	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
320e901ffdcSSatish Balay	-${OMAKE} manconcepts LOC=${LOC}
32148b2c0e9SBarry Smith	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
322c714d2d0SBarry Smith	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
323eaa4f80dSBarry Smith	-maint/helpindex.py ${PETSC_DIR} ${LOC}
324e01137a2SSatish Balay	-grep -h Polymorphic include/*.h | grep -v '#define ' | sed "s?PetscPolymorphic[a-zA-Z]*(??g" | cut -f1 -d"{" > tmppoly
325435da068SBarry Smith	-maint/processpoly.py ${PETSC_DIR} ${LOC}
326062da8f7SSatish Balay
327f1d13e97SSatish Balay# Builds .html versions of the source
3283a2060ecSSatish Balay# html overwrites some stuff created by update-docs - hence this is done later.
329f95977b4SBarry Smithalldoc2: chk_loc
330435da068SBarry Smith	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
331efaa7783SSatish Balay	-maint/update-docs.py ${PETSC_DIR} ${LOC}
332efaa7783SSatish Balay
333efaa7783SSatish Balayalldocclean: deletemanualpages allcleanhtml
334efaa7783SSatish Balay
3351c2a3de1SBarry Smith# Deletes man pages (HTML version)
3361c2a3de1SBarry Smithdeletemanualpages: chk_loc
337f587520bSBarry Smith	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
338f587520bSBarry Smith          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
3391c2a3de1SBarry Smith          ${RM} ${LOC}/docs/exampleconcepts ;\
340f95977b4SBarry Smith          ${RM} ${LOC}/docs/manconcepts ;\
3411c2a3de1SBarry Smith          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
342efaa7783SSatish Balay          maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
343115a300dSBarry Smith        fi
3442d156eb4SBarry Smith
345cc4dcc40SBarry Smithallcleanhtml:
346395565bcSBarry Smith	-${RM} include/adic/*.h.html
347ad56a76cSSatish Balay	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
348fe742e3dSSatish Balay
349bfe54af3SSatish Balaychk_concepts_dir: chk_loc
350bdde29a3SBarry Smith	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
351f6ff2982SSatish Balay	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
352d55938c2SBarry Smith#
353ab901514SBarry Smith
354b951964fSBarry Smithallci:
355d55938c2SBarry Smith	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
356ab901514SBarry Smith
357d55938c2SBarry Smithallco:
358791d64f4SSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
359791d64f4SSatish Balay
360ab901514SBarry Smith# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
361b334301eSBarry Smithallrcslabel:
362b334301eSBarry Smith	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
363b334301eSBarry Smith#
364b334301eSBarry Smith#   The commands below are for generating ADIC versions of the code;
3655eea60f9SBarry Smith# they are not currently used.
366b87434adSSatish Balay#
367ab901514SBarry Smithalladicignore:
3685eea60f9SBarry Smith	-@${RM} ${INSTALL_LIB_DIR}/adicignore
3695eea60f9SBarry Smith	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
370d18b0ea7SBarry Smith
37167b024f7SSatish Balayalladic:
372d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC source code in all directories"
37347794344SBarry Smith	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
37467b024f7SSatish Balay	-@echo "========================================="
375ab901514SBarry Smith	-@cd include ; \
37647794344SBarry Smith           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
377ab901514SBarry Smith	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
3786e81b665SBarry Smith	-@cd src/inline ; \
37947794344SBarry Smith            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} adic
380d18b0ea7SBarry Smith
381d77bb2e1SSatish Balayalladiclib:
382d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC libraries in all directories"
383d77bb2e1SSatish Balay	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
384d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
385e0e703c1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
386ba1077baSMatthew Knepley	-@echo "-----------------------------------------"
387d18b0ea7SBarry Smith	-@echo "Using configuration flags:"
388d77bb2e1SSatish Balay	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
389d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
390d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
39119552e71SMatthew Knepley	-@echo "-----------------------------------------"
392d18b0ea7SBarry Smith	-@echo "Using PETSc directory: ${PETSC_DIR}"
393e5175200SBarry Smith	-@echo "Using PETSc arch: ${PETSC_ARCH}"
394ab901514SBarry Smith	-@echo "========================================="
3957e351921SBarry Smith	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${AR_LIB_SUFFIX}
396ab901514SBarry Smith	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
3975eea60f9SBarry Smith	-@cd src/adic/src ; \
3989e417c50SSatish Balay            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} lib
3999e417c50SSatish Balay
4009e417c50SSatish Balay# -------------------------------------------------------------------------------
4019e417c50SSatish Balay#
4029e417c50SSatish Balay# Some macros to check if the fortran interface is up-to-date.
403d77bb2e1SSatish Balay#
40485c7cd6cSSatish Balaycountfortranfunctions:
4059e417c50SSatish Balay	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
406b334301eSBarry Smith	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
4079e417c50SSatish Balay	sed "s/_$$//" | sort > /tmp/countfortranfunctions
40885c7cd6cSSatish Balay
40985c7cd6cSSatish Balaycountcfunctions:
4109e417c50SSatish Balay	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
4119e417c50SSatish Balay	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
4129e417c50SSatish Balay	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
4139e417c50SSatish Balay
4149700b7f8SSatish Balaydifffortranfunctions: countfortranfunctions countcfunctions
4159e417c50SSatish Balay	-@echo -------------- Functions missing in the fortran interface ---------------------
4169700b7f8SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
417d77bb2e1SSatish Balay	-@echo ----------------- Functions missing in the C interface ------------------------
418b334301eSBarry Smith	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
4193f4c9a3aSSatish Balay	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
4203f4c9a3aSSatish Balay
4213f4c9a3aSSatish Balaycheckbadfortranstubs:
4223f4c9a3aSSatish Balay	-@echo "========================================="
423d77bb2e1SSatish Balay	-@echo "Functions with MPI_Comm as an Argument"
42485c7cd6cSSatish Balay	-@echo "========================================="
4253f4c9a3aSSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
4263f4c9a3aSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4273f4c9a3aSSatish Balay	-@echo "========================================="
428d77bb2e1SSatish Balay	-@echo "Functions with a String as an Argument"
42985c7cd6cSSatish Balay	-@echo "========================================="
4303f4c9a3aSSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
4313f4c9a3aSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4323f4c9a3aSSatish Balay	-@echo "========================================="
433d77bb2e1SSatish Balay	-@echo "Functions with Pointers to PETSc Objects as Argument"
43485c7cd6cSSatish Balay	-@echo "========================================="
43585c7cd6cSSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; \
4363f4c9a3aSSatish Balay	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
4373f4c9a3aSSatish Balay	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
43885c7cd6cSSatish Balay	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
4393f4c9a3aSSatish Balay	for OBJ in $$_p_OBJ; do \
4403f4c9a3aSSatish Balay	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
4414556b810SBarry Smith	cut -d'(' -f1 | cut -d' ' -f1,3; \
4424556b810SBarry Smith	done
443b6ea66eeSBarry Smith#
44475df30afSSatish Balay# Automatically generates PETSc exercises in html from the tutorial examples.
445b6ea66eeSBarry Smith#
446b6ea66eeSBarry Smith# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
447b6ea66eeSBarry Smith#  (used also in introductions to the manual pages)
448b6ea66eeSBarry Smith# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
4494556b810SBarry Smith# The list of exercises is from TUTORIALS in each directory's makefile
4504556b810SBarry Smith#
4514556b810SBarry Smith# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
452843ae28eSBarry Smith# The pagemaker rule is in the file bmake/common (at the bottom)
45397e8d271SBarry Smith#
454843ae28eSBarry Smith# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
45597e8d271SBarry Smith#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
45697e8d271SBarry Smith#
45797e8d271SBarry Smithexercises:
458467fbd6dSBarry Smith	-@echo "========================================="
45997e8d271SBarry Smith	-@echo "Generating HTML tutorial exercises"
46097e8d271SBarry Smith	-@${RM} docs/pageform.txt
461beb1b3a5SBarry Smith	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
46297e8d271SBarry Smith	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
46397e8d271SBarry Smith	-@echo "access_format=short"                        >> docs/pageform.txt
46497e8d271SBarry Smith	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
46597e8d271SBarry Smith	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
466beb1b3a5SBarry Smith	-@echo "Generating HTML for individual directories"
46797e8d271SBarry Smith	-@echo "========================================="
46897e8d271SBarry Smith	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
46997e8d271SBarry Smith	-@echo "Completed HTML for individual directories"
47097e8d271SBarry Smith	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
47197e8d271SBarry Smith	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
47297e8d271SBarry Smith	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
473b4b3a923SMatthew Knepley	-@echo "========================================="
474b4b3a923SMatthew Knepley
475b4b3a923SMatthew Knepley# Make a tarball of all the Python code
476b4b3a923SMatthew Knepley#   This is currently used to release to the Teragrid
477b4b3a923SMatthew KnepleypetscPython.tgz:
478b4b3a923SMatthew Knepley	@tar cvzf $@ --exclude SCCS --exclude BitKeeper --dereference python/
4798852b4e5SMatthew Knepley	-@scp $@ tg-login2.uc.teragrid.org:./
480de21bb36SSatish Balay
4819d6c0ac5SBarry Smith.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
482b4b3a923SMatthew Knepley        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
483f7819401SBarry Smith        allhtml allcleanhtml  allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
484        start_configure configure_petsc configure_clean petscPython.tgz
485
486