xref: /petsc/makefile (revision 227c2ee5aa2d893fad34172c4d1eb5a4b0fcd16d)
1753a1a87SJed Brown#
2753a1a87SJed Brown# This is the makefile for compiling PETSc. See
3753a1a87SJed Brown# http://www.mcs.anl.gov/petsc/documentation/installation.html for directions on installing PETSc.
4753a1a87SJed Brown# See also conf for additional commands.
5753a1a87SJed Brown#
6753a1a87SJed BrownALL: all
7753a1a87SJed BrownLOCDIR	 = ./
89895aa37SBarry SmithDIRS	 = src include tutorials lua
9753a1a87SJed BrownCFLAGS	 =
10753a1a87SJed BrownFFLAGS	 =
11d4f3a1abSSatish BalayCPPFLAGS =
12d4f3a1abSSatish BalayFPPFLAGS =
13753a1a87SJed Brown
14753a1a87SJed Brown# next line defines PETSC_DIR and PETSC_ARCH if they are not set
15753a1a87SJed Browninclude ././${PETSC_ARCH}/conf/petscvariables
16753a1a87SJed Browninclude ${PETSC_DIR}/conf/variables
17753a1a87SJed Browninclude ${PETSC_DIR}/conf/rules
18753a1a87SJed Browninclude ${PETSC_DIR}/conf/test
19753a1a87SJed Brown
20753a1a87SJed Brown#
21753a1a87SJed Brown# Basic targets to build PETSc libraries.
22753a1a87SJed Brown# all: builds the c, fortran, and f90 libraries
234a18a678SSatish Balayall: chk_makej
24ad5c76d5SBarry Smith	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} chk_petscdir chk_upgrade | tee ${PETSC_ARCH}/conf/make.log
25753a1a87SJed Brown	@ln -sf ${PETSC_ARCH}/conf/make.log make.log
26ac1d0f13SJed Brown	@if [ "${MAKE_IS_GNUMAKE}" != "" ]; then \
27*227c2ee5SSatish Balay	   ${OMAKE_PRINTDIR} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-gnumake-local 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
289481793eSSatish Balay	elif [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \
294252f254SSatish Balay	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-cmake-local 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log \
30753a1a87SJed Brown		| egrep -v '( --check-build-system |cmake -E | -o CMakeFiles/petsc[[:lower:]]*.dir/| -o lib/libpetsc|CMakeFiles/petsc[[:lower:]]*\.dir/(build|depend|requires)|-f CMakeFiles/Makefile2|Dependee .* is newer than depender |provides\.build. is up to date)'; \
31753a1a87SJed Brown	 else \
324252f254SSatish Balay	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-legacy-local 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log \
33753a1a87SJed Brown                | ${GREP} -v "has no symbols"; \
34753a1a87SJed Brown	 fi
35753a1a87SJed Brown	@egrep -i "( error | error: |no such file or directory)" ${PETSC_ARCH}/conf/make.log | tee ${PETSC_ARCH}/conf/error.log > /dev/null
36753a1a87SJed Brown	@if test -s ${PETSC_ARCH}/conf/error.log; then \
375484e79dSBarry Smith           printf ${PETSC_TEXT_HILIGHT}"**************************ERROR************************************\n" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
38753a1a87SJed Brown           echo "  Error during compile, check ${PETSC_ARCH}/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
39753a1a87SJed Brown           echo "  Send it and ${PETSC_ARCH}/conf/configure.log to petsc-maint@mcs.anl.gov" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log;\
405484e79dSBarry Smith           printf "********************************************************************"${PETSC_TEXT_NORMAL}"\n" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log;\
41753a1a87SJed Brown	 else \
42753a1a87SJed Brown	  ${OMAKE} shared_install PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log ;\
43753a1a87SJed Brown        fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below
44753a1a87SJed Brown	@if test -s ${PETSC_ARCH}/conf/error.log; then exit 1; fi
45753a1a87SJed Brown
469481793eSSatish Balayall-gnumake:
47ac1d0f13SJed Brown	@if [ "${MAKE_IS_GNUMAKE}" != "" ]; then \
48*227c2ee5SSatish Balay          ${OMAKE_PRINTDIR}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} PETSC_BUILD_USING_CMAKE="" all;\
499481793eSSatish Balay        else printf ${PETSC_TEXT_HILIGHT}"Build not configured for GNUMAKE. Quiting"${PETSC_TEXT_NORMAL}"\n"; exit 1; fi
509481793eSSatish Balay
514252f254SSatish Balayall-cmake:
524252f254SSatish Balay	@if [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \
53ac1d0f13SJed Brown          ${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} MAKE_IS_GNUMAKE="" all;\
545484e79dSBarry Smith        else printf ${PETSC_TEXT_HILIGHT}"Build not configured for CMAKE. Quiting"${PETSC_TEXT_NORMAL}"\n"; exit 1; fi
55753a1a87SJed Brown
564252f254SSatish Balayall-legacy:
57ac1d0f13SJed Brown	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} PETSC_BUILD_USING_CMAKE="" MAKE_IS_GNUMAKE="" all
589481793eSSatish Balay
599481793eSSatish Balayall-gnumake-local: chk_makej info gnumake
604252f254SSatish Balay
614252f254SSatish Balayall-cmake-local: chk_makej info cmakegen cmake
624252f254SSatish Balay
634252f254SSatish Balayall-legacy-local: chk_makej chklib_dir info deletelibs deletemods build shared_nomesg mpi4py petsc4py
64753a1a87SJed Brown#
65753a1a87SJed Brown# Prints information about the system and version of PETSc being compiled
66753a1a87SJed Brown#
674a18a678SSatish Balayinfo: chk_makej
68753a1a87SJed Brown	-@echo "=========================================="
69753a1a87SJed Brown	-@echo " "
70753a1a87SJed Brown	-@echo "See documentation/faq.html and documentation/bugreporting.html"
71753a1a87SJed Brown	-@echo "for help with installation problems. Please send EVERYTHING"
72753a1a87SJed Brown	-@echo "printed out below when reporting problems"
73753a1a87SJed Brown	-@echo " "
74753a1a87SJed Brown	-@echo "To subscribe to the PETSc announcement list, send mail to "
75753a1a87SJed Brown	-@echo "majordomo@mcs.anl.gov with the message: "
76753a1a87SJed Brown	-@echo "subscribe petsc-announce"
77753a1a87SJed Brown	-@echo " "
78753a1a87SJed Brown	-@echo "To subscribe to the PETSc users mailing list, send mail to "
79753a1a87SJed Brown	-@echo "majordomo@mcs.anl.gov with the message: "
80753a1a87SJed Brown	-@echo "subscribe petsc-users"
81753a1a87SJed Brown	-@echo " "
82753a1a87SJed Brown	-@echo "=========================================="
83753a1a87SJed Brown	-@echo On `date` on `hostname`
84753a1a87SJed Brown	-@echo Machine characteristics: `uname -a`
85753a1a87SJed Brown	-@echo "-----------------------------------------"
86753a1a87SJed Brown	-@echo "Using PETSc directory: ${PETSC_DIR}"
87753a1a87SJed Brown	-@echo "Using PETSc arch: ${PETSC_ARCH}"
88753a1a87SJed Brown	-@echo "-----------------------------------------"
89753a1a87SJed Brown	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
90753a1a87SJed Brown	-@echo "-----------------------------------------"
91753a1a87SJed Brown	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
92753a1a87SJed Brown	-@echo "Using configuration flags:"
93753a1a87SJed Brown	-@grep "\#define " ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h
94753a1a87SJed Brown	-@echo "-----------------------------------------"
95da0b7683SSatish Balay	-@echo "Using C/C++ compile: ${PETSC_COMPILE}"
96607e78e0SSatish Balay	-@if [ "${PETSC_LANGUAGE}" = "CONLY" -a "${MPICC_SHOW}" != "" ]; then \
97fd0cdb26SSatish Balay             printf  "mpicc -show: %b\n" "${MPICC_SHOW}"; \
98607e78e0SSatish Balay	  elif [ "${PETSC_LANGUAGE}" = "CXXONLY" -a "${MPICXX_SHOW}" != "" ]; then \
99fd0cdb26SSatish Balay             printf "mpicxx -show: %b\n" "${MPICXX_SHOW}"; \
100607e78e0SSatish Balay          fi;
101753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
102da0b7683SSatish Balay	   echo "Using Fortran compile: ${PETSC_FCOMPILE}";\
103607e78e0SSatish Balay           if [ "${MPIFC_SHOW}" != "" ]; then \
104fd0cdb26SSatish Balay             printf "mpif90 -show: %b\n" "${MPIFC_SHOW}"; \
105607e78e0SSatish Balay           fi; \
106da0b7683SSatish Balay         fi
107da0b7683SSatish Balay	-@if [ "${CUDAC}" != "" ]; then \
108da0b7683SSatish Balay	   echo "Using CUDA compile: ${PETSC_CUCOMPILE}";\
109753a1a87SJed Brown         fi
110753a1a87SJed Brown	-@echo "-----------------------------------------"
111753a1a87SJed Brown	-@echo "Using C/C++ linker: ${PCC_LINKER}"
112753a1a87SJed Brown	-@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}"
113753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
114753a1a87SJed Brown	   echo "Using Fortran linker: ${FC_LINKER}";\
115753a1a87SJed Brown	   echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\
116753a1a87SJed Brown         fi
117753a1a87SJed Brown	-@echo "-----------------------------------------"
118753a1a87SJed Brown	-@echo "Using libraries: ${PETSC_LIB}"
119753a1a87SJed Brown	-@echo "------------------------------------------"
120753a1a87SJed Brown	-@echo "Using mpiexec: ${MPIEXEC}"
121753a1a87SJed Brown	-@echo "=========================================="
122753a1a87SJed Brown
123753a1a87SJed Brown#
124753a1a87SJed Brown# Builds the PETSc libraries
125753a1a87SJed Brown# This target also builds fortran77 and f90 interface
126753a1a87SJed Brown# files and compiles .F files
127753a1a87SJed Brown#
1284a18a678SSatish Balaybuild: chk_makej
129753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
130753a1a87SJed Brown	-@echo "========================================="
131753a1a87SJed Brown	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
132753a1a87SJed Brown	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}  > tmpf 2>&1 ; ${GREP} -v "has no symbols" tmpf; ${RM} tmpf;
133753a1a87SJed Brown	-@echo "Completed building libraries"
134753a1a87SJed Brown	-@echo "========================================="
135753a1a87SJed Brown#
136753a1a87SJed Brown#
137753a1a87SJed Brown# Builds PETSc test examples for a given architecture
138753a1a87SJed Brown#
13956879a31SBarry Smithcheck: test
140753a1a87SJed Browntest:
141*227c2ee5SSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} test_build 2>&1 | tee ./${PETSC_ARCH}/conf/test.log
142753a1a87SJed Browntestx:
143*227c2ee5SSatish Balay	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testx_build 2>&1 | tee ./${PETSC_ARCH}/conf/testx.log
144753a1a87SJed Browntest_build:
145753a1a87SJed Brown	-@echo "Running test examples to verify correct installation"
146753a1a87SJed Brown	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
147*227c2ee5SSatish Balay	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
148*227c2ee5SSatish Balay	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
1494b66f5ecSSatish Balay	@if [ "${FC}" != "" ]; then \
1504b66f5ecSSatish Balay          egrep "^#define PETSC_USE_FORTRAN_DATATYPES 1" ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h | tee .ftn-dtype.log > /dev/null; \
1514b66f5ecSSatish Balay          if test -s .ftn-dtype.log; then F90TEST="testex5f90t"; else F90TEST="testex5f"; fi; ${RM} .ftn-dtype.log; \
152*227c2ee5SSatish Balay          cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} $${F90TEST}; \
1534b66f5ecSSatish Balay         fi;
154*227c2ee5SSatish Balay	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
155753a1a87SJed Brown	-@echo "Completed test examples"
156753a1a87SJed Browntestx_build:
157753a1a87SJed Brown	-@echo "Running graphics test example to verify correct X11 installation"
158753a1a87SJed Brown	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
159*227c2ee5SSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
160*227c2ee5SSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testxex19
161*227c2ee5SSatish Balay	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
162753a1a87SJed Brown	-@echo "Completed graphics test example"
163753a1a87SJed Brown
164753a1a87SJed Browntestexamples: info
165753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
166753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
167753a1a87SJed Brown	-@echo "machines some of the numbers may not match exactly."
168753a1a87SJed Brown	-@echo "========================================="
169753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C  tree
170753a1a87SJed Brown	-@echo "Completed compiling and running test examples"
171753a1a87SJed Brown	-@echo "========================================="
172753a1a87SJed Browntestfortran: info
173753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
174753a1a87SJed Brown	-@echo "========================================="
175753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
176753a1a87SJed Brown	-@echo "machines or the way Fortran formats numbers"
177753a1a87SJed Brown	-@echo "some of the results may not match exactly."
178753a1a87SJed Brown	-@echo "========================================="
179753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
180753a1a87SJed Brown            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran tree; \
181753a1a87SJed Brown            echo "Completed compiling and running Fortran test examples"; \
182753a1a87SJed Brown          else \
183753a1a87SJed Brown            echo "Error: No FORTRAN compiler available"; \
184753a1a87SJed Brown          fi
185753a1a87SJed Brown	-@echo "========================================="
186753a1a87SJed Browntestexamples_uni: info
187753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
188753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
189753a1a87SJed Brown	-@echo "machines some of the numbers may not match exactly."
190753a1a87SJed Brown	-@echo "========================================="
191753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C_X_MPIUni  tree
192753a1a87SJed Brown	-@echo "Completed compiling and running uniprocessor test examples"
193753a1a87SJed Brown	-@echo "========================================="
194753a1a87SJed Browntestfortran_uni: info
195753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
196753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
197753a1a87SJed Brown	-@echo "machines some of the numbers may not match exactly."
198753a1a87SJed Brown	-@echo "========================================="
199753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
200753a1a87SJed Brown            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran_MPIUni  tree; \
201753a1a87SJed Brown            echo "Completed compiling and running uniprocessor fortran test examples"; \
202753a1a87SJed Brown          else \
203753a1a87SJed Brown            echo "Error: No FORTRAN compiler available"; \
204753a1a87SJed Brown          fi
205753a1a87SJed Brown	-@
206753a1a87SJed Brown	-@echo "========================================="
207753a1a87SJed Brown
208753a1a87SJed Brown# Ranlib on the libraries
209753a1a87SJed Brownranlib:
210753a1a87SJed Brown	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
211753a1a87SJed Brown
212753a1a87SJed Brown# Deletes PETSc libraries
2134a18a678SSatish Balaydeletelibs: chk_makej
214753a1a87SJed Brown	-${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.*
2154a18a678SSatish Balaydeletemods: chk_makej
216753a1a87SJed Brown	-${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod
217753a1a87SJed Brown
218753a1a87SJed Brown# Cleans up build
21958080eacSSatish Balayallclean-legacy: deletelibs deletemods
220753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
22158080eacSSatish Balayallclean-cmake:
22258080eacSSatish Balay	-@cd ${PETSC_ARCH} && ${OMAKE} clean
22358080eacSSatish Balayallclean-gnumake:
22458080eacSSatish Balay	-@${OMAKE} -f gmakefile clean
22558080eacSSatish Balay
22658080eacSSatish Balayallclean:
22758080eacSSatish Balay	@if [ "${MAKE_IS_GNUMAKE}" != "" ]; then \
22858080eacSSatish Balay	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} allclean-gnumake; \
22958080eacSSatish Balay	elif [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \
23058080eacSSatish Balay	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} allclean-cmake; \
23158080eacSSatish Balay	else \
23258080eacSSatish Balay	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} allclean-legacy; \
23358080eacSSatish Balay	fi
234753a1a87SJed Brown#
235753a1a87SJed Brownreconfigure:
236753a1a87SJed Brown	@${PYTHON} ${PETSC_ARCH}/conf/reconfigure-${PETSC_ARCH}.py
237753a1a87SJed Brown#
238753a1a87SJed Browninstall:
239753a1a87SJed Brown	@${PYTHON} ./config/install.py -destDir=${DESTDIR}
240753a1a87SJed Brown
241753a1a87SJed Brownnewall:
242753a1a87SJed Brown	-@cd src/sys;  @${PYTHON} ${PETSC_DIR}/config/builder.py
243753a1a87SJed Brown	-@cd src/vec;  @${PYTHON} ${PETSC_DIR}/config/builder.py
244753a1a87SJed Brown	-@cd src/mat;  @${PYTHON} ${PETSC_DIR}/config/builder.py
245753a1a87SJed Brown	-@cd src/dm;   @${PYTHON} ${PETSC_DIR}/config/builder.py
246753a1a87SJed Brown	-@cd src/ksp;  @${PYTHON} ${PETSC_DIR}/config/builder.py
247753a1a87SJed Brown	-@cd src/snes; @${PYTHON} ${PETSC_DIR}/config/builder.py
248753a1a87SJed Brown	-@cd src/ts;   @${PYTHON} ${PETSC_DIR}/config/builder.py
249753a1a87SJed Brown
250753a1a87SJed Brownstreams:
251753a1a87SJed Brown	cd src/benchmarks/streams; ${OMAKE} test
252753a1a87SJed Brown# ------------------------------------------------------------------
253753a1a87SJed Brown#
254753a1a87SJed Brown# All remaining actions are intended for PETSc developers only.
255753a1a87SJed Brown# PETSc users should not generally need to use these commands.
256753a1a87SJed Brown#
257753a1a87SJed Brown#  See the users manual for how the tags files may be used from Emacs and Vi/Vim
258753a1a87SJed Brown#
259753a1a87SJed Brownalletags:
260753a1a87SJed Brown	-@${PYTHON} bin/maint/generateetags.py
261753a1a87SJed Brown	-@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
262753a1a87SJed Brown
263762ef373SBarry Smith# obtain gtags from http://www.gnu.org/s/global/
264762ef373SBarry Smithallgtags:
265762ef373SBarry Smith	-@find -E ${PETSC_DIR}/{include,src,bin} -regex '(.*makefile|.*\.(cc|hh|cpp|C|hpp|c|h|cu|m)$$)' | grep -v ftn-auto  | gtags -f -
266762ef373SBarry Smith
267753a1a87SJed Brownallfortranstubs:
268753a1a87SJed Brown	-@${RM} -rf include/finclude/ftn-auto/*-tmpdir
269753a1a87SJed Brown	-@${PYTHON} bin/maint/generatefortranstubs.py ${BFORT}  ${VERBOSE}
270753a1a87SJed Brown	-@${PYTHON} bin/maint/generatefortranstubs.py -merge  ${VERBOSE}
271753a1a87SJed Brown	-@${RM} -rf include/finclude/ftn-auto/*-tmpdir
272753a1a87SJed Browndeletefortranstubs:
273753a1a87SJed Brown	-@find . -type d -name ftn-auto | xargs rm -rf
274753a1a87SJed Browncmakegen:
275753a1a87SJed Brown	-@${PYTHON} config/cmakegen.py
276753a1a87SJed Brown#
277753a1a87SJed Brown# These are here for the target allci and allco, and etags
278753a1a87SJed Brown#
279753a1a87SJed Brown
280bcaeba4dSBarry SmithBMAKEFILES = conf/variables conf/rules conf/test
281753a1a87SJed BrownSCRIPTS    = bin/maint/builddist  bin/maint/wwwman bin/maint/xclude bin/maint/bugReport.py bin/maint/buildconfigtest bin/maint/builddistlite \
282753a1a87SJed Brown             bin/maint/buildtest bin/maint/checkBuilds.py bin/maint/copylognightly bin/maint/copylognightly.tao bin/maint/countfiles bin/maint/findbadfiles \
283753a1a87SJed Brown             bin/maint/fixinclude bin/maint/getexlist bin/maint/getpdflabels.py bin/maint/helpindex.py bin/maint/hosts.local bin/maint/hosts.solaris  \
284753a1a87SJed Brown             bin/maint/lex.py  bin/maint/mapnameslatex.py bin/maint/startnightly bin/maint/startnightly.tao bin/maint/submitPatch.py \
285753a1a87SJed Brown             bin/maint/update-docs.py  bin/maint/wwwindex.py bin/maint/xcludebackup bin/maint/xcludecblas bin/maint/zap bin/maint/zapall \
286753a1a87SJed Brown             config/PETSc/Configure.py config/PETSc/Options.py \
287753a1a87SJed Brown             config/PETSc/packages/*.py config/PETSc/utilities/*.py
288753a1a87SJed Brown
289753a1a87SJed Brown
290753a1a87SJed Brown# Builds all the documentation - should be done every night
291753a1a87SJed Brownalldoc: alldoc1 alldoc2 alldoc3 docsetdate
292753a1a87SJed Brown
293753a1a87SJed Brown# Build everything that goes into 'doc' dir except html sources
294753a1a87SJed Brownalldoc1: chk_loc deletemanualpages chk_concepts_dir
295753a1a87SJed Brown	-${PYTHON} bin/maint/countpetsccits.py
296753a1a87SJed Brown	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
297753a1a87SJed Brown	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
298753a1a87SJed Brown	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
299753a1a87SJed Brown	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
300753a1a87SJed Brown	-cd src/docs/tex/manual; ${OMAKE} developers.pdf LOC=${LOC}
301753a1a87SJed Brown	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
302753a1a87SJed Brown	-${PYTHON} bin/maint/wwwindex.py ${PETSC_DIR} ${LOC}
303753a1a87SJed Brown	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
304753a1a87SJed Brown	-${OMAKE} manconcepts LOC=${LOC}
305753a1a87SJed Brown	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
306753a1a87SJed Brown	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
307753a1a87SJed Brown	-${PYTHON} bin/maint/helpindex.py ${PETSC_DIR} ${LOC}
308753a1a87SJed Brown
309753a1a87SJed Brown# Builds .html versions of the source
310753a1a87SJed Brown# html overwrites some stuff created by update-docs - hence this is done later.
311753a1a87SJed Brownalldoc2: chk_loc
312753a1a87SJed Brown	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
313753a1a87SJed Brown	-${PYTHON} bin/maint/update-docs.py ${PETSC_DIR} ${LOC}
314753a1a87SJed Brown#
315753a1a87SJed Brown# Builds HTML versions of Matlab scripts
316753a1a87SJed Brownalldoc3: chk_loc
317753a1a87SJed Brown	if  [ "${MATLAB_COMMAND}" != "" ]; then\
318753a1a87SJed Brown          export MATLABPATH=${MATLABPATH}:${PETSC_DIR}/bin/matlab; \
319753a1a87SJed Brown          cd ${PETSC_DIR}/bin/matlab; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
320753a1a87SJed Brown          cd classes; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
321753a1a87SJed Brown          cd examples/tutorials; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
322753a1a87SJed Brown        fi
323753a1a87SJed Brown
324753a1a87SJed Brown# modify all generated html files and add in version number, date, canonical URL info.
325ad5c76d5SBarry Smithdocsetdate: chk_petscdir
326753a1a87SJed Brown	@echo "Updating generated html files with petsc version, date, canonical URL info";\
327753a1a87SJed Brown        version_release=`grep '^#define PETSC_VERSION_RELEASE ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
328753a1a87SJed Brown        version_major=`grep '^#define PETSC_VERSION_MAJOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
329753a1a87SJed Brown        version_minor=`grep '^#define PETSC_VERSION_MINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
330e4643290SSatish Balay        version_subminor=`grep '^#define PETSC_VERSION_SUBMINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
331753a1a87SJed Brown        if  [ $${version_release} = 0 ]; then \
332753a1a87SJed Brown          petscversion=petsc-dev; \
333753a1a87SJed Brown          export petscversion; \
334753a1a87SJed Brown        elif [ $${version_release} = 1 ]; then \
335e4643290SSatish Balay          petscversion=petsc-$${version_major}.$${version_minor}.$${version_subminor}; \
336753a1a87SJed Brown          export petscversion; \
337753a1a87SJed Brown        else \
338753a1a87SJed Brown          echo "Unknown PETSC_VERSION_RELEASE: $${version_release}"; \
339753a1a87SJed Brown          exit; \
340753a1a87SJed Brown        fi; \
3419c5cad75SSatish Balay        datestr=`git log -1 --pretty=format:%ci | cut -d ' ' -f 1`; \
342753a1a87SJed Brown        export datestr; \
343753a1a87SJed Brown        find * -type d -wholename src/docs/website -prune -o -type d -wholename src/benchmarks/results -prune -o \
344e6b20741SSatish Balay          -type d -wholename config/BuildSystem/docs/website -prune -o -type d -wholename include/web -prune -o \
34588f0584fSBarry Smith          -type d -wholename 'arch-*' -prune -o -type d -wholename src/tops -prune -o -type d -wholename externalpackages -prune -o \
346753a1a87SJed Brown          -type f -wholename tutorials/multiphysics/tutorial.html -prune -o -type f -name \*.html \
347753a1a87SJed Brown          -exec perl -pi -e 's^(<body.*>)^$$1\n   <div id=\"version\" align=right><b>$$ENV{petscversion} $$ENV{datestr}</b></div>^i' {} \; \
348753a1a87SJed Brown          -exec perl -pi -e 's^(<head>)^$$1 <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/{}" />^i' {} \; ; \
349753a1a87SJed Brown        echo "Done fixing version number, date, canonical URL info"
350753a1a87SJed Brown
351753a1a87SJed Brownalldocclean: deletemanualpages allcleanhtml
352753a1a87SJed Brown
353753a1a87SJed Brown# Deletes man pages (HTML version)
354753a1a87SJed Browndeletemanualpages: chk_loc
355753a1a87SJed Brown	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
356753a1a87SJed Brown          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
357753a1a87SJed Brown          ${RM} ${LOC}/docs/exampleconcepts ;\
358753a1a87SJed Brown          ${RM} ${LOC}/docs/manconcepts ;\
359753a1a87SJed Brown          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
360753a1a87SJed Brown          ${PYTHON} bin/maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
361753a1a87SJed Brown        fi
362753a1a87SJed Brown
363753a1a87SJed Brownallcleanhtml:
364753a1a87SJed Brown	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
365753a1a87SJed Brown
366753a1a87SJed Brownchk_concepts_dir: chk_loc
367753a1a87SJed Brown	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
368753a1a87SJed Brown	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
369753a1a87SJed Brown
370753a1a87SJed Brown###########################################################
371753a1a87SJed Brown# targets to build distribution and update docs
372753a1a87SJed Brown###########################################################
373753a1a87SJed Brown
374753a1a87SJed Brown# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
375753a1a87SJed Browndist:
37691656f70SSatish Balay	${PETSC_DIR}/bin/maint/builddist ${PETSC_DIR} master
377753a1a87SJed Brown
378753a1a87SJed Brown# This target works only if you can do 'ssh petsc@login.mcs.anl.gov'
379753a1a87SJed Brown# also copy the file over to ftp site.
380753a1a87SJed Brownweb-snapshot:
381753a1a87SJed Brown	@if [ ! -f "${HOME}/petsc-dev.tar.gz" ]; then \
382753a1a87SJed Brown	    echo "~/petsc-dev.tar.gz missing! cannot update petsc-dev snapshot on mcs-web-site"; \
383753a1a87SJed Brown	  else \
384753a1a87SJed Brown            echo "updating petsc-dev snapshot on mcs-web-site"; \
385753a1a87SJed Brown	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
386753a1a87SJed Brown	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-dev.tar.gz; \
387753a1a87SJed Brown	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-dev/ \
388753a1a87SJed Brown              petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-dev ;\
389753a1a87SJed Brown	    /bin/cp -f /home/petsc/petsc-dev.tar.gz /mcs/ftp/pub/petsc/petsc-dev.tar.gz;\
390753a1a87SJed Brown	    ${RM} -rf $${tmpdir} ;\
391753a1a87SJed Brown	  fi
392753a1a87SJed Brown
393753a1a87SJed Brown# build the tarfile - and then update petsc-dev snapshot on mcs-web-site
394753a1a87SJed Brownupdate-web-snapshot: dist web-snapshot
395753a1a87SJed Brown
396753a1a87SJed Brown# This target updates website main pages
397753a1a87SJed Brownupdate-web:
398753a1a87SJed Brown	@cd ${PETSC_DIR}/src/docs; make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
399753a1a87SJed Brown	/usr/bin/rsync -az -C --exclude=documentation/index.html \
400753a1a87SJed Brown          --exclude=documentation/installation.html --exclude=download/index.html \
401753a1a87SJed Brown	  ${PETSC_DIR}/src/docs/website/ petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc
402753a1a87SJed Brown	@cd ${PETSC_DIR}/docs; /usr/bin/rsync -az developers.pdf petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/developers/
40392df35d2SSatish Balay	@cd ${PETSC_DIR}/src/docs/tex; /usr/bin/rsync -az petscapp.bib petsc.bib petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/publications
404753a1a87SJed Brown
405753a1a87SJed Brown#
406753a1a87SJed Brown#  builds a single list of files for each PETSc library so they may all be built in parallel
407753a1a87SJed Brown#  without a recursive set of make calls
408753a1a87SJed Browncreatefastbuild:
4092d507118SSatish Balay	cd src/vec; ${RM} -f files; /bin/echo -n "SOURCEC = " > files; make tree ACTION=sourcelist BASE_DIR=${PETSC_DIR}/src/vec
410753a1a87SJed Brown
411753a1a87SJed Brown###########################################################
412753a1a87SJed Brown#
413753a1a87SJed Brown#  See script for details
414753a1a87SJed Brown#
415753a1a87SJed Browngcov:
416753a1a87SJed Brown	-@${PETSC_DIR}/bin/maint/gcov.py -run_gcov
417753a1a87SJed Brown
418753a1a87SJed Brownmergegcov:
419753a1a87SJed Brown	-@${PETSC_DIR}/bin/maint/gcov.py -merge_gcov ${LOC} *.tar.gz
420753a1a87SJed Brown
421753a1a87SJed Brown# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
422753a1a87SJed Brownallrcslabel:
423753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
424753a1a87SJed Brown#
425753a1a87SJed Brown# -------------------------------------------------------------------------------
426753a1a87SJed Brown#
427753a1a87SJed Brown# Some macros to check if the fortran interface is up-to-date.
428753a1a87SJed Brown#
429753a1a87SJed Browncountfortranfunctions:
430753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
431753a1a87SJed Brown	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
432753a1a87SJed Brown	sed "s/_$$//" | sort > /tmp/countfortranfunctions
433753a1a87SJed Brown
434753a1a87SJed Browncountcfunctions:
435753a1a87SJed Brown	-@grep extern ${PETSC_DIR}/include/*.h  | grep "(" | tr -s ' ' | \
436753a1a87SJed Brown	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
437753a1a87SJed Brown	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
438753a1a87SJed Brown
439753a1a87SJed Browndifffortranfunctions: countfortranfunctions countcfunctions
440753a1a87SJed Brown	-@echo -------------- Functions missing in the fortran interface ---------------------
441753a1a87SJed Brown	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
442753a1a87SJed Brown	-@echo ----------------- Functions missing in the C interface ------------------------
443753a1a87SJed Brown	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
444753a1a87SJed Brown	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
445753a1a87SJed Brown
446753a1a87SJed Browncheckbadfortranstubs:
447753a1a87SJed Brown	-@echo "========================================="
448753a1a87SJed Brown	-@echo "Functions with MPI_Comm as an Argument"
449753a1a87SJed Brown	-@echo "========================================="
450753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
451753a1a87SJed Brown	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
452753a1a87SJed Brown	-@echo "========================================="
453753a1a87SJed Brown	-@echo "Functions with a String as an Argument"
454753a1a87SJed Brown	-@echo "========================================="
455753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
456753a1a87SJed Brown	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
457753a1a87SJed Brown	-@echo "========================================="
458753a1a87SJed Brown	-@echo "Functions with Pointers to PETSc Objects as Argument"
459753a1a87SJed Brown	-@echo "========================================="
460753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; \
461753a1a87SJed Brown	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
462753a1a87SJed Brown	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
463753a1a87SJed Brown	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
464753a1a87SJed Brown	for OBJ in $$_p_OBJ; do \
465753a1a87SJed Brown	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
466753a1a87SJed Brown	cut -d'(' -f1 | cut -d' ' -f1,3; \
467753a1a87SJed Brown	done
468753a1a87SJed Brown#
469753a1a87SJed Brown# Automatically generates PETSc exercises in html from the tutorial examples.
470753a1a87SJed Brown#
471753a1a87SJed Brown# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
472753a1a87SJed Brown#  (used also in introductions to the manual pages)
473753a1a87SJed Brown# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
474753a1a87SJed Brown# The list of exercises is from TUTORIALS in each directory's makefile
475753a1a87SJed Brown#
476753a1a87SJed Brown# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
477753a1a87SJed Brown# The pagemaker rule is in the file conf (at the bottom)
478753a1a87SJed Brown#
479753a1a87SJed Brown# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
480753a1a87SJed Brown#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
481753a1a87SJed Brown#
482753a1a87SJed Brownexercises:
483753a1a87SJed Brown	-@echo "========================================="
484753a1a87SJed Brown	-@echo "Generating HTML tutorial exercises"
485753a1a87SJed Brown	-@${RM} docs/pageform.txt
486753a1a87SJed Brown	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
487753a1a87SJed Brown	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
488753a1a87SJed Brown	-@echo "access_format=short"                        >> docs/pageform.txt
489753a1a87SJed Brown	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
490753a1a87SJed Brown	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
491753a1a87SJed Brown	-@echo "Generating HTML for individual directories"
492753a1a87SJed Brown	-@echo "========================================="
493753a1a87SJed Brown	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
494753a1a87SJed Brown	-@echo "Completed HTML for individual directories"
495753a1a87SJed Brown	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
496753a1a87SJed Brown	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
497753a1a87SJed Brown	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
498753a1a87SJed Brown	-@echo "========================================="
499753a1a87SJed Brown
500753a1a87SJed Brown.PHONY: info info_h all build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update \
501753a1a87SJed Brown        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
502bcaeba4dSBarry Smith        allhtml allcleanhtml  allci allco allrcslabel countfortranfunctions \
503753a1a87SJed Brown        start_configure configure_petsc configure_clean
504753a1a87SJed Brown
505753a1a87SJed Brownpetscao : petscmat petscao.f90.h
506753a1a87SJed Brownpetscdm : petscksp petscdm.f90.h
507753a1a87SJed Brownpetscdraw : petsc petscdraw.f90.h
508753a1a87SJed Brownpetscis : petsc petscis.f90.h
509753a1a87SJed Brownpetscksp : petscpc  petscksp.f90.h
510753a1a87SJed Brownpetsclog : petsc petsclog.f90.h
511753a1a87SJed Brownpetscmat : petscvec petscmat.f90.h
512753a1a87SJed Brownpetscmg : petscksp petscmg.f90.h
513753a1a87SJed Brownpetscpc : petscmat petscpc.f90.h
514753a1a87SJed Brownpetscsnes : petscksp petscsnes.f90.h
515753a1a87SJed Brownpetscsys : petsc petscsys.f90.h
516753a1a87SJed Brownpetscts : petscsnes petscts.f90.h
517753a1a87SJed Brownpetsc : petsc.f90.h
518753a1a87SJed Brownpetscvec : petscis petscvec.f90.h
519753a1a87SJed Brownpetscviewer : petsc petscviewer.f90.h
520753a1a87SJed Brownpetscmesh : petsc petscmesh.f90.h
521753a1a87SJed Brownmodules : petscao petscdm petscdraw petscis petscksp petsclog petscmat petscmg petscpc petscsnes petscsys petscts petsc petscvec petscviewer petscmesh
522