xref: /petsc/makefile (revision 0c805e247a5ea9269fd2acd3204e3e75ec3df176)
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}
19b5d30489SBarry Smithall_build: chk_petsc_dir chklib_dir info info_h deletelibs  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 "-----------------------------------------"
38e481929fSSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
39e481929fSSatish Balay	-@echo "Using PETSc arch: ${PETSC_ARCH}"
4047794344SBarry Smith	-@echo "-----------------------------------------"
41bdd8b494SSatish Balay	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
42f265ae5cSBarry Smith	-@echo "-----------------------------------------"
43e0e703c1SSatish Balay	-@echo "Using configuration flags:"
4419552e71SMatthew Knepley	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
4547794344SBarry Smith	-@echo "-----------------------------------------"
46d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
47e481929fSSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
48efd74e9bSBarry Smith	-@echo "------------------------------------------"
49abc0a331SBarry Smith	-@echo "Using C/C++ compiler: ${CC} ${COPTFLAGS} ${CPPFLAGS}"
50e481929fSSatish Balay	-@echo "C/C++ Compiler version: " `${CCV}`
51e481929fSSatish Balay	-@if [ "${FC}" != "" ]; then \
52abc0a331SBarry Smith	   echo "Using Fortran compiler: ${FC} ${FOPTFLAGS} ${FPPFLAGS}";\
53e481929fSSatish Balay	   echo "Fortran Compiler version: " `${FCV}`;\
54e481929fSSatish Balay         fi
55e481929fSSatish Balay	-@echo "-----------------------------------------"
56abc0a331SBarry Smith	-@echo "Using C/C++ linker: ${CC_LINKER}"
57e481929fSSatish Balay	-@if [ "${FC}" != "" ]; then \
58abc0a331SBarry Smith	   echo "Using Fortran linker: ${FC_LINKER}";\
59e6ee457dSBarry Smith         fi
60e481929fSSatish Balay	-@echo "-----------------------------------------"
61f2b01315SBarry Smith	-@echo "Using libraries: ${PETSC_LIB}"
62e3353558SSatish Balay	-@echo "------------------------------------------"
63e3353558SSatish Balay	-@echo "Using mpirun: ${MPIRUN}"
64efd74e9bSBarry Smith	-@echo "=========================================="
65b8d81f61SBarry Smith#
66b8d81f61SBarry Smith#
6719552e71SMatthew KnepleyMINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
68b8d81f61SBarry Smithinfo_h:
69ddbfe947SBarry Smith	-@$(RM) -f MINFO ${MINFO}
702fc52814SBarry Smith	-@echo  "static const char *petscmachineinfo = \"  " >> MINFO
7134a92de5SBarry Smith	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
72c5e9c7dfSBarry Smith	-@echo  Machine characteristics: `uname -a` "" >> MINFO
73f6a9982fSBarry Smith	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
7419552e71SMatthew Knepley	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
7593520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
762fc52814SBarry Smith	-@echo  "static const char *petsccompilerinfo = \"  " >> MINFO
77abc0a331SBarry Smith	-@echo  "Using C compiler: ${CC} ${COPTFLAGS} ${CCPPFLAGS} " >> MINFO
78dffd13fbSMatthew Knepley	-@echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1 ; true
79dffd13fbSMatthew Knepley	-@echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; true
80abc0a331SBarry Smith	-@echo  "Using Fortran compiler: ${FC} ${FOPTFLAGS} ${FCPPFLAGS}" >> MINFO
81770ba9b7SSatish Balay	-@echo  "Fortran Compiler version:" >> MINFO ; ${FCV} >> MINFO 2>&1 ; true
8293520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
832fc52814SBarry Smith	-@echo  "static const char *petsccompilerflagsinfo = \"  " >> MINFO
84c5e9c7dfSBarry Smith	-@echo  "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" >> MINFO
85c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
86c5e9c7dfSBarry Smith	-@echo  "Using configuration flags:" >> MINFO
87c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
88c5e9c7dfSBarry Smith	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
8993520af8SSatish Balay	-@echo  "------------------------------------------\"; " >> MINFO
902fc52814SBarry Smith	-@echo  "static const char *petsclinkerinfo = \"  " >> MINFO
91c5e9c7dfSBarry Smith	-@echo  "Using C linker: ${CLINKER}" >> MINFO
92c5e9c7dfSBarry Smith	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
9393520af8SSatish Balay	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
94a2d9a622SKris Buschelman	-@cat MINFO | ${SED} -e 's/\^M//g' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> MINFO_
95aa0c092eSKris Buschelman	-@cat MINFO_ | ${SED} -e 's/\
96aa0c092eSKris Buschelman//g'  > /dev/null; foobar=$$?; \
97a2d9a622SKris Buschelman          if [ "$$foobar" = "0" ]; then \
98a2d9a622SKris Buschelman	    cat MINFO_ | ${SED} -e 's/\
99a2d9a622SKris Buschelman//g' > ${MINFO}; \
100f194edaeSKris Buschelman          else cat MINFO | ${SED} -e 's/\^M//g' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}; \
101ce0f4ea0SKris Buschelman          fi
1023677444aSSatish Balay	-@$(RM) MINFO MINFO_
103fa527775SLois Curfman McInnes
104fa527775SLois Curfman McInnes#
105f6a9982fSBarry Smith# Builds the PETSc libraries
1063677444aSSatish Balay# This target also builds fortran77 and f90 interface
107f6a9982fSBarry Smith# files and compiles .F files
108efd74e9bSBarry Smith#
10947794344SBarry Smithbuild:
110ab901514SBarry Smith	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
111e5175200SBarry Smith	-@echo "========================================="
1120b3634f8SBarry Smith	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
11347794344SBarry Smith	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
11435ca7349SBarry Smith	-@echo "Completed building libraries"
1159d6c0ac5SBarry Smith	-@echo "========================================="
1168744090aSBarry Smith#
1172492ecdbSBarry Smith# Builds PETSc test examples for a given architecture
11804f117c6SBarry Smith#
119ab901514SBarry Smithtest:
120c53b3f23SSatish Balay	-@echo "Running test examples to verify correct installation"
12104f117c6SBarry Smith	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
1220ce59502SBarry Smith	@if [ "${FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
1232492ecdbSBarry Smith	-@echo "Completed test examples"
1243677444aSSatish Balay
1253677444aSSatish Balaytestexamples: info
1263677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
1273677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
128ab901514SBarry Smith	-@echo "machines some of the numbers may not match exactly."
1293677444aSSatish Balay	-@echo "========================================="
1303677444aSSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_1  tree
1312492ecdbSBarry Smith	-@echo "Completed compiling and running test examples"
1323677444aSSatish Balay	-@echo "========================================="
1333677444aSSatish Balaytestfortran: info
1343677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
1353677444aSSatish Balay	-@echo "========================================="
1363677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1373677444aSSatish Balay	-@echo "machines or the way Fortran formats numbers"
138770ba9b7SSatish Balay	-@echo "some of the results may not match exactly."
139ab901514SBarry Smith	-@echo "========================================="
1406d2f2efaSKris Buschelman	-@if [ "${FC}" != "" ]; then \
1416d2f2efaSKris Buschelman            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3 tree; \
1426d2f2efaSKris Buschelman            echo "Completed compiling and running Fortran test examples"; \
1434b5d664cSKris Buschelman          else \
1443677444aSSatish Balay            echo "Error: No FORTRAN compiler available"; \
1452492ecdbSBarry Smith          fi
14601c5c36fSSatish Balay	-@echo "========================================="
14701c5c36fSSatish Balaytestexamples_uni: info
14801c5c36fSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
14901c5c36fSSatish Balay	-@echo "Due to different numerical round-off on certain"
150ab901514SBarry Smith	-@echo "machines some of the numbers may not match exactly."
15101c5c36fSSatish Balay	-@echo "========================================="
15201c5c36fSSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_4  tree
1532492ecdbSBarry Smith	-@echo "Completed compiling and running uniprocessor test examples"
1543677444aSSatish Balay	-@echo "========================================="
1553677444aSSatish Balaytestfortran_uni: info
1563677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
1573677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
158770ba9b7SSatish Balay	-@echo "machines some of the numbers may not match exactly."
159ab901514SBarry Smith	-@echo "========================================="
1606d2f2efaSKris Buschelman	-@if [ "${FC}" != "" ]; then \
1616d2f2efaSKris Buschelman            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree; \
1626d2f2efaSKris Buschelman            echo "Completed compiling and running uniprocessor fortran test examples"; \
1634b5d664cSKris Buschelman          else \
1646d2f2efaSKris Buschelman            echo "Error: No FORTRAN compiler available"; \
1653677444aSSatish Balay          fi
166ad96cc0dSLois Curfman McInnes	-@
167f3eacedaSSatish Balay	-@echo "========================================="
1688c37ef55SBarry Smith
169e5175200SBarry Smith# Ranlib on the libraries
17061523587SBarry Smithranlib:
17111b6ed10SLois Curfman McInnes	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
1722492ecdbSBarry Smith
173b87434adSSatish Balay# Deletes PETSc libraries
174d44968ceSBarry Smithdeletelibs:
175a42cec9dSMatthew Knepley	-${RM} -f ${PETSC_LIB_DIR}/*
176a42cec9dSMatthew Knepley
177ab901514SBarry Smith# Cleans up build
178a42cec9dSMatthew Knepleyallclean: deletelibs
1793677444aSSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
1804918a6b0SSatish Balay
1814918a6b0SSatish Balay
1824918a6b0SSatish Balay#
1834918a6b0SSatish Balay# Check if PETSC_DIR variable specified is valid
1844918a6b0SSatish Balay#
1851390f061SBarry Smithchk_petsc_dir:
1861390f061SBarry Smith	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
1871390f061SBarry Smith	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
1884918a6b0SSatish Balay	  echo "You need to use / to separate directories, not \\!"; \
18975910670SSatish Balay	  echo "Aborting build"; \
19075910670SSatish Balay	  false; fi
1913c94ec11SBarry Smith#
1923c94ec11SBarry Smith#
193fe0e97ccSBarry Smithinstall:
1943c94ec11SBarry Smith	-@if [ "${INSTALL_DIR}" == "${PETSC_DIR}" ]; then \
1953c94ec11SBarry Smith	  echo "Install directory is current directory; nothing needs to be done";\
1963c94ec11SBarry Smith        else \
197de21bb36SSatish Balay	  echo Installing PETSc at ${INSTALL_DIR};\
1983c94ec11SBarry Smith          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
1993c94ec11SBarry Smith	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
200de21bb36SSatish Balay          fi;\
2013c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR} ]; then \
2023c94ec11SBarry Smith	    ${MKDIR} ${INSTALL_DIR} ; \
2033c94ec11SBarry Smith          fi;\
204de21bb36SSatish Balay          cp -fr include ${INSTALL_DIR};\
2053c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR}/bmake ]; then \
2063c94ec11SBarry Smith	    ${MKDIR} ${INSTALL_DIR}/bmake ; \
2073c94ec11SBarry Smith          fi;\
2083c94ec11SBarry Smith          cp -f bmake/adic* bmake/variables ${INSTALL_DIR}/bmake ; \
2093c94ec11SBarry Smith          cp -fr bmake/common ${INSTALL_DIR}/bmake;\
2103c94ec11SBarry Smith          cp -fr bmake/${PETSC_ARCH} ${INSTALL_DIR}/bmake;\
211de21bb36SSatish Balay          cp -fr bin ${INSTALL_DIR};\
2123c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR}/lib ]; then \
2133c94ec11SBarry Smith	    ${MKDIR} ${INSTALL_DIR}/lib ; \
2143c94ec11SBarry Smith          fi;\
215de21bb36SSatish Balay          for i in lib/lib*; do \
2163c94ec11SBarry Smith            if [ ! -d ${INSTALL_DIR}/$${i} ]; then \
2173c94ec11SBarry Smith              ${MKDIR} ${INSTALL_DIR}/$${i};\
2183c94ec11SBarry Smith            fi; \
2193c94ec11SBarry Smith            if [ -d $${i}/${PETSC_ARCH} ]; then \
220ab901514SBarry Smith              cp -fr $${i}/${PETSC_ARCH} ${INSTALL_DIR}/$${i};\
2213c94ec11SBarry Smith              ${RANLIB}  ${INSTALL_DIR}/$${i}/*.a > /dev/null 2>&1 ;\
2223c94ec11SBarry Smith              ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${INSTALL_DIR} shared; \
2233c94ec11SBarry Smith            fi;\
2243c94ec11SBarry Smith          done;\
2253c94ec11SBarry Smith          echo "sh/bash: PETSC_DIR="${INSTALL_DIR}"; export PETSC_DIR";\
2263c94ec11SBarry Smith          echo "csh/tcsh: setenv PETSC_DIR "${INSTALL_DIR} ;\
2273c94ec11SBarry Smith          echo "The do make test to verify correct install";\
2283c94ec11SBarry Smith        fi;
2293c94ec11SBarry Smith
2303c94ec11SBarry Smithinstall_src:
2313c94ec11SBarry Smith	-@if [ "${INSTALL_DIR}" == "${PETSC_DIR}" ]; then \
2323c94ec11SBarry Smith	  echo "You did not set a directory to install to";\
2333c94ec11SBarry Smith        else \
234de21bb36SSatish Balay	  echo Installing PETSc source at ${INSTALL_DIR};\
2353c94ec11SBarry Smith          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
2363c94ec11SBarry Smith	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
237de21bb36SSatish Balay          fi;\
2383c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR} ]; then \
2393c94ec11SBarry Smith	    ${MKDIR} ${INSTALL_DIR} ; \
2403c94ec11SBarry Smith          fi;\
2413c94ec11SBarry Smith          cp -fr src ${INSTALL_DIR};\
2423c94ec11SBarry Smith        fi;
2433c94ec11SBarry Smith
2443c94ec11SBarry Smithinstall_docs:
2453c94ec11SBarry Smith	-@if [ "${INSTALL_DIR}" == "${PETSC_DIR}" ]; then \
2463c94ec11SBarry Smith	  echo "You did not set a directory to install to";\
2473c94ec11SBarry Smith        else \
248de21bb36SSatish Balay	  echo Installing PETSc documentation at ${INSTALL_DIR};\
2493c94ec11SBarry Smith          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
2503c94ec11SBarry Smith	    ${MKDIR} `dirname ${INSTALL_DIR}` ; \
251de21bb36SSatish Balay          fi;\
2523c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR} ]; then \
2533c94ec11SBarry Smith	    ${MKDIR} ${INSTALL_DIR} ; \
2543c94ec11SBarry Smith          fi;\
2553c94ec11SBarry Smith          cp -fr docs ${INSTALL_DIR};\
2563677444aSSatish Balay          ${RM} -fr docs/tex;\
2573677444aSSatish Balay        fi;
2583677444aSSatish Balay# ------------------------------------------------------------------
2593677444aSSatish Balay#
2603677444aSSatish Balay# All remaining actions are intended for PETSc developers only.
2613677444aSSatish Balay# PETSc users should not generally need to use these commands.
26265783a8cSBarry Smith#
26365783a8cSBarry Smith
26465783a8cSBarry Smith# To access the tags in EMACS, type M-x visit-tags-table and specify
26565783a8cSBarry Smith# the file petsc/TAGS.
26665783a8cSBarry Smith# 1) To move to where a PETSc function is defined, enter M-. and the
26765783a8cSBarry Smith#     function name.
2687acb7333SLois Curfman McInnes# 2) To search for a string and move to the first occurrence,
26911b6ed10SLois Curfman McInnes#     use M-x tags-search and the string.
27011b6ed10SLois Curfman McInnes#     To locate later occurrences, use M-,
271bfcd69bfSBarry Smith# Builds all etags files
272*0c805e24SSatish Balayalletags:
2739d6c0ac5SBarry Smith	-@maint/generateetags.py
2749d6c0ac5SBarry Smith	-@find python -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
2759d6c0ac5SBarry Smith
276b38bb785SSatish Balayallfortranstubs:
277f20f7ba3SSatish Balay	-@maint/generatefortranstubs.py ${BFORT}
2783677444aSSatish Balay#
279b38bb785SSatish Balay# These are here for the target allci and allco, and etags
28040dd3bbbSBarry Smith#
2819e28597bSBarry Smith
282f587520bSBarry SmithBMAKEFILES = bmake/common/base bmake/common/test bmake/adic.init bmake/adicmf.init
283f587520bSBarry SmithDOCS	   = bmake/readme
28440dd3bbbSBarry SmithSCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/bugReport.py maint/buildconfigtest maint/builddistlite \
2852e111b49SBarry Smith             maint/buildtest maint/checkBuilds.py maint/copylognightly maint/copylognightly.tao maint/countfiles maint/findbadfiles \
2868a8e0b3aSBarry Smith             maint/fixinclude maint/getexlist maint/getpdflabels.py maint/helpindex.py maint/hosts.local maint/hosts.solaris  \
287f587520bSBarry Smith             maint/lex.py  maint/mapnameslatex.py maint/startnightly maint/startnightly.tao maint/submitPatch.py \
2889d6c0ac5SBarry Smith             maint/update-docs.py  maint/wwwindex.py maint/xcludebackup maint/xcludecblas maint/zap maint/zapall \
289d56c4d9fSBarry Smith             python/PETSc/Configure.py python/PETSc/Options.py \
290ad56a76cSSatish Balay             python/PETSc/packages/*.py python/PETSc/utilities/*.py
291ad56a76cSSatish Balay
292ad56a76cSSatish Balaychk_loc:
293ad56a76cSSatish Balay	@if [ ${LOC}foo = foo ] ; then \
294ad56a76cSSatish Balay	  echo "*********************** ERROR ************************" ; \
295de21bb36SSatish Balay	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
2962496ca06SSatish Balay	  echo "******************************************************";  false; fi
297a2fc510eSBarry Smith	@${MKDIR} ${LOC}/docs/manualpages
298f1d13e97SSatish Balay
299f1d13e97SSatish Balay# Builds all the documentation - should be done every night
300f1d13e97SSatish Balayalldoc: alldoc1 alldoc2
301f1d13e97SSatish Balay
302130c9832SBarry Smith# Build everything that goes into 'doc' dir except html sources
303ae6175c4SSatish Balayalldoc1: chk_loc deletemanualpages chk_concepts_dir
304130c9832SBarry Smith	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
30548b2c0e9SBarry Smith	cd src/docs/tex/manual; ${OMAKE} build_manual.pdf LOC=${LOC}
306e901ffdcSSatish Balay	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
307130c9832SBarry Smith	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
308e901ffdcSSatish Balay	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
309e901ffdcSSatish Balay	-${OMAKE} manconcepts LOC=${LOC}
31048b2c0e9SBarry Smith	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
311e01137a2SSatish Balay	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
312435da068SBarry Smith	-maint/helpindex.py ${PETSC_DIR} ${LOC}
313062da8f7SSatish Balay
314f1d13e97SSatish Balay# Builds .html versions of the source
3153a2060ecSSatish Balay# html overwrites some stuff created by update-docs - hence this is done later.
316f95977b4SBarry Smithalldoc2: chk_loc
317435da068SBarry Smith	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
318efaa7783SSatish Balay	-maint/update-docs.py ${PETSC_DIR} ${LOC}
319efaa7783SSatish Balay
320efaa7783SSatish Balayalldocclean: deletemanualpages allcleanhtml
321efaa7783SSatish Balay
3221c2a3de1SBarry Smith# Deletes man pages (HTML version)
3231c2a3de1SBarry Smithdeletemanualpages: chk_loc
324f587520bSBarry Smith	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
325f587520bSBarry Smith          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
3261c2a3de1SBarry Smith          ${RM} ${LOC}/docs/exampleconcepts ;\
327f95977b4SBarry Smith          ${RM} ${LOC}/docs/manconcepts ;\
3281c2a3de1SBarry Smith          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
329efaa7783SSatish Balay          maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
330115a300dSBarry Smith        fi
3312d156eb4SBarry Smith
332cc4dcc40SBarry Smithallcleanhtml:
333395565bcSBarry Smith	-${RM} include/adic/*.h.html
334ad56a76cSSatish Balay	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
335fe742e3dSSatish Balay
336bfe54af3SSatish Balaychk_concepts_dir: chk_loc
337bdde29a3SBarry Smith	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
338f6ff2982SSatish Balay	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
339d55938c2SBarry Smith#
340ab901514SBarry Smith
341b951964fSBarry Smithallci:
342d55938c2SBarry Smith	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
343ab901514SBarry Smith
344d55938c2SBarry Smithallco:
345791d64f4SSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
346791d64f4SSatish Balay
347ab901514SBarry Smith# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
348b334301eSBarry Smithallrcslabel:
349b334301eSBarry Smith	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
350b334301eSBarry Smith#
351b334301eSBarry Smith#   The commands below are for generating ADIC versions of the code;
3525eea60f9SBarry Smith# they are not currently used.
353b87434adSSatish Balay#
354ab901514SBarry Smithalladicignore:
3555eea60f9SBarry Smith	-@${RM} ${INSTALL_LIB_DIR}/adicignore
3565eea60f9SBarry Smith	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
357d18b0ea7SBarry Smith
35867b024f7SSatish Balayalladic:
359d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC source code in all directories"
36047794344SBarry Smith	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
36167b024f7SSatish Balay	-@echo "========================================="
362ab901514SBarry Smith	-@cd include ; \
36347794344SBarry Smith           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
364ab901514SBarry Smith	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
3656e81b665SBarry Smith	-@cd src/inline ; \
36647794344SBarry Smith            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} adic
367d18b0ea7SBarry Smith
368d77bb2e1SSatish Balayalladiclib:
369d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC libraries in all directories"
370d77bb2e1SSatish Balay	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
371d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
372e0e703c1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
373ba1077baSMatthew Knepley	-@echo "-----------------------------------------"
374d18b0ea7SBarry Smith	-@echo "Using configuration flags:"
375d77bb2e1SSatish Balay	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
376d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
377d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
37819552e71SMatthew Knepley	-@echo "-----------------------------------------"
379d18b0ea7SBarry Smith	-@echo "Using PETSc directory: ${PETSC_DIR}"
380e5175200SBarry Smith	-@echo "Using PETSc arch: ${PETSC_ARCH}"
381ab901514SBarry Smith	-@echo "========================================="
3827e351921SBarry Smith	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${AR_LIB_SUFFIX}
383ab901514SBarry Smith	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
3845eea60f9SBarry Smith	-@cd src/adic/src ; \
3859e417c50SSatish Balay            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} lib
3869e417c50SSatish Balay
3879e417c50SSatish Balay# -------------------------------------------------------------------------------
3889e417c50SSatish Balay#
3899e417c50SSatish Balay# Some macros to check if the fortran interface is up-to-date.
390d77bb2e1SSatish Balay#
39185c7cd6cSSatish Balaycountfortranfunctions:
3929e417c50SSatish Balay	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
393b334301eSBarry Smith	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
3949e417c50SSatish Balay	sed "s/_$$//" | sort > /tmp/countfortranfunctions
39585c7cd6cSSatish Balay
39685c7cd6cSSatish Balaycountcfunctions:
3979e417c50SSatish Balay	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
3989e417c50SSatish Balay	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
3999e417c50SSatish Balay	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
4009e417c50SSatish Balay
4019700b7f8SSatish Balaydifffortranfunctions: countfortranfunctions countcfunctions
4029e417c50SSatish Balay	-@echo -------------- Functions missing in the fortran interface ---------------------
4039700b7f8SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
404d77bb2e1SSatish Balay	-@echo ----------------- Functions missing in the C interface ------------------------
405b334301eSBarry Smith	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
4063f4c9a3aSSatish Balay	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
4073f4c9a3aSSatish Balay
4083f4c9a3aSSatish Balaycheckbadfortranstubs:
4093f4c9a3aSSatish Balay	-@echo "========================================="
410d77bb2e1SSatish Balay	-@echo "Functions with MPI_Comm as an Argument"
41185c7cd6cSSatish Balay	-@echo "========================================="
4123f4c9a3aSSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
4133f4c9a3aSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4143f4c9a3aSSatish Balay	-@echo "========================================="
415d77bb2e1SSatish Balay	-@echo "Functions with a String as an Argument"
41685c7cd6cSSatish Balay	-@echo "========================================="
4173f4c9a3aSSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
4183f4c9a3aSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4193f4c9a3aSSatish Balay	-@echo "========================================="
420d77bb2e1SSatish Balay	-@echo "Functions with Pointers to PETSc Objects as Argument"
42185c7cd6cSSatish Balay	-@echo "========================================="
42285c7cd6cSSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; \
4233f4c9a3aSSatish Balay	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
4243f4c9a3aSSatish Balay	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
42585c7cd6cSSatish Balay	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
4263f4c9a3aSSatish Balay	for OBJ in $$_p_OBJ; do \
4273f4c9a3aSSatish Balay	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
4284556b810SBarry Smith	cut -d'(' -f1 | cut -d' ' -f1,3; \
4294556b810SBarry Smith	done
430b6ea66eeSBarry Smith#
43175df30afSSatish Balay# Automatically generates PETSc exercises in html from the tutorial examples.
432b6ea66eeSBarry Smith#
433b6ea66eeSBarry Smith# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
434b6ea66eeSBarry Smith#  (used also in introductions to the manual pages)
435b6ea66eeSBarry Smith# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
4364556b810SBarry Smith# The list of exercises is from TUTORIALS in each directory's makefile
4374556b810SBarry Smith#
4384556b810SBarry Smith# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
439843ae28eSBarry Smith# The pagemaker rule is in the file bmake/common (at the bottom)
44097e8d271SBarry Smith#
441843ae28eSBarry Smith# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
44297e8d271SBarry Smith#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
44397e8d271SBarry Smith#
44497e8d271SBarry Smithexercises:
445467fbd6dSBarry Smith	-@echo "========================================="
44697e8d271SBarry Smith	-@echo "Generating HTML tutorial exercises"
44797e8d271SBarry Smith	-@${RM} docs/pageform.txt
448beb1b3a5SBarry Smith	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
44997e8d271SBarry Smith	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
45097e8d271SBarry Smith	-@echo "access_format=short"                        >> docs/pageform.txt
45197e8d271SBarry Smith	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
45297e8d271SBarry Smith	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
453beb1b3a5SBarry Smith	-@echo "Generating HTML for individual directories"
45497e8d271SBarry Smith	-@echo "========================================="
45597e8d271SBarry Smith	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
45697e8d271SBarry Smith	-@echo "Completed HTML for individual directories"
45797e8d271SBarry Smith	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
45897e8d271SBarry Smith	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
45997e8d271SBarry Smith	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
460b4b3a923SMatthew Knepley	-@echo "========================================="
461b4b3a923SMatthew Knepley
462b4b3a923SMatthew Knepley# Make a tarball of all the Python code
463b4b3a923SMatthew Knepley#   This is currently used to release to the Teragrid
464b4b3a923SMatthew KnepleypetscPython.tgz:
465b4b3a923SMatthew Knepley	@tar cvzf $@ --exclude SCCS --exclude BitKeeper --dereference python/
4668852b4e5SMatthew Knepley	-@scp $@ tg-login2.uc.teragrid.org:./
467de21bb36SSatish Balay
4689d6c0ac5SBarry Smith.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
469b4b3a923SMatthew Knepley        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
470f7819401SBarry Smith        allhtml allcleanhtml  allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
471        start_configure configure_petsc configure_clean petscPython.tgz
472
473