xref: /petsc/makefile (revision e6ee457dd004bdfeadb95a03bb5822234d34a331)
173f4d377SMatthew Knepley# $Id: makefile,v 1.353 2001/08/28 19:43:38 balay Exp $
211b6ed10SLois Curfman McInnes#
3cfd69a58SBarry Smith# This is the makefile for installing PETSc. See the file
4ba3fcebfSBarry Smith# docs/website/documentation/installation.html for directions on installing PETSc.
5cfd69a58SBarry Smith# See also bmake/common for additional commands.
611b6ed10SLois Curfman McInnes#
7716b9c40SSatish BalayALL: all
848b2c0e9SBarry SmithLOCDIR = .
9b16a3bb1SBarry SmithDIRS   = src include docs
1061523587SBarry Smith
11516d1546SSatish Balayinclude ${PETSC_DIR}/bmake/common/base
12516d1546SSatish Balayinclude ${PETSC_DIR}/bmake/common/test
1361523587SBarry Smith
14ca5c9d59SMatthew Knepley#
153677444aSSatish Balay# Basic targets to build PETSc libraries.
16fa527775SLois Curfman McInnes# all: builds the c, fortran, and f90 libraries
17b5fa40b8SBarry Smithall:
18b5fa40b8SBarry Smith	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} BOPT=${BOPT} chkpetsc_dir
1944ecba3fSMatthew Knepley	-@${MAKE} all_build 2>&1 | tee make_log_${PETSC_ARCH}_${BOPT}
20bdde29a3SBarry Smithall_build: chk_petsc_dir info info_h chklib_dir deletelibs chk_fortranstubs blaslapack mpich build shared
21efd74e9bSBarry Smith#
22fa527775SLois Curfman McInnes# Prints information about the system and version of PETSc being compiled
23efd74e9bSBarry Smith#
24efd74e9bSBarry Smithinfo:
25efd74e9bSBarry Smith	-@echo "=========================================="
2611b6dc0cSBarry Smith	-@echo " "
27d76296fbSBarry Smith	-@echo "See docs/troubleshooting.html and docs/bugreporting.html"
28d76296fbSBarry Smith	-@echo "for help with installation problems. Please send EVERYTHING"
29d76296fbSBarry Smith	-@echo "printed out below when reporting problems"
3011b6dc0cSBarry Smith	-@echo " "
3111b6dc0cSBarry Smith	-@echo "To subscribe to the PETSc users mailing list, send mail to "
3211b6dc0cSBarry Smith	-@echo "majordomo@mcs.anl.gov with the message: "
338b6f49e5SSatish Balay	-@echo "subscribe petsc-announce"
3411b6dc0cSBarry Smith	-@echo " "
35d76296fbSBarry Smith	-@echo "=========================================="
361d91fb6eSBarry Smith	-@echo On `date` on `hostname`
3730fdcc7aSBarry Smith	-@echo Machine characteristics: `uname -a`
38efd74e9bSBarry Smith	-@echo "-----------------------------------------"
390387d3c6SKris Buschelman	-@echo "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS}"
40dffd13fbSMatthew Knepley	-@echo "C Compiler version: " `${C_CCV}`
41*e6ee457dSBarry Smith	-@if [ "${CXX}" != "" ]; then \
42*e6ee457dSBarry Smith	   echo "Using C++ compiler: ${CXX_CC} ${COPTFLAGS} ${CCPPFLAGS}";\
43*e6ee457dSBarry Smith	   echo "C++ Compiler version: " `${CXX_CCV}`;\
44*e6ee457dSBarry Smith	fi
45*e6ee457dSBarry Smith	-@if [ "${FC}" != "" ]; then \
46*e6ee457dSBarry Smith	   echo "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}";\
47*e6ee457dSBarry Smith	   echo "Fortran Compiler version: " `${C_FCV}`;\
48*e6ee457dSBarry Smith         fi
4947794344SBarry Smith	-@echo "-----------------------------------------"
50bdd8b494SSatish Balay	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
51f265ae5cSBarry Smith	-@echo "-----------------------------------------"
52d77bb2e1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
5347794344SBarry Smith	-@echo "-----------------------------------------"
54e0e703c1SSatish Balay	-@echo "Using configuration flags:"
5519552e71SMatthew Knepley	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
5647794344SBarry Smith	-@echo "-----------------------------------------"
57d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
5847794344SBarry Smith	-@echo "-----------------------------------------"
59d77bb2e1SSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
6019552e71SMatthew Knepley	-@echo "Using PETSc arch: ${PETSC_ARCH}"
61efd74e9bSBarry Smith	-@echo "------------------------------------------"
62d77bb2e1SSatish Balay	-@echo "Using C linker: ${CLINKER}"
63*e6ee457dSBarry Smith	-@if [ "${FC}" != "" ]; then \
64*e6ee457dSBarry Smith	   echo "Using Fortran linker: ${FLINKER}";\
65*e6ee457dSBarry Smith         fi
66f2b01315SBarry Smith	-@echo "Using libraries: ${PETSC_LIB}"
67e3353558SSatish Balay	-@echo "------------------------------------------"
68e3353558SSatish Balay	-@echo "Using mpirun: ${MPIRUN}"
69efd74e9bSBarry Smith	-@echo "=========================================="
70b8d81f61SBarry Smith#
71b8d81f61SBarry Smith#
7219552e71SMatthew KnepleyMINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
73b8d81f61SBarry Smithinfo_h:
74ddbfe947SBarry Smith	-@$(RM) -f MINFO ${MINFO}
752fc52814SBarry Smith	-@echo  "static const char *petscmachineinfo = \"  " >> MINFO
7634a92de5SBarry Smith	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
77c5e9c7dfSBarry Smith	-@echo  Machine characteristics: `uname -a` "" >> MINFO
78f6a9982fSBarry Smith	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
7919552e71SMatthew Knepley	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
8093520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
812fc52814SBarry Smith	-@echo  "static const char *petsccompilerinfo = \"  " >> MINFO
825323642bSKris Buschelman	-@echo  "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS} " >> MINFO
83dffd13fbSMatthew Knepley	-@echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1 ; true
84dffd13fbSMatthew Knepley	-@echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; true
855323642bSKris Buschelman	-@echo  "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}" >> MINFO
86dffd13fbSMatthew Knepley	-@echo  "Fortran Compiler version:" >> MINFO ; ${C_FCV} >> MINFO 2>&1 ; true
8793520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
882fc52814SBarry Smith	-@echo  "static const char *petsccompilerflagsinfo = \"  " >> MINFO
89c5e9c7dfSBarry Smith	-@echo  "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" >> MINFO
90c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
91c5e9c7dfSBarry Smith	-@echo  "Using configuration flags:" >> MINFO
92c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
93c5e9c7dfSBarry Smith	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
9493520af8SSatish Balay	-@echo  "------------------------------------------\"; " >> MINFO
952fc52814SBarry Smith	-@echo  "static const char *petsclinkerinfo = \"  " >> MINFO
96c5e9c7dfSBarry Smith	-@echo  "Using C linker: ${CLINKER}" >> MINFO
97c5e9c7dfSBarry Smith	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
9893520af8SSatish Balay	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
999f5e290dSSYSTEM	-@cat MINFO | ${SED} -e 's/\
1009c0905fcSSatish Balay//g'  | ${SED} -e 's/\^M//g' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}
101ce0f4ea0SKris Buschelman	-@$(RM) MINFO
1023677444aSSatish Balay
103fa527775SLois Curfman McInnes#
104fa527775SLois Curfman McInnes# Builds the PETSc libraries
105f6a9982fSBarry Smith# This target also builds fortran77 and f90 interface
1063677444aSSatish Balay# files and compiles .F files
107f6a9982fSBarry Smith#
108efd74e9bSBarry Smithbuild:
10947794344SBarry Smith	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
11044ecba3fSMatthew Knepley	-@echo "========================================="
1115fde6e02SSatish Balay	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
1120b3634f8SBarry Smith	-@${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
11347794344SBarry Smith	-@echo "Completed building libraries"
11435ca7349SBarry Smith	-@echo "========================================="
115c8fd01ffSBarry Smith#
116c8fd01ffSBarry Smith#  Compiles the blas and lapack source code if found
117c8fd01ffSBarry Smithblaslapack:
118c8fd01ffSBarry Smith	-@if [ -d f2cblaslapack/${PETSC_ARCH} -a ! -s f2cblaslapack/${PETSC_ARCH}/libf2cblas.a ] ; then cd f2cblaslapack;\
119c8fd01ffSBarry Smith        echo "=========================================";\
120c8fd01ffSBarry Smith        echo "Building C Blas/Lapack libraries";\
121c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
12282fb4bcfSBarry Smith        ${MV} libf2cblas.a libf2clapack.a ${PETSC_ARCH};\
123c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} cleanblaslapack ;\
124c8fd01ffSBarry Smith        echo "Completed C building Blas/Lapack libraries";\
125c8fd01ffSBarry Smith        echo "========================================="; fi
126c8fd01ffSBarry Smith	-@if [ -d fblaslapack/${PETSC_ARCH} -a ! -s fblaslapack/${PETSC_ARCH}/libfblas.a ] ; then cd fblaslapack;\
127c8fd01ffSBarry Smith        echo "=========================================";\
128c8fd01ffSBarry Smith        echo "Building Fortran Blas/Lapack libraries";\
129c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
13082fb4bcfSBarry Smith        ${MV} libfblas.a libflapack.a ${PETSC_ARCH};\
131c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} cleanblaslapck ;\
132c8fd01ffSBarry Smith        echo "Completed building Fortran Blas/Lapack libraries";\
133c8fd01ffSBarry Smith        echo "========================================="; fi
1346f02d409SBarry Smith#
1356f02d409SBarry Smith#  Compiles MPICH if found
13615876681SBarry Smithmpich:
1376f02d409SBarry Smith	-@releasename=`ls -d mpich* 2> /dev/null`;\
1386f02d409SBarry Smith        if [ -d $${releasename}/${PETSC_ARCH} -a ! -d $${releasename}/${PETSC_ARCH}/lib ] ; then cd $${releasename} ;\
1396f02d409SBarry Smith          echo "=========================================";\
1406f02d409SBarry Smith          echo "Compiling and installing " $${releasename};\
1416f02d409SBarry Smith          make; make install; \
1426f02d409SBarry Smith          echo "=========================================";\
1436f02d409SBarry Smith        fi;
1443677444aSSatish Balay#
1458744090aSBarry Smith# Builds PETSc test examples for a given BOPT and architecture
1460ce59502SBarry Smith#
14704f117c6SBarry Smithtest: chkopts
14804f117c6SBarry Smith	-@echo "Running test examples to verify correct installation"
14904f117c6SBarry Smith	@cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
15004f117c6SBarry Smith	@if [ "${C_FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
1510ce59502SBarry Smith	-@echo "Completed test examples"
1523677444aSSatish Balay
1533677444aSSatish Balaytestexamples: info chkopts
1543677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
1553677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1563677444aSSatish Balay	-@echo "machines some of the numbers may not match exactly."
15719552e71SMatthew Knepley	-@echo "========================================="
1583677444aSSatish Balay	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_1  tree
1593677444aSSatish Balay	-@echo "Completed compiling and running test examples"
1603677444aSSatish Balay	-@echo "========================================="
1613677444aSSatish Balaytestfortran: info chkopts
1623677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
1633677444aSSatish Balay	-@echo "========================================="
1643677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1653677444aSSatish Balay	-@echo "machines or the way Fortran formats numbers"
1663677444aSSatish Balay	-@echo "some of the results may not match exactly."
1674b5d664cSKris Buschelman	-@echo "========================================="
1684b5d664cSKris Buschelman	-@if [ "${C_FC}" != "" ]; then \
1696d2f2efaSKris Buschelman            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3 tree; \
1706d2f2efaSKris Buschelman            echo "Completed compiling and running Fortran test examples"; \
1716d2f2efaSKris Buschelman          else \
1724b5d664cSKris Buschelman            echo "Error: No FORTRAN compiler available"; \
1733677444aSSatish Balay          fi
17401c5c36fSSatish Balay	-@echo "========================================="
17501c5c36fSSatish Balaytestexamples_uni: info chkopts
17601c5c36fSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
17701c5c36fSSatish Balay	-@echo "Due to different numerical round-off on certain"
17801c5c36fSSatish Balay	-@echo "machines some of the numbers may not match exactly."
17919552e71SMatthew Knepley	-@echo "========================================="
18001c5c36fSSatish Balay	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_4  tree
18101c5c36fSSatish Balay	-@echo "Completed compiling and running uniprocessor test examples"
1823677444aSSatish Balay	-@echo "========================================="
1833677444aSSatish Balaytestfortran_uni: info chkopts
1843677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
1853677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1863677444aSSatish Balay	-@echo "machines some of the numbers may not match exactly."
1874b5d664cSKris Buschelman	-@echo "========================================="
1884b5d664cSKris Buschelman	-@if [ "${C_FC}" != "" ]; then \
1896d2f2efaSKris Buschelman            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree; \
1906d2f2efaSKris Buschelman            echo "Completed compiling and running uniprocessor fortran test examples"; \
1916d2f2efaSKris Buschelman          else \
1924b5d664cSKris Buschelman            echo "Error: No FORTRAN compiler available"; \
1936d2f2efaSKris Buschelman          fi
1943677444aSSatish Balay	-@
195ad96cc0dSLois Curfman McInnes	-@echo "========================================="
196f3eacedaSSatish Balay
1978c37ef55SBarry Smith# Ranlib on the libraries
1985fde6e02SSatish Balayranlib:
19961523587SBarry Smith	${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
20011b6ed10SLois Curfman McInnes
201f3eacedaSSatish Balay# Deletes PETSc libraries
202b87434adSSatish Balaydeletelibs: chkopts_basic
203d44968ceSBarry Smith	-${RM} -f ${PETSC_LIB_DIR}/*
204a42cec9dSMatthew Knepley
205a42cec9dSMatthew Knepley# Cleans up build
20619552e71SMatthew Knepleyallclean: deletelibs
207a42cec9dSMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
2083677444aSSatish Balay
2094918a6b0SSatish Balay
2104918a6b0SSatish Balay#
2114918a6b0SSatish Balay# Check if PETSC_DIR variable specified is valid
2124918a6b0SSatish Balay#
2134918a6b0SSatish Balaychk_petsc_dir:
2141390f061SBarry Smith	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
2151390f061SBarry Smith	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
2161390f061SBarry Smith	  echo "You need to use / to separate directories, not \\!"; \
2174918a6b0SSatish Balay	  echo "Aborting build"; \
2184918a6b0SSatish Balay	  false; fi
2193c94ec11SBarry Smith
2203c94ec11SBarry Smithinstall:
221fe0e97ccSBarry Smith	-@if [ "${INSTALL_DIR}" == "${PETSC_DIR}" ]; then \
2223c94ec11SBarry Smith	  echo "Install directory is current directory; nothing needs to be done";\
2233c94ec11SBarry Smith        else \
2243c94ec11SBarry Smith	  echo Installing PETSc at ${INSTALL_DIR};\
2253c94ec11SBarry Smith          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
2263c94ec11SBarry Smith	    mkdir `dirname ${INSTALL_DIR}` ; \
2273c94ec11SBarry Smith          fi;\
2283c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR} ]; then \
2293c94ec11SBarry Smith	    mkdir ${INSTALL_DIR} ; \
2303c94ec11SBarry Smith          fi;\
2313c94ec11SBarry Smith          cp -fr include ${INSTALL_DIR};\
2323c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR}/bmake ]; then \
2333c94ec11SBarry Smith	    mkdir ${INSTALL_DIR}/bmake ; \
2343c94ec11SBarry Smith          fi;\
2353c94ec11SBarry Smith          cp -f bmake/adic* bmake/variables ${INSTALL_DIR}/bmake ; \
2363c94ec11SBarry Smith          cp -fr bmake/common ${INSTALL_DIR}/bmake;\
2373c94ec11SBarry Smith          cp -fr bmake/${PETSC_ARCH} ${INSTALL_DIR}/bmake;\
2383c94ec11SBarry Smith          cp -fr bin ${INSTALL_DIR};\
2393c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR}/lib ]; then \
2403c94ec11SBarry Smith	    mkdir ${INSTALL_DIR}/lib ; \
2413c94ec11SBarry Smith          fi;\
2423c94ec11SBarry Smith          for i in lib/lib*; do \
2433c94ec11SBarry Smith            bopt=`echo $${i} | ${SED} s=lib/lib==g`;\
2443c94ec11SBarry Smith            if [ ! -d ${INSTALL_DIR}/$${i} ]; then \
2453c94ec11SBarry Smith              mkdir ${INSTALL_DIR}/$${i};\
2463c94ec11SBarry Smith            fi; \
2473c94ec11SBarry Smith            if [ -d $${i}/${PETSC_ARCH} ]; then \
2483c94ec11SBarry Smith              cp -fr $${i}/${PETSC_ARCH} ${INSTALL_DIR}/$${i};\
2493c94ec11SBarry Smith              ${RANLIB}  ${INSTALL_DIR}/$${i}/*.a > /dev/null 2>&1 ;\
2503c94ec11SBarry Smith              ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${INSTALL_DIR} BOPT=$${bopt} shared; \
2513c94ec11SBarry Smith            fi;\
2523c94ec11SBarry Smith          done;\
2533c94ec11SBarry Smith          echo "sh/bash: PETSC_DIR="${INSTALL_DIR}"; export PETSC_DIR";\
2543c94ec11SBarry Smith          echo "csh/tcsh: setenv PETSC_DIR "${INSTALL_DIR} ;\
2553c94ec11SBarry Smith          echo "The do make test to verify correct install";\
2563c94ec11SBarry Smith        fi;
2573c94ec11SBarry Smith
2583c94ec11SBarry Smithinstall_src:
2593c94ec11SBarry Smith	-@if [ "${INSTALL_DIR}" == "${PETSC_DIR}" ]; then \
2603c94ec11SBarry Smith	  echo "You did not set a directory to install to";\
2613c94ec11SBarry Smith        else \
2623c94ec11SBarry Smith	  echo Installing PETSc source at ${INSTALL_DIR};\
2633c94ec11SBarry Smith          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
2643c94ec11SBarry Smith	    mkdir `dirname ${INSTALL_DIR}` ; \
2653c94ec11SBarry Smith          fi;\
2663c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR} ]; then \
2673c94ec11SBarry Smith	    mkdir ${INSTALL_DIR} ; \
2683c94ec11SBarry Smith          fi;\
2693c94ec11SBarry Smith          cp -fr src ${INSTALL_DIR};\
2703c94ec11SBarry Smith        fi;
2713c94ec11SBarry Smith
2723c94ec11SBarry Smithinstall_docs:
2733c94ec11SBarry Smith	-@if [ "${INSTALL_DIR}" == "${PETSC_DIR}" ]; then \
2743c94ec11SBarry Smith	  echo "You did not set a directory to install to";\
2753c94ec11SBarry Smith        else \
2763c94ec11SBarry Smith	  echo Installing PETSc documentation at ${INSTALL_DIR};\
2773c94ec11SBarry Smith          if [ ! -d `dirname ${INSTALL_DIR}` ]; then \
2783c94ec11SBarry Smith	    mkdir `dirname ${INSTALL_DIR}` ; \
2793c94ec11SBarry Smith          fi;\
2803c94ec11SBarry Smith          if [ ! -d ${INSTALL_DIR} ]; then \
2813c94ec11SBarry Smith	    mkdir ${INSTALL_DIR} ; \
2823c94ec11SBarry Smith          fi;\
2833c94ec11SBarry Smith          cp -fr docs ${INSTALL_DIR};\
2843c94ec11SBarry Smith          ${RM} -fr docs/tex;\
2853677444aSSatish Balay        fi;
2863677444aSSatish Balay# ------------------------------------------------------------------
2873677444aSSatish Balay#
2883677444aSSatish Balay# All remaining actions are intended for PETSc developers only.
2893677444aSSatish Balay# PETSc users should not generally need to use these commands.
2903677444aSSatish Balay#
29165783a8cSBarry Smith
29265783a8cSBarry Smith# To access the tags in EMACS, type M-x visit-tags-table and specify
29365783a8cSBarry Smith# the file petsc/TAGS.
29465783a8cSBarry Smith# 1) To move to where a PETSc function is defined, enter M-. and the
29565783a8cSBarry Smith#     function name.
29665783a8cSBarry Smith# 2) To search for a string and move to the first occurrence,
2977acb7333SLois Curfman McInnes#     use M-x tags-search and the string.
29811b6ed10SLois Curfman McInnes#     To locate later occurrences, use M-,
29911b6ed10SLois Curfman McInnes# Builds all etags files
30001c05c5cSSatish Balayalletags:
30109f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags
30209f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_noexamples
30309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_examples
3044fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_makefiles
30520563c6bSBarry Smith# Builds complete etags list
30609f7043eSSatish Balayetags:
30709f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS
30809f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS
30941fa366cSBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcec alltree
31009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcej alltree
31109f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourceh alltree
31209f7043eSSatish Balay	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcef alltree
31309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesc alltree
31409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesf alltree
31509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesch alltree
31609f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesfh alltree
31709f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_makefile alltree
3184fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS etags_bmakefiles
3194fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_docs alltree
32011b6ed10SLois Curfman McInnes	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_scripts alltree
321bfce26a3SBarry Smith# Builds the etags file that excludes the examples directories
32209f7043eSSatish Balayetags_noexamples:
32309f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_NO_EXAMPLES
32409f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_NO_EXAMPLES
32541fa366cSBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcec alltree
32609f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcej alltree
32709f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourceh alltree
32809f7043eSSatish Balay	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcef alltree
32909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_makefile alltree
33009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES etags_bmakefiles
33111b6ed10SLois Curfman McInnes	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_docs alltree
332b16a3bb1SBarry Smith# Builds the etags file for makefiles
3337e0368d4SSatish Balayetags_makefiles:
3347e0368d4SSatish Balay	-${RM} ${TAGSDIR}/TAGS_MAKEFILES
3357e0368d4SSatish Balay	-touch ${TAGSDIR}/TAGS_MAKEFILES
3367e0368d4SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES ACTION=etags_makefile alltree
337dc80aa23SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES etags_bmakefiles
338dc80aa23SSatish Balay# Builds the etags file for examples
33909f7043eSSatish Balayetags_examples:
34009f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_EXAMPLES
34109f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_EXAMPLES
34209f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesc alltree
34309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesch alltree
34409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesf alltree
3452176044fSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
34609f7043eSSatish Balayetags_fexamples:
34709f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_FEXAMPLES
34809f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_FEXAMPLES
34909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_FEXAMPLES ACTION=etags_examplesf alltree
350b38bb785SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
351f20f7ba3SSatish Balay#
3523677444aSSatish Balay# These are here for the target allci and allco, and etags
353b38bb785SSatish Balay#
35423bef294SSatish Balay
355516d1546SSatish BalayBMAKEFILES = bmake/common/base bmake/common/test \
3562bda9e70SSatish Balay	     bmake/common/bopt* bmake/*/rules bmake/*/variables bmake/*/packages \
3572905d4d4SKris Buschelman	     bmake/*/petscconf.h bmake/*/petscfix.h bmake/config/packages.in \
35837dc49f7SBarry Smith	     bmake/config/petscfix.h.in  bmake/config/rules.in  \
3592f1ebae6SLois Curfman McInnes	     bmake/config/variables.in bmake/adic.init bmake/adicmf.init
360d56c4d9fSBarry SmithDOCS	   = bmake/readme bmake/petscconf.defs
361d56c4d9fSBarry SmithSCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/crontab python/PETSc/Configure.py python/PETSc/Options.py \
362d56c4d9fSBarry Smith             python/PETSc/packages/ADIC.py python/PETSc/packages/MPE.py python/PETSc/packages/Mathematica.py \
363d56c4d9fSBarry Smith             python/PETSc/packages/PLAPACK.py python/PETSc/packages/Triangle.py python/PETSc/packages/Matlab.py \
364d56c4d9fSBarry Smith             python/PETSc/packages/PVODE.py python/PETSc/packages/BlasLapack.py python/PETSc/packages/MPI.py \
365e9f3bb17SBarry Smith             python/PETSc/packages/BlockSolve.py python/PETSc/packages/NetCDF.py python/PETSc/packages/ParMetis.py \
366d56c4d9fSBarry Smith             python/PETSc/packages/update.py maint/confignightly/* config/*.py
36711b6ed10SLois Curfman McInnes
3686b91f8d1SSatish Balay
3696b91f8d1SSatish Balayupdatewebdocs:
3706b91f8d1SSatish Balay	-chmod -R ug+w /mcs/tmp/petsc-tmp
3716b91f8d1SSatish Balay	-chgrp -R petsc /mcs/tmp/petsc-tmp
3726b91f8d1SSatish Balay	-/bin/rm -rf /mcs/tmp/petscdocs
3736b91f8d1SSatish Balay	-/bin/cp -r /mcs/tmp/petsc-tmp/docs /mcs/tmp/petscdocs
3746b91f8d1SSatish Balay	-maint/update-docs.py /mcs/tmp/petscdocs
3756b91f8d1SSatish Balay	-find /mcs/tmp/petscdocs -type d -name "*" -exec chmod g+w {} \;
3766b91f8d1SSatish Balay	-/bin/cp -r /mcs/tmp/petscdocs/* ${PETSC_DIR}/docs
3776b91f8d1SSatish Balay	-/bin/rm -rf /mcs/tmp/petscdocs
378ad56a76cSSatish Balay
379ad56a76cSSatish Balaychk_loc:
380ad56a76cSSatish Balay	@if [ ${LOC}foo = foo ] ; then \
381ad56a76cSSatish Balay	  echo "*********************** ERROR ************************" ; \
382ad56a76cSSatish Balay	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
3832496ca06SSatish Balay	  echo "******************************************************";  false; fi
384a2fc510eSBarry Smith
385f1d13e97SSatish Balay# Builds all the documentation - should be done every night
386f1d13e97SSatish Balayalldoc: alldoc1 alldoc2
387f1d13e97SSatish Balay
388f1d13e97SSatish Balay# Build everything that goes into 'doc' dir except html sources
389130c9832SBarry Smithalldoc1: chk_loc deletemanualpages chk_concepts_dir
390fe742e3dSSatish Balay	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
391130c9832SBarry Smith	cd docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
39248b2c0e9SBarry Smith	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
393130c9832SBarry Smith	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
394130c9832SBarry Smith	-${OMAKE} ACTION=manexamples tree LOC=${LOC}
39548b2c0e9SBarry Smith	-${OMAKE} manconcepts LOC=${LOC}
39648b2c0e9SBarry Smith	-${OMAKE} ACTION=getexlist tree LOC=${LOC}
39748b2c0e9SBarry Smith	-${OMAKE} ACTION=exampleconcepts tree LOC=${LOC}
398e01137a2SSatish Balay	-maint/helpindex.py ${PETSC_DIR} ${LOC}
399435da068SBarry Smith
400062da8f7SSatish Balay# Builds .html versions of the source
401f1d13e97SSatish Balay# html overwrites some stuff created by update-docs - hence this is done later.
4023a2060ecSSatish Balayalldoc2: chk_loc
403062da8f7SSatish Balay	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
404435da068SBarry Smith	-maint/update-docs.py ${LOC}
405efaa7783SSatish Balay
406efaa7783SSatish Balayalldocclean: deletemanualpages allcleanhtml
407efaa7783SSatish Balay
408efaa7783SSatish Balay# Deletes man pages (HTML version)
409efaa7783SSatish Balaydeletemanualpages: chk_loc
410efaa7783SSatish Balay	find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \;
411efaa7783SSatish Balay	${RM} ${LOC}/docs/tex/exampleconcepts
412efaa7783SSatish Balay	${RM} ${LOC}/docs/tex/manconcepts
413efaa7783SSatish Balay	${RM} ${LOC}/docs/manualpages/manualpages.cit
414efaa7783SSatish Balay	-maint/update-docs.py ${LOC} clean
415115a300dSBarry Smith
416efaa7783SSatish Balayallcleanhtml:
417cc4dcc40SBarry Smith	-${RM} include/adic/*.h.html include/esi/petsc/*.h.html
418395565bcSBarry Smith	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
419ad56a76cSSatish Balay
420fe742e3dSSatish Balaychk_concepts_dir: chk_loc
421bfe54af3SSatish Balay	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
422bdde29a3SBarry Smith	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
423bdde29a3SBarry Smith#
424bdde29a3SBarry Smith#  checks if should build Fortran stubs
425da77a087SBarry Smithchk_fortranstubs:
426bdde29a3SBarry Smith	-@if [ ! -f "${PETSC_DIR}/src/fortran/auto/makefile.src" -a "${C_FC}" != "" ]; then \
427bdde29a3SBarry Smith          ${OMAKE} PETSC_DIR=${PETSC_DIR} allfortranstubs ;\
428bdde29a3SBarry Smith        fi
42911b6ed10SLois Curfman McInnes
43011b6ed10SLois Curfman McInnes# Builds Fortran stub files
43109d4790eSSatish Balayallfortranstubs:
4329c0ff1f6SBarry Smith	-@which ${BFORT} > /dev/null 2>&1;  \
4339c0ff1f6SBarry Smith        if [ "$$?" != "0" ]; then \
4349c0ff1f6SBarry Smith          echo "No bfort available, skipping building Fortran stubs";\
4359c0ff1f6SBarry Smith        else \
4369c0ff1f6SBarry Smith          ${RM} -f ${PETSC_DIR}/src/fortran/auto/*.c ;\
4379c0ff1f6SBarry Smith	  touch ${PETSC_DIR}/src/fortran/auto/makefile.src ;\
4389c0ff1f6SBarry Smith	  ${OMAKE} ACTION=fortranstubs tree_basic ;\
4399c0ff1f6SBarry Smith	  cd ${PETSC_DIR}/src/fortran/auto; ${RM} makefile.src; echo SOURCEC = ` ls *.c | tr -s '\n' ' '` > makefile.src ;\
4409c0ff1f6SBarry Smith	  cd ${PETSC_DIR}/src/fortran/auto; ${OMAKE} fixfortran ;\
441f6ff2982SSatish Balay        fi
442d55938c2SBarry Smith
44319552e71SMatthew Knepleyallci:
444b951964fSBarry Smith	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
445d55938c2SBarry Smith
44619552e71SMatthew Knepleyallco:
447d55938c2SBarry Smith	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
448791d64f4SSatish Balay
449791d64f4SSatish Balay# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
45019552e71SMatthew Knepleyallrcslabel:
451b334301eSBarry Smith	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
452b334301eSBarry Smith#
453b334301eSBarry Smith#   The commands below are for generating ADIC versions of the code;
454b334301eSBarry Smith# they are not currently used.
4555eea60f9SBarry Smith#
456b87434adSSatish Balayalladicignore:
45719552e71SMatthew Knepley	-@${RM} ${INSTALL_LIB_DIR}/adicignore
4585eea60f9SBarry Smith	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
4595eea60f9SBarry Smith
460d18b0ea7SBarry Smithalladic:
46167b024f7SSatish Balay	-@echo "Beginning to compile ADIC source code in all directories"
462d18b0ea7SBarry Smith	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
46347794344SBarry Smith	-@echo "========================================="
46467b024f7SSatish Balay	-@cd include ; \
46519552e71SMatthew Knepley           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
46647794344SBarry Smith	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
46719552e71SMatthew Knepley	-@cd src/inline ; \
46877ed5343SBarry Smith            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic
46919552e71SMatthew Knepley	-@cd src/blaslapack ; \
4706e81b665SBarry Smith            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
47147794344SBarry Smith
472d18b0ea7SBarry Smithalladiclib:
473d77bb2e1SSatish Balay	-@echo "Beginning to compile ADIC libraries in all directories"
474d18b0ea7SBarry Smith	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
475d77bb2e1SSatish Balay	-@echo "-----------------------------------------"
476d18b0ea7SBarry Smith	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
477e0e703c1SSatish Balay	-@echo "-----------------------------------------"
478ba1077baSMatthew Knepley	-@echo "Using configuration flags:"
479d18b0ea7SBarry Smith	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
480d77bb2e1SSatish Balay	-@echo "-----------------------------------------"
481d18b0ea7SBarry Smith	-@echo "Using include paths: ${PETSC_INCLUDE}"
482d77bb2e1SSatish Balay	-@echo "-----------------------------------------"
48319552e71SMatthew Knepley	-@echo "Using PETSc directory: ${PETSC_DIR}"
484d18b0ea7SBarry Smith	-@echo "Using PETSc arch: ${PETSC_ARCH}"
4855fde6e02SSatish Balay	-@echo "========================================="
48619552e71SMatthew Knepley	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${LIB_SUFFIX}
48777ed5343SBarry Smith	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
48819552e71SMatthew Knepley	-@cd src/blaslapack ; \
4897e351921SBarry Smith            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
49019552e71SMatthew Knepley	-@cd src/adic/src ; \
4915eea60f9SBarry Smith            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib
4929e417c50SSatish Balay
4939e417c50SSatish Balay# -------------------------------------------------------------------------------
4949e417c50SSatish Balay#
4959e417c50SSatish Balay# Some macros to check if the fortran interface is up-to-date.
4969e417c50SSatish Balay#
497d77bb2e1SSatish Balaycountfortranfunctions:
49885c7cd6cSSatish Balay	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
4999e417c50SSatish Balay	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
500b334301eSBarry Smith	sed "s/_$$//" | sort > /tmp/countfortranfunctions
5019e417c50SSatish Balay
50285c7cd6cSSatish Balaycountcfunctions:
50385c7cd6cSSatish Balay	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
5049e417c50SSatish Balay	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
5059e417c50SSatish Balay	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
5069e417c50SSatish Balay
5079e417c50SSatish Balaydifffortranfunctions: countfortranfunctions countcfunctions
5089700b7f8SSatish Balay	-@echo -------------- Functions missing in the fortran interface ---------------------
5099e417c50SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
5109700b7f8SSatish Balay	-@echo ----------------- Functions missing in the C interface ------------------------
511d77bb2e1SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
512b334301eSBarry Smith	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
5133f4c9a3aSSatish Balay
5143f4c9a3aSSatish Balaycheckbadfortranstubs:
5153f4c9a3aSSatish Balay	-@echo "========================================="
5163f4c9a3aSSatish Balay	-@echo "Functions with MPI_Comm as an Argument"
517d77bb2e1SSatish Balay	-@echo "========================================="
51885c7cd6cSSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
5193f4c9a3aSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
5203f4c9a3aSSatish Balay	-@echo "========================================="
5213f4c9a3aSSatish Balay	-@echo "Functions with a String as an Argument"
522d77bb2e1SSatish Balay	-@echo "========================================="
52385c7cd6cSSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
5243f4c9a3aSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
5253f4c9a3aSSatish Balay	-@echo "========================================="
5263f4c9a3aSSatish Balay	-@echo "Functions with Pointers to PETSc Objects as Argument"
527d77bb2e1SSatish Balay	-@echo "========================================="
52885c7cd6cSSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; \
52985c7cd6cSSatish Balay	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
5303f4c9a3aSSatish Balay	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
5313f4c9a3aSSatish Balay	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
53285c7cd6cSSatish Balay	for OBJ in $$_p_OBJ; do \
5333f4c9a3aSSatish Balay	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
5343f4c9a3aSSatish Balay	cut -d'(' -f1 | cut -d' ' -f1,3; \
5354556b810SBarry Smith	done
5364556b810SBarry Smith#
537b6ea66eeSBarry Smith# Automatically generates PETSc exercises in html from the tutorial examples.
53875df30afSSatish Balay#
539b6ea66eeSBarry Smith# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
540b6ea66eeSBarry Smith#  (used also in introductions to the manual pages)
541b6ea66eeSBarry Smith# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
542b6ea66eeSBarry Smith# The list of exercises is from TUTORIALS in each directory's makefile
5434556b810SBarry Smith#
5444556b810SBarry Smith# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
5454556b810SBarry Smith# The pagemaker rule is in the file bmake/common (at the bottom)
546843ae28eSBarry Smith#
54797e8d271SBarry Smith# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
548843ae28eSBarry Smith#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
54997e8d271SBarry Smith#
55097e8d271SBarry Smithexercises:
55197e8d271SBarry Smith	-@echo "========================================="
552467fbd6dSBarry Smith	-@echo "Generating HTML tutorial exercises"
55397e8d271SBarry Smith	-@${RM} docs/pageform.txt
55497e8d271SBarry Smith	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
555beb1b3a5SBarry Smith	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
55697e8d271SBarry Smith	-@echo "access_format=short"                        >> docs/pageform.txt
55797e8d271SBarry Smith	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
55897e8d271SBarry Smith	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
55997e8d271SBarry Smith	-@echo "Generating HTML for individual directories"
560beb1b3a5SBarry Smith	-@echo "========================================="
56197e8d271SBarry Smith	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
56297e8d271SBarry Smith	-@echo "Completed HTML for individual directories"
56397e8d271SBarry Smith	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
56497e8d271SBarry Smith	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
56597e8d271SBarry Smith	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
56697e8d271SBarry Smith	-@echo "========================================="
567b4b3a923SMatthew Knepley
568b4b3a923SMatthew Knepley# Make a tarball of all the Python code
569b4b3a923SMatthew Knepley#   This is currently used to release to the Teragrid
570b4b3a923SMatthew KnepleypetscPython.tgz:
571b4b3a923SMatthew Knepley	@tar cvzf $@ --exclude SCCS --exclude BitKeeper --dereference python/
572b4b3a923SMatthew Knepley	-@scp $@ tg-login2.uc.teragrid.org:./
5738852b4e5SMatthew Knepley
574a42cec9dSMatthew Knepley.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
575a42cec9dSMatthew Knepley        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples updatewebdocs alldoc allmanualpages \
576b4b3a923SMatthew Knepley        allhtml allcleanhtml allfortranstubs allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
577f7819401SBarry Smith        start_configure configure_petsc configure_clean petscPython.tgz
578
579