xref: /petsc/makefile (revision 062da8f70f34dda5e39d02d8ce0729d67bb1a6d0)
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}
206f02d409SBarry Smithall_build: chk_petsc_dir info info_h chklib_dir deletelibs blaslapack mpich build shared
21efd74e9bSBarry Smith#
22fa527775SLois Curfman McInnes# Prints information about the system and version of PETSc being compiled
23efd74e9bSBarry Smith#
24efd74e9bSBarry Smithinfo:
25efd74e9bSBarry Smith	-@echo "=========================================="
2611b6dc0cSBarry Smith	-@echo " "
27d76296fbSBarry Smith	-@echo "See docs/troubleshooting.html and docs/bugreporting.html"
28d76296fbSBarry Smith	-@echo "for help with installation problems. Please send EVERYTHING"
29d76296fbSBarry Smith	-@echo "printed out below when reporting problems"
3011b6dc0cSBarry Smith	-@echo " "
3111b6dc0cSBarry Smith	-@echo "To subscribe to the PETSc users mailing list, send mail to "
3211b6dc0cSBarry Smith	-@echo "majordomo@mcs.anl.gov with the message: "
338b6f49e5SSatish Balay	-@echo "subscribe petsc-announce"
3411b6dc0cSBarry Smith	-@echo " "
35d76296fbSBarry Smith	-@echo "=========================================="
361d91fb6eSBarry Smith	-@echo On `date` on `hostname`
3730fdcc7aSBarry Smith	-@echo Machine characteristics: `uname -a`
38efd74e9bSBarry Smith	-@echo "-----------------------------------------"
390387d3c6SKris Buschelman	-@echo "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS}"
40dffd13fbSMatthew Knepley	-@echo "C Compiler version: " `${C_CCV}`
410387d3c6SKris Buschelman	-@echo "Using C++ compiler: ${CXX_CC} ${COPTFLAGS} ${CCPPFLAGS}"
42dffd13fbSMatthew Knepley	-@echo "C++ Compiler version: " `${CXX_CCV}`
430387d3c6SKris Buschelman	-@echo "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}"
44dffd13fbSMatthew Knepley	-@echo "Fortran Compiler version: " `${C_FCV}`
4547794344SBarry Smith	-@echo "-----------------------------------------"
46bdd8b494SSatish Balay	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
47f265ae5cSBarry Smith	-@echo "-----------------------------------------"
48d77bb2e1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
4947794344SBarry Smith	-@echo "-----------------------------------------"
50e0e703c1SSatish Balay	-@echo "Using configuration flags:"
5119552e71SMatthew Knepley	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
5247794344SBarry Smith	-@echo "-----------------------------------------"
53d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
5447794344SBarry Smith	-@echo "-----------------------------------------"
55d77bb2e1SSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
5619552e71SMatthew Knepley	-@echo "Using PETSc arch: ${PETSC_ARCH}"
57efd74e9bSBarry Smith	-@echo "------------------------------------------"
58d77bb2e1SSatish Balay	-@echo "Using C linker: ${CLINKER}"
59d77bb2e1SSatish Balay	-@echo "Using Fortran linker: ${FLINKER}"
60f2b01315SBarry Smith	-@echo "Using libraries: ${PETSC_LIB}"
61e3353558SSatish Balay	-@echo "------------------------------------------"
62e3353558SSatish Balay	-@echo "Using mpirun: ${MPIRUN}"
63efd74e9bSBarry Smith	-@echo "=========================================="
64b8d81f61SBarry Smith#
65b8d81f61SBarry Smith#
6619552e71SMatthew KnepleyMINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
67b8d81f61SBarry Smithinfo_h:
68ddbfe947SBarry Smith	-@$(RM) -f MINFO ${MINFO}
692fc52814SBarry Smith	-@echo  "static const char *petscmachineinfo = \"  " >> MINFO
7034a92de5SBarry Smith	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
71c5e9c7dfSBarry Smith	-@echo  Machine characteristics: `uname -a` "" >> MINFO
72f6a9982fSBarry Smith	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
7319552e71SMatthew Knepley	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
7493520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
752fc52814SBarry Smith	-@echo  "static const char *petsccompilerinfo = \"  " >> MINFO
765323642bSKris Buschelman	-@echo  "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS} " >> MINFO
77dffd13fbSMatthew Knepley	-@echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1 ; true
78dffd13fbSMatthew Knepley	-@echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; true
795323642bSKris Buschelman	-@echo  "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}" >> MINFO
80dffd13fbSMatthew Knepley	-@echo  "Fortran Compiler version:" >> MINFO ; ${C_FCV} >> MINFO 2>&1 ; true
8193520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
822fc52814SBarry Smith	-@echo  "static const char *petsccompilerflagsinfo = \"  " >> MINFO
83c5e9c7dfSBarry Smith	-@echo  "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" >> MINFO
84c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
85c5e9c7dfSBarry Smith	-@echo  "Using configuration flags:" >> MINFO
86c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
87c5e9c7dfSBarry Smith	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
8893520af8SSatish Balay	-@echo  "------------------------------------------\"; " >> MINFO
892fc52814SBarry Smith	-@echo  "static const char *petsclinkerinfo = \"  " >> MINFO
90c5e9c7dfSBarry Smith	-@echo  "Using C linker: ${CLINKER}" >> MINFO
91c5e9c7dfSBarry Smith	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
9293520af8SSatish Balay	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
93dd6a0ae0SKris Buschelman	-@cat MINFO | ${SED} -e 's/\^M//' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}
949c0905fcSSatish Balay	-@$(RM) MINFO
95ce0f4ea0SKris Buschelman
963677444aSSatish Balay#
97fa527775SLois Curfman McInnes# Builds the PETSc libraries
98fa527775SLois Curfman McInnes# This target also builds fortran77 and f90 interface
99f6a9982fSBarry Smith# files and compiles .F files
1003677444aSSatish Balay#
101f6a9982fSBarry Smithbuild:
102efd74e9bSBarry Smith	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
10347794344SBarry Smith	-@echo "========================================="
10444ecba3fSMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
1055fde6e02SSatish Balay	-@${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
1060b3634f8SBarry Smith	-@echo "Completed building libraries"
10747794344SBarry Smith	-@echo "========================================="
10835ca7349SBarry Smith#
109c8fd01ffSBarry Smith#  Compiles the blas and lapack source code if found
110c8fd01ffSBarry Smithblaslapack:
111c8fd01ffSBarry Smith	-@if [ -d f2cblaslapack/${PETSC_ARCH} -a ! -s f2cblaslapack/${PETSC_ARCH}/libf2cblas.a ] ; then cd f2cblaslapack;\
112c8fd01ffSBarry Smith        echo "=========================================";\
113c8fd01ffSBarry Smith        echo "Building C Blas/Lapack libraries";\
114c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
115c8fd01ffSBarry Smith        ${MV} libf2cblas.a libf2clapack.a ${PETSC_ARCH};\
116c8fd01ffSBarry Smith        echo "Completed C building Blas/Lapack libraries";\
117c8fd01ffSBarry Smith        echo "========================================="; fi
118c8fd01ffSBarry Smith	-@if [ -d fblaslapack/${PETSC_ARCH} -a ! -s fblaslapack/${PETSC_ARCH}/libfblas.a ] ; then cd fblaslapack;\
119c8fd01ffSBarry Smith        echo "=========================================";\
120c8fd01ffSBarry Smith        echo "Building Fortran Blas/Lapack libraries";\
121c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
122c8fd01ffSBarry Smith        ${MV} libfblas.a libflapack.a ${PETSC_ARCH};\
123c8fd01ffSBarry Smith        echo "Completed building Fortran Blas/Lapack libraries";\
124c8fd01ffSBarry Smith        echo "========================================="; fi
125c8fd01ffSBarry Smith#
1266f02d409SBarry Smith#  Compiles MPICH if found
1276f02d409SBarry Smithmpich:
12815876681SBarry Smith	-@releasename=`ls -d mpich* 2> /dev/null`;\
1296f02d409SBarry Smith        if [ -d $${releasename}/${PETSC_ARCH} -a ! -d $${releasename}/${PETSC_ARCH}/lib ] ; then cd $${releasename} ;\
1306f02d409SBarry Smith          echo "=========================================";\
1316f02d409SBarry Smith          echo "Compiling and installing " $${releasename};\
1326f02d409SBarry Smith          make; make install; \
1336f02d409SBarry Smith          echo "=========================================";\
1346f02d409SBarry Smith        fi;
1356f02d409SBarry Smith#
1363677444aSSatish Balay# Builds PETSc test examples for a given BOPT and architecture
1378744090aSBarry Smith#
1380ce59502SBarry Smithtest: chkopts
13904f117c6SBarry Smith	-@echo "Running test examples to verify correct installation"
14004f117c6SBarry Smith	@cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
14104f117c6SBarry Smith	@if [ "${C_FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
14204f117c6SBarry Smith	-@echo "Completed test examples"
1430ce59502SBarry Smith
1443677444aSSatish Balaytestexamples: info chkopts
1453677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
1463677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1473677444aSSatish Balay	-@echo "machines some of the numbers may not match exactly."
1483677444aSSatish Balay	-@echo "========================================="
14919552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_1  tree
1503677444aSSatish Balay	-@echo "Completed compiling and running test examples"
1513677444aSSatish Balay	-@echo "========================================="
1523677444aSSatish Balaytestfortran: info chkopts
1533677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
1543677444aSSatish Balay	-@echo "========================================="
1553677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1563677444aSSatish Balay	-@echo "machines or the way Fortran formats numbers"
1573677444aSSatish Balay	-@echo "some of the results may not match exactly."
1583677444aSSatish Balay	-@echo "========================================="
1594b5d664cSKris Buschelman	-@if [ "${C_FC}" != "" ]; then \
1604b5d664cSKris Buschelman            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3 tree; \
1616d2f2efaSKris Buschelman            echo "Completed compiling and running Fortran test examples"; \
1626d2f2efaSKris Buschelman          else \
1636d2f2efaSKris Buschelman            echo "Error: No FORTRAN compiler available"; \
1644b5d664cSKris Buschelman          fi
1653677444aSSatish Balay	-@echo "========================================="
16601c5c36fSSatish Balaytestexamples_uni: info chkopts
16701c5c36fSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
16801c5c36fSSatish Balay	-@echo "Due to different numerical round-off on certain"
16901c5c36fSSatish Balay	-@echo "machines some of the numbers may not match exactly."
17001c5c36fSSatish Balay	-@echo "========================================="
17119552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_4  tree
17201c5c36fSSatish Balay	-@echo "Completed compiling and running uniprocessor test examples"
17301c5c36fSSatish Balay	-@echo "========================================="
1743677444aSSatish Balaytestfortran_uni: info chkopts
1753677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
1763677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1773677444aSSatish Balay	-@echo "machines some of the numbers may not match exactly."
1783677444aSSatish Balay	-@echo "========================================="
1794b5d664cSKris Buschelman	-@if [ "${C_FC}" != "" ]; then \
1804b5d664cSKris Buschelman            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree; \
1816d2f2efaSKris Buschelman            echo "Completed compiling and running uniprocessor fortran test examples"; \
1826d2f2efaSKris Buschelman          else \
1836d2f2efaSKris Buschelman            echo "Error: No FORTRAN compiler available"; \
1844b5d664cSKris Buschelman          fi
1856d2f2efaSKris Buschelman	-@
1863677444aSSatish Balay	-@echo "========================================="
187ad96cc0dSLois Curfman McInnes
188f3eacedaSSatish Balay# Ranlib on the libraries
1898c37ef55SBarry Smithranlib:
1905fde6e02SSatish Balay	${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
19161523587SBarry Smith
19211b6ed10SLois Curfman McInnes# Deletes PETSc libraries
193f3eacedaSSatish Balaydeletelibs: chkopts_basic
194b87434adSSatish Balay	-${RM} -f ${PETSC_LIB_DIR}/*
195d44968ceSBarry Smith
196a42cec9dSMatthew Knepley# Cleans up build
197a42cec9dSMatthew Knepleyallclean: deletelibs
19819552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
199a42cec9dSMatthew Knepley
200467fbd6dSBarry Smith#
201467fbd6dSBarry Smith#   Updates your PETSc version to the latest set of patches
202467fbd6dSBarry Smith#
203467fbd6dSBarry Smithupdate:
204467fbd6dSBarry Smith	-@bin/petscupdate
2053677444aSSatish Balay
2064918a6b0SSatish Balay#
2074918a6b0SSatish Balay# Check if PETSC_DIR variable specified is valid
2084918a6b0SSatish Balay#
2094918a6b0SSatish Balaychk_petsc_dir:
2104918a6b0SSatish Balay	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
2111390f061SBarry Smith	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
2121390f061SBarry Smith	  echo "You need to use / to separate directories, not \\!"; \
2131390f061SBarry Smith	  echo "Aborting build"; \
2144918a6b0SSatish Balay	  false; fi
2154918a6b0SSatish Balay
2163677444aSSatish Balay# ------------------------------------------------------------------
2173677444aSSatish Balay#
2183677444aSSatish Balay# All remaining actions are intended for PETSc developers only.
2193677444aSSatish Balay# PETSc users should not generally need to use these commands.
2203677444aSSatish Balay#
2213677444aSSatish Balay
22265783a8cSBarry Smith# To access the tags in EMACS, type M-x visit-tags-table and specify
22365783a8cSBarry Smith# the file petsc/TAGS.
22465783a8cSBarry Smith# 1) To move to where a PETSc function is defined, enter M-. and the
22565783a8cSBarry Smith#     function name.
22665783a8cSBarry Smith# 2) To search for a string and move to the first occurrence,
22765783a8cSBarry Smith#     use M-x tags-search and the string.
2287acb7333SLois Curfman McInnes#     To locate later occurrences, use M-,
22911b6ed10SLois Curfman McInnes# Builds all etags files
23011b6ed10SLois Curfman McInnesalletags:
23101c05c5cSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags
23209f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_noexamples
23309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_examples
23409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_makefiles
2354fa9d4e7SBarry Smith# Builds complete etags list
23620563c6bSBarry Smithetags:
23709f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS
23809f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS
23909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcec alltree
24041fa366cSBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcej alltree
24109f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourceh alltree
24209f7043eSSatish Balay	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcef alltree
24309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesc alltree
24409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesf alltree
24509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesch alltree
24609f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesfh alltree
24709f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_makefile alltree
24809f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS etags_bmakefiles
2494fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_docs alltree
2504fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_scripts alltree
25111b6ed10SLois Curfman McInnes# Builds the etags file that excludes the examples directories
252bfce26a3SBarry Smithetags_noexamples:
25309f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_NO_EXAMPLES
25409f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_NO_EXAMPLES
25509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcec alltree
25641fa366cSBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcej alltree
25709f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourceh alltree
25809f7043eSSatish Balay	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcef alltree
25909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_makefile alltree
26009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES etags_bmakefiles
26109f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_docs alltree
26211b6ed10SLois Curfman McInnes# Builds the etags file for makefiles
263b16a3bb1SBarry Smithetags_makefiles:
2647e0368d4SSatish Balay	-${RM} ${TAGSDIR}/TAGS_MAKEFILES
2657e0368d4SSatish Balay	-touch ${TAGSDIR}/TAGS_MAKEFILES
2667e0368d4SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES ACTION=etags_makefile alltree
2677e0368d4SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES etags_bmakefiles
268dc80aa23SSatish Balay# Builds the etags file for examples
269dc80aa23SSatish Balayetags_examples:
27009f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_EXAMPLES
27109f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_EXAMPLES
27209f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesc alltree
27309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesch alltree
27409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesf alltree
27509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
2762176044fSSatish Balayetags_fexamples:
27709f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_FEXAMPLES
27809f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_FEXAMPLES
27909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_FEXAMPLES ACTION=etags_examplesf alltree
28009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
281b38bb785SSatish Balay#
282f20f7ba3SSatish Balay# These are here for the target allci and allco, and etags
2833677444aSSatish Balay#
284b38bb785SSatish Balay
28523bef294SSatish BalayBMAKEFILES = bmake/common/base bmake/common/test \
286516d1546SSatish Balay	     bmake/common/bopt* bmake/*/rules bmake/*/variables bmake/*/packages \
2872bda9e70SSatish Balay	     bmake/*/petscconf.h bmake/*/petscfix.h bmake/config/packages.in \
2882905d4d4SKris Buschelman	     bmake/config/petscfix.h.in  bmake/config/rules.in  \
2892bda9e70SSatish Balay	     bmake/config/variables.in \
2907666ef6eSBarry Smith             bmake/*/buildtest bmake/adic.init bmake/adicmf.init
2912f1ebae6SLois Curfman McInnesDOCS	   = bmake/readme bmake/petscconf.defs
292d56c4d9fSBarry SmithSCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/crontab python/PETSc/Configure.py python/PETSc/Options.py \
293d56c4d9fSBarry Smith             python/PETSc/packages/ADIC.py python/PETSc/packages/MPE.py python/PETSc/packages/Mathematica.py \
294d56c4d9fSBarry Smith             python/PETSc/packages/PLAPACK.py python/PETSc/packages/Triangle.py python/PETSc/packages/Matlab.py \
295d56c4d9fSBarry Smith             python/PETSc/packages/PVODE.py python/PETSc/packages/BlasLapack.py python/PETSc/packages/MPI.py \
296d56c4d9fSBarry Smith             python/PETSc/packages/BlockSolve.py python/PETSc/packages/NetCDF.py python/PETSc/packages/ParMetis.py \
297d56c4d9fSBarry Smith             python/PETSc/packages/update.py
298d56c4d9fSBarry Smith
29911b6ed10SLois Curfman McInnes
3006b91f8d1SSatish Balayupdatewebdocs:
3016b91f8d1SSatish Balay	-chmod -R ug+w /mcs/tmp/petsc-tmp
3026b91f8d1SSatish Balay	-chgrp -R petsc /mcs/tmp/petsc-tmp
3036b91f8d1SSatish Balay	-/bin/rm -rf /mcs/tmp/petscdocs
3046b91f8d1SSatish Balay	-/bin/cp -r /mcs/tmp/petsc-tmp/docs /mcs/tmp/petscdocs
3056b91f8d1SSatish Balay	-maint/update-docs.py /mcs/tmp/petscdocs
3066b91f8d1SSatish Balay	-find /mcs/tmp/petscdocs -type d -name "*" -exec chmod g+w {} \;
3076b91f8d1SSatish Balay	-/bin/cp -r /mcs/tmp/petscdocs/* ${PETSC_DIR}/docs
3086b91f8d1SSatish Balay	-/bin/rm -rf /mcs/tmp/petscdocs
3096b91f8d1SSatish Balay
310ad56a76cSSatish Balaychk_loc:
311ad56a76cSSatish Balay	@if [ ${LOC}foo = foo ] ; then \
312ad56a76cSSatish Balay	  echo "*********************** ERROR ************************" ; \
313ad56a76cSSatish Balay	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
314ad56a76cSSatish Balay	  echo "******************************************************";  false; fi
3152496ca06SSatish Balay
316a2fc510eSBarry Smith# Builds all the documentation - should be done every night
317f1d13e97SSatish Balayalldoc: alldoc1 alldoc2
318f1d13e97SSatish Balay
319f1d13e97SSatish Balay# Build everything that goes into 'doc' dir except html sources
320f1d13e97SSatish Balayalldoc1: chk_loc deletemanualpages chk_concepts_dir
321130c9832SBarry Smith	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
322fe742e3dSSatish Balay	cd docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
323130c9832SBarry Smith	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
32448b2c0e9SBarry Smith	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
325130c9832SBarry Smith	-${OMAKE} ACTION=manexamples tree LOC=${LOC}
326130c9832SBarry Smith	-${OMAKE} manconcepts LOC=${LOC}
32748b2c0e9SBarry Smith	-${OMAKE} ACTION=getexlist tree LOC=${LOC}
32848b2c0e9SBarry Smith	-${OMAKE} ACTION=exampleconcepts tree LOC=${LOC}
32948b2c0e9SBarry Smith	-maint/helpindex.py ${PETSC_DIR} ${LOC}
330e01137a2SSatish Balay
331435da068SBarry Smith# Builds .html versions of the source
332*062da8f7SSatish Balay# html overwrites some stuff created by update-docs - hence this is done later.
333f1d13e97SSatish Balayalldoc2: chk_loc
334*062da8f7SSatish Balay	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC
335*062da8f7SSatish Balay	-maint/update-docs.py ${LOC}
336435da068SBarry Smith
337efaa7783SSatish Balayalldocclean: deletemanualpages allcleanhtml
338efaa7783SSatish Balay
339efaa7783SSatish Balay# Deletes man pages (HTML version)
340efaa7783SSatish Balaydeletemanualpages: chk_loc
341efaa7783SSatish Balay	find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \;
342efaa7783SSatish Balay	${RM} ${LOC}/docs/tex/exampleconcepts
343efaa7783SSatish Balay	${RM} ${LOC}/docs/tex/manconcepts
344efaa7783SSatish Balay	${RM} ${LOC}/docs/manualpages/manualpages.cit
345efaa7783SSatish Balay	-maint/update-docs.py ${LOC} clean
346efaa7783SSatish Balay
347115a300dSBarry Smithallcleanhtml:
348efaa7783SSatish Balay	-${RM} include/adic/*.h.html include/esi/petsc/*.h.html
349cc4dcc40SBarry Smith	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
350395565bcSBarry Smith
351ad56a76cSSatish Balaychk_concepts_dir: chk_loc
352fe742e3dSSatish Balay	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
353bfe54af3SSatish Balay	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
35411b6ed10SLois Curfman McInnes# Builds Fortran stub files
35511b6ed10SLois Curfman McInnesallfortranstubs:
356d77bb2e1SSatish Balay	-@${RM} -f src/fortran/auto/*.c
3570c488147SSatish Balay	-@touch src/fortran/auto/makefile.src
358bbe92fcfSSatish Balay	-${OMAKE} ACTION=fortranstubs tree_basic
3596e1c4064SSatish Balay	-@cd src/fortran/auto; ${RM} makefile.src; echo SOURCEC = ` ls *.c | tr -s '\n' ' '` > makefile.src
360807270aaSBarry Smith	-@cd src/fortran/auto; ${OMAKE} fixfortran
361f6ff2982SSatish Balay
362d55938c2SBarry Smithallci:
36319552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
364b951964fSBarry Smith
365d55938c2SBarry Smithallco:
36619552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
367d55938c2SBarry Smith
368791d64f4SSatish Balay# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
369791d64f4SSatish Balayallrcslabel:
37019552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
371b334301eSBarry Smith#
372b334301eSBarry Smith#   The commands below are for generating ADIC versions of the code;
373b334301eSBarry Smith# they are not currently used.
374b334301eSBarry Smith#
3755eea60f9SBarry Smithalladicignore:
376b87434adSSatish Balay	-@${RM} ${INSTALL_LIB_DIR}/adicignore
37719552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
3785eea60f9SBarry Smith
3795eea60f9SBarry Smithalladic:
380d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC source code in all directories"
38167b024f7SSatish Balay	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
382d18b0ea7SBarry Smith	-@echo "========================================="
38347794344SBarry Smith	-@cd include ; \
38467b024f7SSatish Balay           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
38519552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
38647794344SBarry Smith	-@cd src/inline ; \
38719552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic
38877ed5343SBarry Smith	-@cd src/blaslapack ; \
38919552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
3906e81b665SBarry Smith
39147794344SBarry Smithalladiclib:
392d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC libraries in all directories"
393d77bb2e1SSatish Balay	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
394d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
395d77bb2e1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
396d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
397e0e703c1SSatish Balay	-@echo "Using configuration flags:"
398ba1077baSMatthew Knepley	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
399d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
400d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
401d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
402d77bb2e1SSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
40319552e71SMatthew Knepley	-@echo "Using PETSc arch: ${PETSC_ARCH}"
404d18b0ea7SBarry Smith	-@echo "========================================="
4055fde6e02SSatish Balay	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${LIB_SUFFIX}
40619552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
40777ed5343SBarry Smith	-@cd src/blaslapack ; \
40819552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
4097e351921SBarry Smith	-@cd src/adic/src ; \
41019552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib
4115eea60f9SBarry Smith
4129e417c50SSatish Balay# -------------------------------------------------------------------------------
4139e417c50SSatish Balay#
4149e417c50SSatish Balay# Some macros to check if the fortran interface is up-to-date.
4159e417c50SSatish Balay#
4169e417c50SSatish Balaycountfortranfunctions:
417d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
41885c7cd6cSSatish Balay	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
4199e417c50SSatish Balay	sed "s/_$$//" | sort > /tmp/countfortranfunctions
420b334301eSBarry Smith
4219e417c50SSatish Balaycountcfunctions:
42285c7cd6cSSatish Balay	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
42385c7cd6cSSatish Balay	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
4249e417c50SSatish Balay	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
4259e417c50SSatish Balay
4269e417c50SSatish Balaydifffortranfunctions: countfortranfunctions countcfunctions
4279e417c50SSatish Balay	-@echo -------------- Functions missing in the fortran interface ---------------------
4289700b7f8SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
4299e417c50SSatish Balay	-@echo ----------------- Functions missing in the C interface ------------------------
4309700b7f8SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
431d77bb2e1SSatish Balay	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
432b334301eSBarry Smith
4333f4c9a3aSSatish Balaycheckbadfortranstubs:
4343f4c9a3aSSatish Balay	-@echo "========================================="
4353f4c9a3aSSatish Balay	-@echo "Functions with MPI_Comm as an Argument"
4363f4c9a3aSSatish Balay	-@echo "========================================="
437d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
43885c7cd6cSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4393f4c9a3aSSatish Balay	-@echo "========================================="
4403f4c9a3aSSatish Balay	-@echo "Functions with a String as an Argument"
4413f4c9a3aSSatish Balay	-@echo "========================================="
442d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
44385c7cd6cSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4443f4c9a3aSSatish Balay	-@echo "========================================="
4453f4c9a3aSSatish Balay	-@echo "Functions with Pointers to PETSc Objects as Argument"
4463f4c9a3aSSatish Balay	-@echo "========================================="
447d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; \
44885c7cd6cSSatish Balay	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
44985c7cd6cSSatish Balay	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
4503f4c9a3aSSatish Balay	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
4513f4c9a3aSSatish Balay	for OBJ in $$_p_OBJ; do \
45285c7cd6cSSatish Balay	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
4533f4c9a3aSSatish Balay	cut -d'(' -f1 | cut -d' ' -f1,3; \
4543f4c9a3aSSatish Balay	done
4554556b810SBarry Smith#
4564556b810SBarry Smith# Automatically generates PETSc exercises in html from the tutorial examples.
457b6ea66eeSBarry Smith#
458b6ea66eeSBarry Smith# The introduction for each section is obtained from docs/manualpages/bop.${MANSEC} is under RCS and may be edited
459b6ea66eeSBarry Smith#  (used also in introductions to the manual pages)
460b6ea66eeSBarry Smith# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
461b6ea66eeSBarry Smith# The list of exercises is from TUTORIALS in each directory's makefile
462b6ea66eeSBarry Smith#
4634556b810SBarry Smith# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
4644556b810SBarry Smith# The pagemaker rule is in the file bmake/common (at the bottom)
4654556b810SBarry Smith#
466843ae28eSBarry Smith# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
46797e8d271SBarry Smith#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
468843ae28eSBarry Smith#
46997e8d271SBarry Smithexercises:
47097e8d271SBarry Smith	-@echo "========================================="
47197e8d271SBarry Smith	-@echo "Generating HTML tutorial exercises"
472467fbd6dSBarry Smith	-@${RM} docs/pageform.txt
47397e8d271SBarry Smith	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
47497e8d271SBarry Smith	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
475beb1b3a5SBarry Smith	-@echo "access_format=short"                        >> docs/pageform.txt
47697e8d271SBarry Smith	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
47797e8d271SBarry Smith	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
47897e8d271SBarry Smith	-@echo "Generating HTML for individual directories"
47997e8d271SBarry Smith	-@echo "========================================="
480beb1b3a5SBarry Smith	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
48197e8d271SBarry Smith	-@echo "Completed HTML for individual directories"
48297e8d271SBarry Smith	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
48397e8d271SBarry Smith	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
48497e8d271SBarry Smith	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
48597e8d271SBarry Smith	-@echo "========================================="
48697e8d271SBarry Smith
4878852b4e5SMatthew Knepley.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
488a42cec9dSMatthew Knepley        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples updatewebdocs alldoc allmanualpages \
489a42cec9dSMatthew Knepley        allhtml allcleanhtml allfortranstubs allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
490ca5c9d59SMatthew Knepley        start_configure configure_petsc configure_clean
491f7819401SBarry Smith
492