xref: /petsc/makefile (revision f7819401a49f342aa4161af1966d6b9b61ceb204)
173f4d377SMatthew Knepley# $Id: makefile,v 1.353 2001/08/28 19:43:38 balay Exp $
211b6ed10SLois Curfman McInnes#
3cfd69a58SBarry Smith# This is the makefile for installing PETSc. See the file
47fc3c18eSBarry Smith# docs/installation.html for directions on installing PETSc.
5cfd69a58SBarry Smith# See also bmake/common for additional commands.
611b6ed10SLois Curfman McInnes#
7716b9c40SSatish BalayALL: all
848b2c0e9SBarry SmithLOCDIR = .
9b16a3bb1SBarry SmithDIRS   = src include docs
1061523587SBarry Smith
11516d1546SSatish Balayinclude ${PETSC_DIR}/bmake/common/base
12516d1546SSatish Balayinclude ${PETSC_DIR}/bmake/common/test
1361523587SBarry Smith
14ca5c9d59SMatthew Knepley#
153677444aSSatish Balay# Basic targets to build PETSc libraries.
16fa527775SLois Curfman McInnes# all: builds the c, fortran, and f90 libraries
178852b4e5SMatthew Knepleyall:
1844ecba3fSMatthew Knepley	-@${MAKE} all_build 2>&1 | tee make_log_${PETSC_ARCH}_${BOPT}
19c8fd01ffSBarry Smithall_build: chk_petsc_dir info info_h chklib_dir deletelibs blaslapack build shared
20efd74e9bSBarry Smith#
21fa527775SLois Curfman McInnes# Prints information about the system and version of PETSc being compiled
22efd74e9bSBarry Smith#
23efd74e9bSBarry Smithinfo:
24efd74e9bSBarry Smith	-@echo "=========================================="
2511b6dc0cSBarry Smith	-@echo " "
26d76296fbSBarry Smith	-@echo "See docs/troubleshooting.html and docs/bugreporting.html"
27d76296fbSBarry Smith	-@echo "for help with installation problems. Please send EVERYTHING"
28d76296fbSBarry Smith	-@echo "printed out below when reporting problems"
2911b6dc0cSBarry Smith	-@echo " "
3011b6dc0cSBarry Smith	-@echo "To subscribe to the PETSc users mailing list, send mail to "
3111b6dc0cSBarry Smith	-@echo "majordomo@mcs.anl.gov with the message: "
328b6f49e5SSatish Balay	-@echo "subscribe petsc-announce"
3311b6dc0cSBarry Smith	-@echo " "
34d76296fbSBarry Smith	-@echo "=========================================="
351d91fb6eSBarry Smith	-@echo On `date` on `hostname`
3630fdcc7aSBarry Smith	-@echo Machine characteristics: `uname -a`
37efd74e9bSBarry Smith	-@echo "-----------------------------------------"
380387d3c6SKris Buschelman	-@echo "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS}"
39dffd13fbSMatthew Knepley	-@echo "C Compiler version: " `${C_CCV}`
400387d3c6SKris Buschelman	-@echo "Using C++ compiler: ${CXX_CC} ${COPTFLAGS} ${CCPPFLAGS}"
41dffd13fbSMatthew Knepley	-@echo "C++ Compiler version: " `${CXX_CCV}`
420387d3c6SKris Buschelman	-@echo "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}"
43dffd13fbSMatthew Knepley	-@echo "Fortran Compiler version: " `${C_FCV}`
4447794344SBarry Smith	-@echo "-----------------------------------------"
45bdd8b494SSatish Balay	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
46f265ae5cSBarry Smith	-@echo "-----------------------------------------"
47d77bb2e1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
4847794344SBarry Smith	-@echo "-----------------------------------------"
49e0e703c1SSatish Balay	-@echo "Using configuration flags:"
5019552e71SMatthew Knepley	-@grep "\#define " ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h
5147794344SBarry Smith	-@echo "-----------------------------------------"
52d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
5347794344SBarry Smith	-@echo "-----------------------------------------"
54d77bb2e1SSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
5519552e71SMatthew Knepley	-@echo "Using PETSc arch: ${PETSC_ARCH}"
56efd74e9bSBarry Smith	-@echo "------------------------------------------"
57d77bb2e1SSatish Balay	-@echo "Using C linker: ${CLINKER}"
58d77bb2e1SSatish Balay	-@echo "Using Fortran linker: ${FLINKER}"
59f2b01315SBarry Smith	-@echo "Using libraries: ${PETSC_LIB}"
60e3353558SSatish Balay	-@echo "------------------------------------------"
61e3353558SSatish Balay	-@echo "Using mpirun: ${MPIRUN}"
62efd74e9bSBarry Smith	-@echo "=========================================="
63b8d81f61SBarry Smith#
64b8d81f61SBarry Smith#
6519552e71SMatthew KnepleyMINFO = ${PETSC_DIR}/bmake/${PETSC_ARCH}/petscmachineinfo.h
66b8d81f61SBarry Smithinfo_h:
67ddbfe947SBarry Smith	-@$(RM) -f MINFO ${MINFO}
68c5e9c7dfSBarry Smith	-@echo  "static char *petscmachineinfo = \"  " >> MINFO
6934a92de5SBarry Smith	-@echo  "Libraries compiled on `date` on `hostname` " >> MINFO
70c5e9c7dfSBarry Smith	-@echo  Machine characteristics: `uname -a` "" >> MINFO
71f6a9982fSBarry Smith	-@echo  "Using PETSc directory: ${PETSC_DIR}" >> MINFO
7219552e71SMatthew Knepley	-@echo  "Using PETSc arch: ${PETSC_ARCH}" >> MINFO
7393520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
7493520af8SSatish Balay	-@echo  "static char *petsccompilerinfo = \"  " >> MINFO
755323642bSKris Buschelman	-@echo  "Using C compiler: ${C_CC} ${COPTFLAGS} ${CCPPFLAGS} " >> MINFO
76dffd13fbSMatthew Knepley	-@echo  "C Compiler version:"  >> MINFO ; ${C_CCV} >> MINFO 2>&1 ; true
77dffd13fbSMatthew Knepley	-@echo  "C++ Compiler version:"  >> MINFO; ${CXX_CCV} >> MINFO 2>&1 ; true
785323642bSKris Buschelman	-@echo  "Using Fortran compiler: ${C_FC} ${FOPTFLAGS} ${FCPPFLAGS}" >> MINFO
79dffd13fbSMatthew Knepley	-@echo  "Fortran Compiler version:" >> MINFO ; ${C_FCV} >> MINFO 2>&1 ; true
8093520af8SSatish Balay	-@echo  "-----------------------------------------\"; " >> MINFO
8193520af8SSatish Balay	-@echo  "static char *petsccompilerflagsinfo = \"  " >> MINFO
82c5e9c7dfSBarry Smith	-@echo  "Using PETSc flags: ${PETSCFLAGS} ${PCONF}" >> MINFO
83c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
84c5e9c7dfSBarry Smith	-@echo  "Using configuration flags:" >> MINFO
85c5e9c7dfSBarry Smith	-@echo  "-----------------------------------------" >> MINFO
86c5e9c7dfSBarry Smith	-@echo  "Using include paths: ${PETSC_INCLUDE}" >> MINFO
8793520af8SSatish Balay	-@echo  "------------------------------------------\"; " >> MINFO
8893520af8SSatish Balay	-@echo  "static char *petsclinkerinfo = \"  " >> MINFO
89c5e9c7dfSBarry Smith	-@echo  "Using C linker: ${CLINKER}" >> MINFO
90c5e9c7dfSBarry Smith	-@echo  "Using Fortran linker: ${FLINKER}" >> MINFO
9193520af8SSatish Balay	-@echo  "Using libraries: ${PETSC_LIB} \"; " >> MINFO
92dd6a0ae0SKris Buschelman	-@cat MINFO | ${SED} -e 's/\^M//' | ${SED} -e 's/\\/\\\\/g' | ${SED} -e 's/$$/ \\n\\/' | sed -e 's/\;  \\n\\/\;/'> ${MINFO}
939c0905fcSSatish Balay	-@$(RM) MINFO
94ce0f4ea0SKris Buschelman
953677444aSSatish Balay#
96fa527775SLois Curfman McInnes# Builds the PETSc libraries
97fa527775SLois Curfman McInnes# This target also builds fortran77 and f90 interface
98f6a9982fSBarry Smith# files and compiles .F files
993677444aSSatish Balay#
100f6a9982fSBarry Smithbuild:
101efd74e9bSBarry Smith	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
10247794344SBarry Smith	-@echo "========================================="
10344ecba3fSMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
1045fde6e02SSatish Balay	-@${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
1050b3634f8SBarry Smith	-@echo "Completed building libraries"
10647794344SBarry Smith	-@echo "========================================="
10735ca7349SBarry Smith#
108c8fd01ffSBarry Smith#  Compiles the blas and lapack source code if found
109c8fd01ffSBarry Smithblaslapack:
110c8fd01ffSBarry Smith	-@if [ -d f2cblaslapack/${PETSC_ARCH} -a ! -s f2cblaslapack/${PETSC_ARCH}/libf2cblas.a ] ; then cd f2cblaslapack;\
111c8fd01ffSBarry Smith        echo "=========================================";\
112c8fd01ffSBarry Smith        echo "Building C Blas/Lapack libraries";\
113c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
114c8fd01ffSBarry Smith        ${MV} libf2cblas.a libf2clapack.a ${PETSC_ARCH};\
115c8fd01ffSBarry Smith        echo "Completed C building Blas/Lapack libraries";\
116c8fd01ffSBarry Smith        echo "========================================="; fi
117c8fd01ffSBarry Smith	-@if [ -d fblaslapack/${PETSC_ARCH} -a ! -s fblaslapack/${PETSC_ARCH}/libfblas.a ] ; then cd fblaslapack;\
118c8fd01ffSBarry Smith        echo "=========================================";\
119c8fd01ffSBarry Smith        echo "Building Fortran Blas/Lapack libraries";\
120c8fd01ffSBarry Smith        ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ;\
121c8fd01ffSBarry Smith        ${MV} libfblas.a libflapack.a ${PETSC_ARCH};\
122c8fd01ffSBarry Smith        echo "Completed building Fortran Blas/Lapack libraries";\
123c8fd01ffSBarry Smith        echo "========================================="; fi
124c8fd01ffSBarry Smith#
1253677444aSSatish Balay# Builds PETSc test examples for a given BOPT and architecture
1268744090aSBarry Smith#
1270ce59502SBarry Smithtest: chkopts
12804f117c6SBarry Smith	-@echo "Running test examples to verify correct installation"
12904f117c6SBarry Smith	@cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
13004f117c6SBarry Smith	@if [ "${C_FC}" != "" ]; then cd src/snes/examples/tutorials; ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
13104f117c6SBarry Smith	-@echo "Completed test examples"
1320ce59502SBarry Smith
1333677444aSSatish Balaytestexamples: info chkopts
1343677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
1353677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1363677444aSSatish Balay	-@echo "machines some of the numbers may not match exactly."
1373677444aSSatish Balay	-@echo "========================================="
13819552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_1  tree
1393677444aSSatish Balay	-@echo "Completed compiling and running test examples"
1403677444aSSatish Balay	-@echo "========================================="
1413677444aSSatish Balaytestfortran: info chkopts
1423677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
1433677444aSSatish Balay	-@echo "========================================="
1443677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1453677444aSSatish Balay	-@echo "machines or the way Fortran formats numbers"
1463677444aSSatish Balay	-@echo "some of the results may not match exactly."
1473677444aSSatish Balay	-@echo "========================================="
14819552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_3  tree
1493677444aSSatish Balay	-@echo "Completed compiling and running Fortran test examples"
1503677444aSSatish Balay	-@echo "========================================="
15101c5c36fSSatish Balaytestexamples_uni: info chkopts
15201c5c36fSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
15301c5c36fSSatish Balay	-@echo "Due to different numerical round-off on certain"
15401c5c36fSSatish Balay	-@echo "machines some of the numbers may not match exactly."
15501c5c36fSSatish Balay	-@echo "========================================="
15619552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_4  tree
15701c5c36fSSatish Balay	-@echo "Completed compiling and running uniprocessor test examples"
15801c5c36fSSatish Balay	-@echo "========================================="
1593677444aSSatish Balaytestfortran_uni: info chkopts
1603677444aSSatish Balay	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
1613677444aSSatish Balay	-@echo "Due to different numerical round-off on certain"
1623677444aSSatish Balay	-@echo "machines some of the numbers may not match exactly."
1633677444aSSatish Balay	-@echo "========================================="
16419552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_9  tree
1653677444aSSatish Balay	-@echo "Completed compiling and running uniprocessor fortran test examples"
1663677444aSSatish Balay	-@echo "========================================="
167ad96cc0dSLois Curfman McInnes
168f3eacedaSSatish Balay# Ranlib on the libraries
1698c37ef55SBarry Smithranlib:
1705fde6e02SSatish Balay	${RANLIB} ${PETSC_LIB_DIR}/*.${LIB_SUFFIX}
17161523587SBarry Smith
17211b6ed10SLois Curfman McInnes# Deletes PETSc libraries
173f3eacedaSSatish Balaydeletelibs: chkopts_basic
174b87434adSSatish Balay	-${RM} -f ${PETSC_LIB_DIR}/*
175d44968ceSBarry Smith
176a42cec9dSMatthew Knepley# Cleans up build
177a42cec9dSMatthew Knepleyallclean: deletelibs
17819552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
179a42cec9dSMatthew Knepley
180467fbd6dSBarry Smith#
181467fbd6dSBarry Smith#   Updates your PETSc version to the latest set of patches
182467fbd6dSBarry Smith#
183467fbd6dSBarry Smithupdate:
184467fbd6dSBarry Smith	-@bin/petscupdate
1853677444aSSatish Balay
1864918a6b0SSatish Balay#
1874918a6b0SSatish Balay# Check if PETSC_DIR variable specified is valid
1884918a6b0SSatish Balay#
1894918a6b0SSatish Balaychk_petsc_dir:
1904918a6b0SSatish Balay	@if [ ! -f ${PETSC_DIR}/include/petscversion.h ]; then \
1911390f061SBarry Smith	  echo "Incorrect PETSC_DIR specified: ${PETSC_DIR}!"; \
1921390f061SBarry Smith	  echo "You need to use / to separate directories, not \\!"; \
1931390f061SBarry Smith	  echo "Aborting build"; \
1944918a6b0SSatish Balay	  false; fi
1954918a6b0SSatish Balay
1963677444aSSatish Balay# ------------------------------------------------------------------
1973677444aSSatish Balay#
1983677444aSSatish Balay# All remaining actions are intended for PETSc developers only.
1993677444aSSatish Balay# PETSc users should not generally need to use these commands.
2003677444aSSatish Balay#
2013677444aSSatish Balay
20265783a8cSBarry Smith# To access the tags in EMACS, type M-x visit-tags-table and specify
20365783a8cSBarry Smith# the file petsc/TAGS.
20465783a8cSBarry Smith# 1) To move to where a PETSc function is defined, enter M-. and the
20565783a8cSBarry Smith#     function name.
20665783a8cSBarry Smith# 2) To search for a string and move to the first occurrence,
20765783a8cSBarry Smith#     use M-x tags-search and the string.
2087acb7333SLois Curfman McInnes#     To locate later occurrences, use M-,
20911b6ed10SLois Curfman McInnes# Builds all etags files
21011b6ed10SLois Curfman McInnesalletags:
21101c05c5cSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags
21209f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_noexamples
21309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_examples
21409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSDIR=${PETSC_DIR} etags_makefiles
2154fa9d4e7SBarry Smith# Builds complete etags list
21620563c6bSBarry Smithetags:
21709f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS
21809f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS
21909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcec alltree
22041fa366cSBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcej alltree
22109f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourceh alltree
22209f7043eSSatish Balay	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_sourcef alltree
22309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesc alltree
22409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesf alltree
22509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesch alltree
22609f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_examplesfh alltree
22709f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_makefile alltree
22809f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS etags_bmakefiles
2294fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_docs alltree
2304fa9d4e7SBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS ACTION=etags_scripts alltree
23111b6ed10SLois Curfman McInnes# Builds the etags file that excludes the examples directories
232bfce26a3SBarry Smithetags_noexamples:
23309f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_NO_EXAMPLES
23409f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_NO_EXAMPLES
23509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcec alltree
23641fa366cSBarry Smith	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcej alltree
23709f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourceh alltree
23809f7043eSSatish Balay	-cd src/fortran; ${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_sourcef alltree
23909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_makefile alltree
24009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES etags_bmakefiles
24109f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_NO_EXAMPLES ACTION=etags_docs alltree
24211b6ed10SLois Curfman McInnes# Builds the etags file for makefiles
243b16a3bb1SBarry Smithetags_makefiles:
2447e0368d4SSatish Balay	-${RM} ${TAGSDIR}/TAGS_MAKEFILES
2457e0368d4SSatish Balay	-touch ${TAGSDIR}/TAGS_MAKEFILES
2467e0368d4SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES ACTION=etags_makefile alltree
2477e0368d4SSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_MAKEFILES etags_bmakefiles
248dc80aa23SSatish Balay# Builds the etags file for examples
249dc80aa23SSatish Balayetags_examples:
25009f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_EXAMPLES
25109f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_EXAMPLES
25209f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesc alltree
25309f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesch alltree
25409f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesf alltree
25509f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
2562176044fSSatish Balayetags_fexamples:
25709f7043eSSatish Balay	-${RM} ${TAGSDIR}/TAGS_FEXAMPLES
25809f7043eSSatish Balay	-touch ${TAGSDIR}/TAGS_FEXAMPLES
25909f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_FEXAMPLES ACTION=etags_examplesf alltree
26009f7043eSSatish Balay	-${OMAKE} PETSC_DIR=${PETSC_DIR} TAGSFILE=${TAGSDIR}/TAGS_EXAMPLES ACTION=etags_examplesfh alltree
261b38bb785SSatish Balay#
262f20f7ba3SSatish Balay# These are here for the target allci and allco, and etags
2633677444aSSatish Balay#
264b38bb785SSatish Balay
26523bef294SSatish BalayBMAKEFILES = bmake/common/base bmake/common/test \
266516d1546SSatish Balay	     bmake/common/bopt* bmake/*/rules bmake/*/variables bmake/*/packages \
2672bda9e70SSatish Balay	     bmake/*/petscconf.h bmake/*/petscfix.h bmake/config/packages.in \
2682905d4d4SKris Buschelman	     bmake/config/petscfix.h.in  bmake/config/rules.in  \
2692bda9e70SSatish Balay	     bmake/config/variables.in \
2707666ef6eSBarry Smith             bmake/*/buildtest bmake/adic.init bmake/adicmf.init
2712f1ebae6SLois Curfman McInnesDOCS	   = bmake/readme bmake/petscconf.defs
272d56c4d9fSBarry SmithSCRIPTS    = maint/builddist  maint/wwwman maint/xclude maint/crontab python/PETSc/Configure.py python/PETSc/Options.py \
273d56c4d9fSBarry Smith             python/PETSc/packages/ADIC.py python/PETSc/packages/MPE.py python/PETSc/packages/Mathematica.py \
274d56c4d9fSBarry Smith             python/PETSc/packages/PLAPACK.py python/PETSc/packages/Triangle.py python/PETSc/packages/Matlab.py \
275d56c4d9fSBarry Smith             python/PETSc/packages/PVODE.py python/PETSc/packages/BlasLapack.py python/PETSc/packages/MPI.py \
276d56c4d9fSBarry Smith             python/PETSc/packages/BlockSolve.py python/PETSc/packages/NetCDF.py python/PETSc/packages/ParMetis.py \
277d56c4d9fSBarry Smith             python/PETSc/packages/update.py
278d56c4d9fSBarry Smith
27911b6ed10SLois Curfman McInnes
2806b91f8d1SSatish Balayupdatewebdocs:
2816b91f8d1SSatish Balay	-chmod -R ug+w /mcs/tmp/petsc-tmp
2826b91f8d1SSatish Balay	-chgrp -R petsc /mcs/tmp/petsc-tmp
2836b91f8d1SSatish Balay	-/bin/rm -rf /mcs/tmp/petscdocs
2846b91f8d1SSatish Balay	-/bin/cp -r /mcs/tmp/petsc-tmp/docs /mcs/tmp/petscdocs
2856b91f8d1SSatish Balay	-maint/update-docs.py /mcs/tmp/petscdocs
2866b91f8d1SSatish Balay	-find /mcs/tmp/petscdocs -type d -name "*" -exec chmod g+w {} \;
2876b91f8d1SSatish Balay	-/bin/cp -r /mcs/tmp/petscdocs/* ${PETSC_DIR}/docs
2886b91f8d1SSatish Balay	-/bin/rm -rf /mcs/tmp/petscdocs
2896b91f8d1SSatish Balay
290ad56a76cSSatish Balaychk_loc:
291ad56a76cSSatish Balay	@if [ ${LOC}foo = foo ] ; then \
292ad56a76cSSatish Balay	  echo "*********************** ERROR ************************" ; \
293ad56a76cSSatish Balay	  echo " Please specify LOC variable for eg: make allmanualpages LOC=/sandbox/petsc"; \
294ad56a76cSSatish Balay	  echo "******************************************************";  false; fi
2952496ca06SSatish Balay
296a2fc510eSBarry Smith# Builds all the documentation - should be done every night
297f1d13e97SSatish Balayalldoc: alldoc1 alldoc2
298f1d13e97SSatish Balay
299f1d13e97SSatish Balay# Build everything that goes into 'doc' dir except html sources
300f1d13e97SSatish Balayalldoc1: chk_loc deletemanualpages chk_concepts_dir
301130c9832SBarry Smith	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
302fe742e3dSSatish Balay	cd docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
303130c9832SBarry Smith	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
30448b2c0e9SBarry Smith	-maint/wwwindex.py ${PETSC_DIR} ${LOC}
305130c9832SBarry Smith	-${OMAKE} ACTION=manexamples tree LOC=${LOC}
306130c9832SBarry Smith	-${OMAKE} manconcepts LOC=${LOC}
30748b2c0e9SBarry Smith	-${OMAKE} ACTION=getexlist tree LOC=${LOC}
30848b2c0e9SBarry Smith	-${OMAKE} ACTION=exampleconcepts tree LOC=${LOC}
30948b2c0e9SBarry Smith	-maint/helpindex.py ${PETSC_DIR} ${LOC}
310f1d13e97SSatish Balay	-maint/update-docs.py ${LOC}
311e01137a2SSatish Balay
312435da068SBarry Smith# Builds .html versions of the source
313f1d13e97SSatish Balayalldoc2: chk_loc
314cc4dcc40SBarry Smith	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
315435da068SBarry Smith
316efaa7783SSatish Balayalldocclean: deletemanualpages allcleanhtml
317efaa7783SSatish Balay
318efaa7783SSatish Balay# Deletes man pages (HTML version)
319efaa7783SSatish Balaydeletemanualpages: chk_loc
320efaa7783SSatish Balay	find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \;
321efaa7783SSatish Balay	${RM} ${LOC}/docs/tex/exampleconcepts
322efaa7783SSatish Balay	${RM} ${LOC}/docs/tex/manconcepts
323efaa7783SSatish Balay	${RM} ${LOC}/docs/manualpages/manualpages.cit
324efaa7783SSatish Balay	-maint/update-docs.py ${LOC} clean
325efaa7783SSatish Balay
326115a300dSBarry Smithallcleanhtml:
327efaa7783SSatish Balay	-${RM} include/adic/*.h.html include/esi/petsc/*.h.html
328cc4dcc40SBarry Smith	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
329395565bcSBarry Smith
330ad56a76cSSatish Balaychk_concepts_dir: chk_loc
331fe742e3dSSatish Balay	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
332bfe54af3SSatish Balay	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
33311b6ed10SLois Curfman McInnes# Builds Fortran stub files
33411b6ed10SLois Curfman McInnesallfortranstubs:
335d77bb2e1SSatish Balay	-@${RM} -f src/fortran/auto/*.c
3360c488147SSatish Balay	-@touch src/fortran/auto/makefile.src
337bbe92fcfSSatish Balay	-${OMAKE} ACTION=fortranstubs tree_basic
3386e1c4064SSatish Balay	-@cd src/fortran/auto; ${RM} makefile.src; echo SOURCEC = ` ls *.c | tr -s '\n' ' '` > makefile.src
339807270aaSBarry Smith	-@cd src/fortran/auto; ${OMAKE} fixfortran
340f6ff2982SSatish Balay
341d55938c2SBarry Smithallci:
34219552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=ci  alltree
343b951964fSBarry Smith
344d55938c2SBarry Smithallco:
34519552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=co  alltree
346d55938c2SBarry Smith
347791d64f4SSatish Balay# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
348791d64f4SSatish Balayallrcslabel:
34919552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} 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;
352b334301eSBarry Smith# they are not currently used.
353b334301eSBarry Smith#
3545eea60f9SBarry Smithalladicignore:
355b87434adSSatish Balay	-@${RM} ${INSTALL_LIB_DIR}/adicignore
35619552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
3575eea60f9SBarry Smith
3585eea60f9SBarry Smithalladic:
359d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC source code in all directories"
36067b024f7SSatish Balay	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
361d18b0ea7SBarry Smith	-@echo "========================================="
36247794344SBarry Smith	-@cd include ; \
36367b024f7SSatish Balay           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petsc.h
36419552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
36547794344SBarry Smith	-@cd src/inline ; \
36619552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} adic
36777ed5343SBarry Smith	-@cd src/blaslapack ; \
36819552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
3696e81b665SBarry Smith
37047794344SBarry Smithalladiclib:
371d18b0ea7SBarry Smith	-@echo "Beginning to compile ADIC libraries in all directories"
372d77bb2e1SSatish Balay	-@echo "Using compiler: ${CC} ${COPTFLAGS}"
373d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
374d77bb2e1SSatish Balay	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
375d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
376e0e703c1SSatish Balay	-@echo "Using configuration flags:"
377ba1077baSMatthew Knepley	-@grep "define " bmake/${INLUDE_ARCH}/petscconf.h
378d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
379d77bb2e1SSatish Balay	-@echo "Using include paths: ${PETSC_INCLUDE}"
380d18b0ea7SBarry Smith	-@echo "-----------------------------------------"
381d77bb2e1SSatish Balay	-@echo "Using PETSc directory: ${PETSC_DIR}"
38219552e71SMatthew Knepley	-@echo "Using PETSc arch: ${PETSC_ARCH}"
383d18b0ea7SBarry Smith	-@echo "========================================="
3845fde6e02SSatish Balay	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${LIB_SUFFIX}
38519552e71SMatthew Knepley	-@${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
38677ed5343SBarry Smith	-@cd src/blaslapack ; \
38719552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
3887e351921SBarry Smith	-@cd src/adic/src ; \
38919552e71SMatthew Knepley            ${OMAKE} BOPT=${BOPT} PETSC_ARCH=${PETSC_ARCH} lib
3905eea60f9SBarry Smith
3919e417c50SSatish Balay# -------------------------------------------------------------------------------
3929e417c50SSatish Balay#
3939e417c50SSatish Balay# Some macros to check if the fortran interface is up-to-date.
3949e417c50SSatish Balay#
3959e417c50SSatish Balaycountfortranfunctions:
396d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
39785c7cd6cSSatish Balay	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
3989e417c50SSatish Balay	sed "s/_$$//" | sort > /tmp/countfortranfunctions
399b334301eSBarry Smith
4009e417c50SSatish Balaycountcfunctions:
40185c7cd6cSSatish Balay	-@ grep extern ${PETSC_DIR}/include/*.h *.h | grep "(" | tr -s ' ' | \
40285c7cd6cSSatish Balay	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
4039e417c50SSatish Balay	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
4049e417c50SSatish Balay
4059e417c50SSatish Balaydifffortranfunctions: countfortranfunctions countcfunctions
4069e417c50SSatish Balay	-@echo -------------- Functions missing in the fortran interface ---------------------
4079700b7f8SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
4089e417c50SSatish Balay	-@echo ----------------- Functions missing in the C interface ------------------------
4099700b7f8SSatish Balay	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
410d77bb2e1SSatish Balay	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
411b334301eSBarry Smith
4123f4c9a3aSSatish Balaycheckbadfortranstubs:
4133f4c9a3aSSatish Balay	-@echo "========================================="
4143f4c9a3aSSatish Balay	-@echo "Functions with MPI_Comm as an Argument"
4153f4c9a3aSSatish Balay	-@echo "========================================="
416d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
41785c7cd6cSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4183f4c9a3aSSatish Balay	-@echo "========================================="
4193f4c9a3aSSatish Balay	-@echo "Functions with a String as an Argument"
4203f4c9a3aSSatish Balay	-@echo "========================================="
421d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
42285c7cd6cSSatish Balay	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
4233f4c9a3aSSatish Balay	-@echo "========================================="
4243f4c9a3aSSatish Balay	-@echo "Functions with Pointers to PETSc Objects as Argument"
4253f4c9a3aSSatish Balay	-@echo "========================================="
426d77bb2e1SSatish Balay	-@cd ${PETSC_DIR}/src/fortran/auto; \
42785c7cd6cSSatish Balay	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
42885c7cd6cSSatish Balay	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
4293f4c9a3aSSatish Balay	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
4303f4c9a3aSSatish Balay	for OBJ in $$_p_OBJ; do \
43185c7cd6cSSatish Balay	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
4323f4c9a3aSSatish Balay	cut -d'(' -f1 | cut -d' ' -f1,3; \
4333f4c9a3aSSatish Balay	done
4344556b810SBarry Smith#
4354556b810SBarry Smith# Automatically generates PETSc exercises in html from the tutorial examples.
436b6ea66eeSBarry Smith#
437b6ea66eeSBarry Smith# The introduction for each section is obtained from docs/manualpages/bop.${MANSEC} is under RCS and may be edited
438b6ea66eeSBarry Smith#  (used also in introductions to the manual pages)
439b6ea66eeSBarry Smith# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
440b6ea66eeSBarry Smith# The list of exercises is from TUTORIALS in each directory's makefile
441b6ea66eeSBarry Smith#
4424556b810SBarry Smith# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
4434556b810SBarry Smith# The pagemaker rule is in the file bmake/common (at the bottom)
4444556b810SBarry Smith#
445843ae28eSBarry Smith# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
44697e8d271SBarry Smith#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
447843ae28eSBarry Smith#
44897e8d271SBarry Smithexercises:
44997e8d271SBarry Smith	-@echo "========================================="
45097e8d271SBarry Smith	-@echo "Generating HTML tutorial exercises"
451467fbd6dSBarry Smith	-@${RM} docs/pageform.txt
45297e8d271SBarry Smith	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
45397e8d271SBarry Smith	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
454beb1b3a5SBarry Smith	-@echo "access_format=short"                        >> docs/pageform.txt
45597e8d271SBarry Smith	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
45697e8d271SBarry Smith	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
45797e8d271SBarry Smith	-@echo "Generating HTML for individual directories"
45897e8d271SBarry Smith	-@echo "========================================="
459beb1b3a5SBarry Smith	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
46097e8d271SBarry Smith	-@echo "Completed HTML for individual directories"
46197e8d271SBarry Smith	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
46297e8d271SBarry Smith	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
46397e8d271SBarry Smith	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
46497e8d271SBarry Smith	-@echo "========================================="
46597e8d271SBarry Smith
4668852b4e5SMatthew Knepley.PHONY: info info_h all all_build build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update chk_petsc_dir \
467a42cec9dSMatthew Knepley        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples updatewebdocs alldoc allmanualpages \
468a42cec9dSMatthew Knepley        allhtml allcleanhtml allfortranstubs allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
469ca5c9d59SMatthew Knepley        start_configure configure_petsc configure_clean
470*f7819401SBarry Smith
471*f7819401SBarry Smithcitool:
472*f7819401SBarry Smith	-@bk citool
473*f7819401SBarry Smith	-@cd python/BuildSystem; bk citool
474*f7819401SBarry Smith
475*f7819401SBarry Smithpull:
476*f7819401SBarry Smith	-@bk pull
477*f7819401SBarry Smith	-@cd python/BuildSystem; bk pull
478*f7819401SBarry Smith
479*f7819401SBarry Smithpush:
480*f7819401SBarry Smith	-@bk push
481*f7819401SBarry Smith	-@cd python/BuildSystem; bk push
482*f7819401SBarry Smith
483