xref: /petsc/makefile (revision da0b7683ff97daa93b6802b42cd30904ff48a7b7)
1*753a1a87SJed Brown#
2*753a1a87SJed Brown# This is the makefile for compiling PETSc. See
3*753a1a87SJed Brown# http://www.mcs.anl.gov/petsc/documentation/installation.html for directions on installing PETSc.
4*753a1a87SJed Brown# See also conf for additional commands.
5*753a1a87SJed Brown#
6*753a1a87SJed BrownALL: all
7*753a1a87SJed BrownLOCDIR	 = ./
8*753a1a87SJed BrownDIRS	 = src include tutorials
9*753a1a87SJed BrownCFLAGS	 =
10*753a1a87SJed BrownFFLAGS	 =
11*753a1a87SJed Brown
12*753a1a87SJed Brown# next line defines PETSC_DIR and PETSC_ARCH if they are not set
13*753a1a87SJed Browninclude ././${PETSC_ARCH}/conf/petscvariables
14*753a1a87SJed Browninclude ${PETSC_DIR}/conf/variables
15*753a1a87SJed Browninclude ${PETSC_DIR}/conf/rules
16*753a1a87SJed Browninclude ${PETSC_DIR}/conf/test
17*753a1a87SJed Brown
18*753a1a87SJed Brown#
19*753a1a87SJed Brown# Basic targets to build PETSc libraries.
20*753a1a87SJed Brown# all: builds the c, fortran, and f90 libraries
21*753a1a87SJed Brownall:
22*753a1a87SJed Brown	@${OMAKE}  PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} chkpetsc_dir petscnagupgrade | tee ${PETSC_ARCH}/conf/make.log
23*753a1a87SJed Brown	@ln -sf ${PETSC_ARCH}/conf/make.log make.log
24*753a1a87SJed Brown	@if [ "${PETSC_BUILD_USING_CMAKE}" != "" ]; then \
25*753a1a87SJed Brown	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-cmake 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log \
26*753a1a87SJed 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)'; \
27*753a1a87SJed Brown	 else \
28*753a1a87SJed Brown	   ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} all-legacy 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log \
29*753a1a87SJed Brown                | ${GREP} -v "has no symbols"; \
30*753a1a87SJed Brown	 fi
31*753a1a87SJed Brown	@egrep -i "( error | error: |no such file or directory)" ${PETSC_ARCH}/conf/make.log | tee ${PETSC_ARCH}/conf/error.log > /dev/null
32*753a1a87SJed Brown	@if test -s ${PETSC_ARCH}/conf/error.log; then \
33*753a1a87SJed Brown           echo "********************************************************************" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
34*753a1a87SJed Brown           echo "  Error during compile, check ${PETSC_ARCH}/conf/make.log" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log; \
35*753a1a87SJed 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;\
36*753a1a87SJed Brown           echo "********************************************************************" 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log;\
37*753a1a87SJed Brown	 else \
38*753a1a87SJed Brown	  ${OMAKE} shared_install PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} 2>&1 | tee -a ${PETSC_ARCH}/conf/make.log ;\
39*753a1a87SJed Brown        fi #solaris make likes to print the whole command that gave error. So split this up into the smallest chunk below
40*753a1a87SJed Brown	@if test -s ${PETSC_ARCH}/conf/error.log; then exit 1; fi
41*753a1a87SJed Brown
42*753a1a87SJed Brownall-cmake: info cmakegen cmake
43*753a1a87SJed Brown
44*753a1a87SJed Brownall-legacy: chklib_dir info deletelibs deletemods build shared_nomesg mpi4py petsc4py
45*753a1a87SJed Brown#
46*753a1a87SJed Brown# Prints information about the system and version of PETSc being compiled
47*753a1a87SJed Brown#
48*753a1a87SJed Browninfo:
49*753a1a87SJed Brown	-@echo "=========================================="
50*753a1a87SJed Brown	-@echo " "
51*753a1a87SJed Brown	-@echo "See documentation/faq.html and documentation/bugreporting.html"
52*753a1a87SJed Brown	-@echo "for help with installation problems. Please send EVERYTHING"
53*753a1a87SJed Brown	-@echo "printed out below when reporting problems"
54*753a1a87SJed Brown	-@echo " "
55*753a1a87SJed Brown	-@echo "To subscribe to the PETSc announcement list, send mail to "
56*753a1a87SJed Brown	-@echo "majordomo@mcs.anl.gov with the message: "
57*753a1a87SJed Brown	-@echo "subscribe petsc-announce"
58*753a1a87SJed Brown	-@echo " "
59*753a1a87SJed Brown	-@echo "To subscribe to the PETSc users mailing list, send mail to "
60*753a1a87SJed Brown	-@echo "majordomo@mcs.anl.gov with the message: "
61*753a1a87SJed Brown	-@echo "subscribe petsc-users"
62*753a1a87SJed Brown	-@echo " "
63*753a1a87SJed Brown	-@echo "=========================================="
64*753a1a87SJed Brown	-@echo On `date` on `hostname`
65*753a1a87SJed Brown	-@echo Machine characteristics: `uname -a`
66*753a1a87SJed Brown	-@echo "-----------------------------------------"
67*753a1a87SJed Brown	-@echo "Using PETSc directory: ${PETSC_DIR}"
68*753a1a87SJed Brown	-@echo "Using PETSc arch: ${PETSC_ARCH}"
69*753a1a87SJed Brown	-@echo "-----------------------------------------"
70*753a1a87SJed Brown	-@grep "define PETSC_VERSION" ${PETSC_DIR}/include/petscversion.h | ${SED} "s/........//"
71*753a1a87SJed Brown	-@echo "-----------------------------------------"
72*753a1a87SJed Brown	-@echo "Using configure Options: ${CONFIGURE_OPTIONS}"
73*753a1a87SJed Brown	-@echo "Using configuration flags:"
74*753a1a87SJed Brown	-@grep "\#define " ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h
75*753a1a87SJed Brown	-@echo "-----------------------------------------"
76da0b7683SSatish Balay	-@echo "Using C/C++ compile: ${PETSC_COMPILE}"
77*753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
78da0b7683SSatish Balay	   echo "Using Fortran compile: ${PETSC_FCOMPILE}";\
79da0b7683SSatish Balay         fi
80da0b7683SSatish Balay	-@if [ "${CUDAC}" != "" ]; then \
81da0b7683SSatish Balay	   echo "Using CUDA compile: ${PETSC_CUCOMPILE}";\
82*753a1a87SJed Brown         fi
83*753a1a87SJed Brown	-@echo "-----------------------------------------"
84*753a1a87SJed Brown	-@echo "Using C/C++ linker: ${PCC_LINKER}"
85*753a1a87SJed Brown	-@echo "Using C/C++ flags: ${PCC_LINKER_FLAGS}"
86*753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
87*753a1a87SJed Brown	   echo "Using Fortran linker: ${FC_LINKER}";\
88*753a1a87SJed Brown	   echo "Using Fortran flags: ${FC_LINKER_FLAGS}";\
89*753a1a87SJed Brown         fi
90*753a1a87SJed Brown	-@echo "-----------------------------------------"
91*753a1a87SJed Brown	-@echo "Using libraries: ${PETSC_LIB}"
92*753a1a87SJed Brown	-@echo "------------------------------------------"
93*753a1a87SJed Brown	-@echo "Using mpiexec: ${MPIEXEC}"
94*753a1a87SJed Brown	-@echo "=========================================="
95*753a1a87SJed Brown
96*753a1a87SJed Brown#
97*753a1a87SJed Brown# Builds the PETSc libraries
98*753a1a87SJed Brown# This target also builds fortran77 and f90 interface
99*753a1a87SJed Brown# files and compiles .F files
100*753a1a87SJed Brown#
101*753a1a87SJed Brownbuild:
102*753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE LIBRARIES IN ALL DIRECTORIES"
103*753a1a87SJed Brown	-@echo "========================================="
104*753a1a87SJed Brown	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=libfast tree
105*753a1a87SJed Brown	-@${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}  > tmpf 2>&1 ; ${GREP} -v "has no symbols" tmpf; ${RM} tmpf;
106*753a1a87SJed Brown	-@echo "Completed building libraries"
107*753a1a87SJed Brown	-@echo "========================================="
108*753a1a87SJed Brown#
109*753a1a87SJed Brown#
110*753a1a87SJed Brown# Builds PETSc test examples for a given architecture
111*753a1a87SJed Brown#
112*753a1a87SJed Browntest:
113*753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} test_build 2>&1 | tee ./${PETSC_ARCH}/conf/test.log
114*753a1a87SJed Browntestx:
115*753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testx_build 2>&1 | tee ./${PETSC_ARCH}/conf/testx.log
116*753a1a87SJed Browntest_build:
117*753a1a87SJed Brown	-@echo "Running test examples to verify correct installation"
118*753a1a87SJed Brown	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
119*753a1a87SJed Brown	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
120*753a1a87SJed Brown	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex19
121*753a1a87SJed Brown	@if [ "${FC}" != "" ]; then cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testex5f; fi;
122*753a1a87SJed Brown	@cd src/snes/examples/tutorials >/dev/null; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
123*753a1a87SJed Brown	-@echo "Completed test examples"
124*753a1a87SJed Browntestx_build:
125*753a1a87SJed Brown	-@echo "Running graphics test example to verify correct X11 installation"
126*753a1a87SJed Brown	-@echo "Using PETSC_DIR=${PETSC_DIR} and PETSC_ARCH=${PETSC_ARCH}"
127*753a1a87SJed Brown	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
128*753a1a87SJed Brown	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} testxex19
129*753a1a87SJed Brown	@cd src/snes/examples/tutorials; ${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} clean
130*753a1a87SJed Brown	-@echo "Completed graphics test example"
131*753a1a87SJed Brown
132*753a1a87SJed Browntestexamples: info
133*753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN TEST EXAMPLES"
134*753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
135*753a1a87SJed Brown	-@echo "machines some of the numbers may not match exactly."
136*753a1a87SJed Brown	-@echo "========================================="
137*753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH}  PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C  tree
138*753a1a87SJed Brown	-@echo "Completed compiling and running test examples"
139*753a1a87SJed Brown	-@echo "========================================="
140*753a1a87SJed Browntestfortran: info
141*753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN FORTRAN TEST EXAMPLES"
142*753a1a87SJed Brown	-@echo "========================================="
143*753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
144*753a1a87SJed Brown	-@echo "machines or the way Fortran formats numbers"
145*753a1a87SJed Brown	-@echo "some of the results may not match exactly."
146*753a1a87SJed Brown	-@echo "========================================="
147*753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
148*753a1a87SJed Brown            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran tree; \
149*753a1a87SJed Brown            echo "Completed compiling and running Fortran test examples"; \
150*753a1a87SJed Brown          else \
151*753a1a87SJed Brown            echo "Error: No FORTRAN compiler available"; \
152*753a1a87SJed Brown          fi
153*753a1a87SJed Brown	-@echo "========================================="
154*753a1a87SJed Browntestexamples_uni: info
155*753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR EXAMPLES"
156*753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
157*753a1a87SJed Brown	-@echo "machines some of the numbers may not match exactly."
158*753a1a87SJed Brown	-@echo "========================================="
159*753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_C_X_MPIUni  tree
160*753a1a87SJed Brown	-@echo "Completed compiling and running uniprocessor test examples"
161*753a1a87SJed Brown	-@echo "========================================="
162*753a1a87SJed Browntestfortran_uni: info
163*753a1a87SJed Brown	-@echo "BEGINNING TO COMPILE AND RUN TEST UNI-PROCESSOR FORTRAN EXAMPLES"
164*753a1a87SJed Brown	-@echo "Due to different numerical round-off on certain"
165*753a1a87SJed Brown	-@echo "machines some of the numbers may not match exactly."
166*753a1a87SJed Brown	-@echo "========================================="
167*753a1a87SJed Brown	-@if [ "${FC}" != "" ]; then \
168*753a1a87SJed Brown            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=testexamples_Fortran_MPIUni  tree; \
169*753a1a87SJed Brown            echo "Completed compiling and running uniprocessor fortran test examples"; \
170*753a1a87SJed Brown          else \
171*753a1a87SJed Brown            echo "Error: No FORTRAN compiler available"; \
172*753a1a87SJed Brown          fi
173*753a1a87SJed Brown	-@
174*753a1a87SJed Brown	-@echo "========================================="
175*753a1a87SJed Brown
176*753a1a87SJed Brown# Ranlib on the libraries
177*753a1a87SJed Brownranlib:
178*753a1a87SJed Brown	${RANLIB} ${PETSC_LIB_DIR}/*.${AR_LIB_SUFFIX}
179*753a1a87SJed Brown
180*753a1a87SJed Brown# Deletes PETSc libraries
181*753a1a87SJed Browndeletelibs:
182*753a1a87SJed Brown	-${RM} -rf ${PETSC_LIB_DIR}/libpetsc*.*
183*753a1a87SJed Browndeletemods:
184*753a1a87SJed Brown	-${RM} -f ${PETSC_DIR}/${PETSC_ARCH}/include/petsc*.mod
185*753a1a87SJed Brown
186*753a1a87SJed Brown# Cleans up build
187*753a1a87SJed Brownallclean: deletelibs deletemods
188*753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} PETSC_DIR=${PETSC_DIR} ACTION=clean tree
189*753a1a87SJed Brown#
190*753a1a87SJed Brownreconfigure:
191*753a1a87SJed Brown	@${PYTHON} ${PETSC_ARCH}/conf/reconfigure-${PETSC_ARCH}.py
192*753a1a87SJed Brown#
193*753a1a87SJed Browninstall:
194*753a1a87SJed Brown	@${PYTHON} ./config/install.py -destDir=${DESTDIR}
195*753a1a87SJed Brown
196*753a1a87SJed Brownnewall:
197*753a1a87SJed Brown	-@cd src/sys;  @${PYTHON} ${PETSC_DIR}/config/builder.py
198*753a1a87SJed Brown	-@cd src/vec;  @${PYTHON} ${PETSC_DIR}/config/builder.py
199*753a1a87SJed Brown	-@cd src/mat;  @${PYTHON} ${PETSC_DIR}/config/builder.py
200*753a1a87SJed Brown	-@cd src/dm;   @${PYTHON} ${PETSC_DIR}/config/builder.py
201*753a1a87SJed Brown	-@cd src/ksp;  @${PYTHON} ${PETSC_DIR}/config/builder.py
202*753a1a87SJed Brown	-@cd src/snes; @${PYTHON} ${PETSC_DIR}/config/builder.py
203*753a1a87SJed Brown	-@cd src/ts;   @${PYTHON} ${PETSC_DIR}/config/builder.py
204*753a1a87SJed Brown
205*753a1a87SJed Brownstreams:
206*753a1a87SJed Brown	cd src/benchmarks/streams; ${OMAKE} test
207*753a1a87SJed Brown# ------------------------------------------------------------------
208*753a1a87SJed Brown#
209*753a1a87SJed Brown# All remaining actions are intended for PETSc developers only.
210*753a1a87SJed Brown# PETSc users should not generally need to use these commands.
211*753a1a87SJed Brown#
212*753a1a87SJed Brown#  See the users manual for how the tags files may be used from Emacs and Vi/Vim
213*753a1a87SJed Brown#
214*753a1a87SJed Brownalletags:
215*753a1a87SJed Brown	-@${PYTHON} bin/maint/generateetags.py
216*753a1a87SJed Brown	-@find config -type f -name "*.py" |grep -v SCCS | xargs etags -o TAGS_PYTHON
217*753a1a87SJed Brown
218*753a1a87SJed Brownallfortranstubs:
219*753a1a87SJed Brown	-@${RM} -rf include/finclude/ftn-auto/*-tmpdir
220*753a1a87SJed Brown	-@${PYTHON} bin/maint/generatefortranstubs.py ${BFORT}  ${VERBOSE}
221*753a1a87SJed Brown	-@${PYTHON} bin/maint/generatefortranstubs.py -merge  ${VERBOSE}
222*753a1a87SJed Brown	-@${RM} -rf include/finclude/ftn-auto/*-tmpdir
223*753a1a87SJed Browndeletefortranstubs:
224*753a1a87SJed Brown	-@find . -type d -name ftn-auto | xargs rm -rf
225*753a1a87SJed Browncmakegen:
226*753a1a87SJed Brown	-@${PYTHON} config/cmakegen.py
227*753a1a87SJed Brown#
228*753a1a87SJed Brown# These are here for the target allci and allco, and etags
229*753a1a87SJed Brown#
230*753a1a87SJed Brown
231*753a1a87SJed BrownBMAKEFILES = conf/variables conf/rules conf/test bmake/adic.init bmake/adicmf.init
232*753a1a87SJed BrownSCRIPTS    = bin/maint/builddist  bin/maint/wwwman bin/maint/xclude bin/maint/bugReport.py bin/maint/buildconfigtest bin/maint/builddistlite \
233*753a1a87SJed Brown             bin/maint/buildtest bin/maint/checkBuilds.py bin/maint/copylognightly bin/maint/copylognightly.tao bin/maint/countfiles bin/maint/findbadfiles \
234*753a1a87SJed Brown             bin/maint/fixinclude bin/maint/getexlist bin/maint/getpdflabels.py bin/maint/helpindex.py bin/maint/hosts.local bin/maint/hosts.solaris  \
235*753a1a87SJed Brown             bin/maint/lex.py  bin/maint/mapnameslatex.py bin/maint/startnightly bin/maint/startnightly.tao bin/maint/submitPatch.py \
236*753a1a87SJed Brown             bin/maint/update-docs.py  bin/maint/wwwindex.py bin/maint/xcludebackup bin/maint/xcludecblas bin/maint/zap bin/maint/zapall \
237*753a1a87SJed Brown             config/PETSc/Configure.py config/PETSc/Options.py \
238*753a1a87SJed Brown             config/PETSc/packages/*.py config/PETSc/utilities/*.py
239*753a1a87SJed Brown
240*753a1a87SJed Brown
241*753a1a87SJed Brown# Builds all the documentation - should be done every night
242*753a1a87SJed Brownalldoc: alldoc1 alldoc2 alldoc3 docsetdate
243*753a1a87SJed Brown
244*753a1a87SJed Brown# Build everything that goes into 'doc' dir except html sources
245*753a1a87SJed Brownalldoc1: chk_loc deletemanualpages chk_concepts_dir
246*753a1a87SJed Brown	-${PYTHON} bin/maint/countpetsccits.py
247*753a1a87SJed Brown	-${OMAKE} ACTION=manualpages_buildcite tree_basic LOC=${LOC}
248*753a1a87SJed Brown	-@sed -e s%man+../%man+manualpages/% ${LOC}/docs/manualpages/manualpages.cit > ${LOC}/docs/manualpages/htmlmap
249*753a1a87SJed Brown	-@cat ${PETSC_DIR}/src/docs/mpi.www.index >> ${LOC}/docs/manualpages/htmlmap
250*753a1a87SJed Brown	-cd src/docs/tex/manual; ${OMAKE} manual.pdf LOC=${LOC}
251*753a1a87SJed Brown	-cd src/docs/tex/manual; ${OMAKE} developers.pdf LOC=${LOC}
252*753a1a87SJed Brown	-${OMAKE} ACTION=manualpages tree_basic LOC=${LOC}
253*753a1a87SJed Brown	-${PYTHON} bin/maint/wwwindex.py ${PETSC_DIR} ${LOC}
254*753a1a87SJed Brown	-${OMAKE} ACTION=manexamples tree_basic LOC=${LOC}
255*753a1a87SJed Brown	-${OMAKE} manconcepts LOC=${LOC}
256*753a1a87SJed Brown	-${OMAKE} ACTION=getexlist tree_basic LOC=${LOC}
257*753a1a87SJed Brown	-${OMAKE} ACTION=exampleconcepts tree_basic LOC=${LOC}
258*753a1a87SJed Brown	-${PYTHON} bin/maint/helpindex.py ${PETSC_DIR} ${LOC}
259*753a1a87SJed Brown
260*753a1a87SJed Brown# Builds .html versions of the source
261*753a1a87SJed Brown# html overwrites some stuff created by update-docs - hence this is done later.
262*753a1a87SJed Brownalldoc2: chk_loc
263*753a1a87SJed Brown	-${OMAKE} ACTION=html PETSC_DIR=${PETSC_DIR} alltree LOC=${LOC}
264*753a1a87SJed Brown	-${PYTHON} bin/maint/update-docs.py ${PETSC_DIR} ${LOC}
265*753a1a87SJed Brown#
266*753a1a87SJed Brown# Builds HTML versions of Matlab scripts
267*753a1a87SJed Brownalldoc3: chk_loc
268*753a1a87SJed Brown	if  [ "${MATLAB_COMMAND}" != "" ]; then\
269*753a1a87SJed Brown          export MATLABPATH=${MATLABPATH}:${PETSC_DIR}/bin/matlab; \
270*753a1a87SJed Brown          cd ${PETSC_DIR}/bin/matlab; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
271*753a1a87SJed Brown          cd classes; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
272*753a1a87SJed Brown          cd examples/tutorials; ${MATLAB_COMMAND} -nodisplay -nodesktop -r "generatehtml;exit" ; \
273*753a1a87SJed Brown        fi
274*753a1a87SJed Brown
275*753a1a87SJed Brown# modify all generated html files and add in version number, date, canonical URL info.
276*753a1a87SJed Browndocsetdate: chkpetsc_dir
277*753a1a87SJed Brown	@echo "Updating generated html files with petsc version, date, canonical URL info";\
278*753a1a87SJed Brown        version_release=`grep '^#define PETSC_VERSION_RELEASE ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
279*753a1a87SJed Brown        version_major=`grep '^#define PETSC_VERSION_MAJOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
280*753a1a87SJed Brown        version_minor=`grep '^#define PETSC_VERSION_MINOR ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
281*753a1a87SJed Brown        version_patch=`grep '^#define PETSC_VERSION_PATCH ' include/petscversion.h |tr -s ' ' | cut -d ' ' -f 3`; \
282*753a1a87SJed Brown        if  [ $${version_release} = 0 ]; then \
283*753a1a87SJed Brown          petscversion=petsc-dev; \
284*753a1a87SJed Brown          export petscversion; \
285*753a1a87SJed Brown        elif [ $${version_release} = 1 ]; then \
286*753a1a87SJed Brown          petscversion=petsc-$${version_major}.$${version_minor}-p$${version_patch}; \
287*753a1a87SJed Brown          export petscversion; \
288*753a1a87SJed Brown        else \
289*753a1a87SJed Brown          echo "Unknown PETSC_VERSION_RELEASE: $${version_release}"; \
290*753a1a87SJed Brown          exit; \
291*753a1a87SJed Brown        fi; \
292*753a1a87SJed Brown        datestr=`hg tip --template "{date|shortdate}"`; \
293*753a1a87SJed Brown        export datestr; \
294*753a1a87SJed Brown        find * -type d -wholename src/docs/website -prune -o -type d -wholename src/benchmarks/results -prune -o \
295*753a1a87SJed Brown          -type d -wholename arch-* -prune -o -type d -wholename src/tops -prune -o -type d -wholename externalpackages -prune -o \
296*753a1a87SJed Brown          -type f -wholename tutorials/multiphysics/tutorial.html -prune -o -type f -name \*.html \
297*753a1a87SJed Brown          -exec perl -pi -e 's^(<body.*>)^$$1\n   <div id=\"version\" align=right><b>$$ENV{petscversion} $$ENV{datestr}</b></div>^i' {} \; \
298*753a1a87SJed Brown          -exec perl -pi -e 's^(<head>)^$$1 <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/{}" />^i' {} \; ; \
299*753a1a87SJed Brown        echo "Done fixing version number, date, canonical URL info"
300*753a1a87SJed Brown
301*753a1a87SJed Brownalldocclean: deletemanualpages allcleanhtml
302*753a1a87SJed Brown
303*753a1a87SJed Brown# Deletes man pages (HTML version)
304*753a1a87SJed Browndeletemanualpages: chk_loc
305*753a1a87SJed Brown	-@if [ -d ${LOC} -a -d ${LOC}/docs/manualpages ]; then \
306*753a1a87SJed Brown          find ${LOC}/docs/manualpages -type f -name "*.html" -exec ${RM} {} \; ;\
307*753a1a87SJed Brown          ${RM} ${LOC}/docs/exampleconcepts ;\
308*753a1a87SJed Brown          ${RM} ${LOC}/docs/manconcepts ;\
309*753a1a87SJed Brown          ${RM} ${LOC}/docs/manualpages/manualpages.cit ;\
310*753a1a87SJed Brown          ${PYTHON} bin/maint/update-docs.py ${PETSC_DIR} ${LOC} clean;\
311*753a1a87SJed Brown        fi
312*753a1a87SJed Brown
313*753a1a87SJed Brownallcleanhtml:
314*753a1a87SJed Brown	-${RM} include/adic/*.h.html
315*753a1a87SJed Brown	-${OMAKE} ACTION=cleanhtml PETSC_DIR=${PETSC_DIR} alltree
316*753a1a87SJed Brown
317*753a1a87SJed Brownchk_concepts_dir: chk_loc
318*753a1a87SJed Brown	@if [ ! -d "${LOC}/docs/manualpages/concepts" ]; then \
319*753a1a87SJed Brown	  echo Making directory ${LOC}/docs/manualpages/concepts for library; ${MKDIR} ${LOC}/docs/manualpages/concepts; fi
320*753a1a87SJed Brown
321*753a1a87SJed Brown###########################################################
322*753a1a87SJed Brown# targets to build distribution and update docs
323*753a1a87SJed Brown###########################################################
324*753a1a87SJed Brown
325*753a1a87SJed Brown# Creates ${HOME}/petsc.tar.gz [and petsc-lite.tar.gz]
326*753a1a87SJed Browndist:
327*753a1a87SJed Brown	${PETSC_DIR}/bin/maint/builddist ${PETSC_DIR}
328*753a1a87SJed Brown
329*753a1a87SJed Brown# This target works only if you can do 'ssh petsc@login.mcs.anl.gov'
330*753a1a87SJed Brown# also copy the file over to ftp site.
331*753a1a87SJed Brownweb-snapshot:
332*753a1a87SJed Brown	@if [ ! -f "${HOME}/petsc-dev.tar.gz" ]; then \
333*753a1a87SJed Brown	    echo "~/petsc-dev.tar.gz missing! cannot update petsc-dev snapshot on mcs-web-site"; \
334*753a1a87SJed Brown	  else \
335*753a1a87SJed Brown            echo "updating petsc-dev snapshot on mcs-web-site"; \
336*753a1a87SJed Brown	    tmpdir=`mktemp -d -t petsc-doc.XXXXXXXX`; \
337*753a1a87SJed Brown	    cd $${tmpdir}; tar -xzf ${HOME}/petsc-dev.tar.gz; \
338*753a1a87SJed Brown	    /usr/bin/rsync  -e ssh -az --delete $${tmpdir}/petsc-dev/ \
339*753a1a87SJed Brown              petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/petsc-dev ;\
340*753a1a87SJed Brown	    /bin/cp -f /home/petsc/petsc-dev.tar.gz /mcs/ftp/pub/petsc/petsc-dev.tar.gz;\
341*753a1a87SJed Brown	    ${RM} -rf $${tmpdir} ;\
342*753a1a87SJed Brown	  fi
343*753a1a87SJed Brown
344*753a1a87SJed Brown# build the tarfile - and then update petsc-dev snapshot on mcs-web-site
345*753a1a87SJed Brownupdate-web-snapshot: dist web-snapshot
346*753a1a87SJed Brown
347*753a1a87SJed Brown# This target updates website main pages
348*753a1a87SJed Brownupdate-web:
349*753a1a87SJed Brown	@cd ${PETSC_DIR}/src/docs; make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} bib2html; \
350*753a1a87SJed Brown	/usr/bin/rsync -az -C --exclude=documentation/index.html \
351*753a1a87SJed Brown          --exclude=documentation/installation.html --exclude=download/index.html \
352*753a1a87SJed Brown	  ${PETSC_DIR}/src/docs/website/ petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc
353*753a1a87SJed Brown	@cd ${PETSC_DIR}/docs; /usr/bin/rsync -az developers.pdf petsc@login.mcs.anl.gov:/mcs/web/research/projects/petsc/developers/
354*753a1a87SJed Brown
355*753a1a87SJed Brown#
356*753a1a87SJed Brown#  builds a single list of files for each PETSc library so they may all be built in parallel
357*753a1a87SJed Brown#  without a recursive set of make calls
358*753a1a87SJed Browncreatefastbuild:
359*753a1a87SJed Brown	cd src/vec; ${RM} -f files; /bin/echo -n "SOURCEC = " > files; make tree ACTION=sourcelist BASE_DIR=${PETSC_DIR}/src/vec;  /bin/echo -n "OBJSC    = $${SOURCEC:.c=.o} " >> files
360*753a1a87SJed Brown
361*753a1a87SJed Brown###########################################################
362*753a1a87SJed Brown#
363*753a1a87SJed Brown#  See script for details
364*753a1a87SJed Brown#
365*753a1a87SJed Browngcov:
366*753a1a87SJed Brown	-@${PETSC_DIR}/bin/maint/gcov.py -run_gcov
367*753a1a87SJed Brown
368*753a1a87SJed Brownmergegcov:
369*753a1a87SJed Brown	-@${PETSC_DIR}/bin/maint/gcov.py -merge_gcov ${LOC} *.tar.gz
370*753a1a87SJed Brown
371*753a1a87SJed Brown# usage make allrcslabel NEW_RCS_LABEL=v_2_0_28
372*753a1a87SJed Brownallrcslabel:
373*753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} NEW_RCS_LABEL=${NEW_RCS_LABEL} ACTION=rcslabel  alltree
374*753a1a87SJed Brown#
375*753a1a87SJed Brown#   The commands below are for generating ADIC versions of the code;
376*753a1a87SJed Brown# they are not currently used.
377*753a1a87SJed Brown#
378*753a1a87SJed Brownalladicignore:
379*753a1a87SJed Brown	-@${RM} ${INSTALL_LIB_DIR}/adicignore
380*753a1a87SJed Brown	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adicignore  tree
381*753a1a87SJed Brown
382*753a1a87SJed Brownalladic:
383*753a1a87SJed Brown	-@echo "Beginning to compile ADIC source code in all directories"
384*753a1a87SJed Brown	-@echo "Using ADIC compiler: ${ADIC_CC} ${CCPPFLAGS}"
385*753a1a87SJed Brown	-@echo "========================================="
386*753a1a87SJed Brown	-@cd include ; \
387*753a1a87SJed Brown           ${ADIC_CC} -s -f 1 ${CCPPFLAGS} petscsys.h
388*753a1a87SJed Brown	-@${OMAKE}  PETSC_ARCH=${PETSC_ARCH} ACTION=adic  tree
389*753a1a87SJed Brown
390*753a1a87SJed Brownalladiclib:
391*753a1a87SJed Brown	-@echo "Beginning to compile ADIC libraries in all directories"
392*753a1a87SJed Brown	-@echo "Using compiler: ${PCC} ${COPTFLAGS}"
393*753a1a87SJed Brown	-@echo "-----------------------------------------"
394*753a1a87SJed Brown	-@echo "Using PETSc flags: ${PETSCFLAGS} ${PCONF}"
395*753a1a87SJed Brown	-@echo "-----------------------------------------"
396*753a1a87SJed Brown	-@echo "Using configuration flags:"
397*753a1a87SJed Brown	-@grep "define " ${PETSC_ARCH}/include/petscconf.h
398*753a1a87SJed Brown	-@echo "-----------------------------------------"
399*753a1a87SJed Brown	-@echo "Using include paths: ${CC_PETSC_INCLUDE}"
400*753a1a87SJed Brown	-@echo "-----------------------------------------"
401*753a1a87SJed Brown	-@echo "Using PETSc directory: ${PETSC_DIR}"
402*753a1a87SJed Brown	-@echo "Using PETSc arch: ${PETSC_ARCH}"
403*753a1a87SJed Brown	-@echo "========================================="
404*753a1a87SJed Brown	-@${RM} -f  ${INSTALL_LIB_DIR}/*adic.${AR_LIB_SUFFIX}
405*753a1a87SJed Brown	-@${OMAKE} PETSC_ARCH=${PETSC_ARCH} ACTION=adiclib  tree
406*753a1a87SJed Brown	-@cd src/adic/src ; \
407*753a1a87SJed Brown            ${OMAKE} PETSC_ARCH=${PETSC_ARCH} lib
408*753a1a87SJed Brown
409*753a1a87SJed Brown# -------------------------------------------------------------------------------
410*753a1a87SJed Brown#
411*753a1a87SJed Brown# Some macros to check if the fortran interface is up-to-date.
412*753a1a87SJed Brown#
413*753a1a87SJed Browncountfortranfunctions:
414*753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran; egrep '^void' custom/*.c auto/*.c | \
415*753a1a87SJed Brown	cut -d'(' -f1 | tr -s  ' ' | cut -d' ' -f2 | uniq | egrep -v "(^$$|Petsc)" | \
416*753a1a87SJed Brown	sed "s/_$$//" | sort > /tmp/countfortranfunctions
417*753a1a87SJed Brown
418*753a1a87SJed Browncountcfunctions:
419*753a1a87SJed Brown	-@grep extern ${PETSC_DIR}/include/*.h  | grep "(" | tr -s ' ' | \
420*753a1a87SJed Brown	cut -d'(' -f1 | cut -d' ' -f3 | grep -v "\*" | tr -s '\012' |  \
421*753a1a87SJed Brown	tr 'A-Z' 'a-z' |  sort > /tmp/countcfunctions
422*753a1a87SJed Brown
423*753a1a87SJed Browndifffortranfunctions: countfortranfunctions countcfunctions
424*753a1a87SJed Brown	-@echo -------------- Functions missing in the fortran interface ---------------------
425*753a1a87SJed Brown	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^<" | cut -d' ' -f2
426*753a1a87SJed Brown	-@echo ----------------- Functions missing in the C interface ------------------------
427*753a1a87SJed Brown	-@${DIFF} /tmp/countcfunctions /tmp/countfortranfunctions | grep "^>" | cut -d' ' -f2
428*753a1a87SJed Brown	-@${RM}  /tmp/countcfunctions /tmp/countfortranfunctions
429*753a1a87SJed Brown
430*753a1a87SJed Browncheckbadfortranstubs:
431*753a1a87SJed Brown	-@echo "========================================="
432*753a1a87SJed Brown	-@echo "Functions with MPI_Comm as an Argument"
433*753a1a87SJed Brown	-@echo "========================================="
434*753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'MPI_Comm' | \
435*753a1a87SJed Brown	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
436*753a1a87SJed Brown	-@echo "========================================="
437*753a1a87SJed Brown	-@echo "Functions with a String as an Argument"
438*753a1a87SJed Brown	-@echo "========================================="
439*753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; grep '^void' *.c | grep 'char \*' | \
440*753a1a87SJed Brown	tr -s ' ' | tr -s ':' ' ' |cut -d'(' -f1 | cut -d' ' -f1,3
441*753a1a87SJed Brown	-@echo "========================================="
442*753a1a87SJed Brown	-@echo "Functions with Pointers to PETSc Objects as Argument"
443*753a1a87SJed Brown	-@echo "========================================="
444*753a1a87SJed Brown	-@cd ${PETSC_DIR}/src/fortran/auto; \
445*753a1a87SJed Brown	_p_OBJ=`grep _p_ ${PETSC_DIR}/include/*.h | tr -s ' ' | \
446*753a1a87SJed Brown	cut -d' ' -f 3 | tr -s '\012' | grep -v '{' | cut -d'*' -f1 | \
447*753a1a87SJed Brown	sed "s/_p_//g" | tr -s '\012 ' ' *|' ` ; \
448*753a1a87SJed Brown	for OBJ in $$_p_OBJ; do \
449*753a1a87SJed Brown	grep "$$OBJ \*" *.c | tr -s ' ' | tr -s ':' ' ' | \
450*753a1a87SJed Brown	cut -d'(' -f1 | cut -d' ' -f1,3; \
451*753a1a87SJed Brown	done
452*753a1a87SJed Brown#
453*753a1a87SJed Brown# Automatically generates PETSc exercises in html from the tutorial examples.
454*753a1a87SJed Brown#
455*753a1a87SJed Brown# The introduction for each section is obtained from docs/manualpages/header_${MANSEC} is under RCS and may be edited
456*753a1a87SJed Brown#  (used also in introductions to the manual pages)
457*753a1a87SJed Brown# The overall introduction is in docs/exercises/introduction.html and is under RCS and may be edited
458*753a1a87SJed Brown# The list of exercises is from TUTORIALS in each directory's makefile
459*753a1a87SJed Brown#
460*753a1a87SJed Brown# DO NOT EDIT the pageform.txt or *.htm files generated since they will be automatically replaced.
461*753a1a87SJed Brown# The pagemaker rule is in the file conf (at the bottom)
462*753a1a87SJed Brown#
463*753a1a87SJed Brown# Eventually the line below will replace the two cd in the rule below, it is just this way now for speed
464*753a1a87SJed Brown#	-@${OMAKE} PETSC_DIR=${PETSC_DIR} pagemaker
465*753a1a87SJed Brown#
466*753a1a87SJed Brownexercises:
467*753a1a87SJed Brown	-@echo "========================================="
468*753a1a87SJed Brown	-@echo "Generating HTML tutorial exercises"
469*753a1a87SJed Brown	-@${RM} docs/pageform.txt
470*753a1a87SJed Brown	-@echo "title=\"PETSc Exercises\""                >  docs/pageform.txt
471*753a1a87SJed Brown	-@echo "access_title=Exercise Sections"              >>  docs/pageform.txt
472*753a1a87SJed Brown	-@echo "access_format=short"                        >> docs/pageform.txt
473*753a1a87SJed Brown	-@echo "startpage=../exercises/introduction.htm"  >> docs/pageform.txt
474*753a1a87SJed Brown	-@echo "NONE title=\"Introduction\" command=link src=../exercises/introduction.htm" >> docs/pageform.txt
475*753a1a87SJed Brown	-@echo "Generating HTML for individual directories"
476*753a1a87SJed Brown	-@echo "========================================="
477*753a1a87SJed Brown	-@${OMAKE} PETSC_DIR=${PETSC_DIR} ACTION=pagemaker tree
478*753a1a87SJed Brown	-@echo "Completed HTML for individual directories"
479*753a1a87SJed Brown	-@echo "NONE title=\"<HR>\" " >> docs/pageform.txt;
480*753a1a87SJed Brown	-@echo "NONE title=\"PETSc Documentation\" command=link src=../index.html target=replace" >> docs/pageform.txt
481*753a1a87SJed Brown	/home/MPI/class/mpiexmpl/maint/makepage.new -pageform=docs/pageform.txt -access_extra=/dev/null -outdir=docs/exercises
482*753a1a87SJed Brown	-@echo "========================================="
483*753a1a87SJed Brown
484*753a1a87SJed Brown.PHONY: info info_h all build testexamples testfortran testexamples_uni testfortran_uni ranlib deletelibs allclean update \
485*753a1a87SJed Brown        alletags etags etags_complete etags_noexamples etags_makefiles etags_examples etags_fexamples alldoc allmanualpages \
486*753a1a87SJed Brown        allhtml allcleanhtml  allci allco allrcslabel alladicignore alladic alladiclib countfortranfunctions \
487*753a1a87SJed Brown        start_configure configure_petsc configure_clean
488*753a1a87SJed Brown
489*753a1a87SJed Brownpetscao : petscmat petscao.f90.h
490*753a1a87SJed Brownpetscdm : petscksp petscdm.f90.h
491*753a1a87SJed Brownpetscdraw : petsc petscdraw.f90.h
492*753a1a87SJed Brownpetscis : petsc petscis.f90.h
493*753a1a87SJed Brownpetscksp : petscpc  petscksp.f90.h
494*753a1a87SJed Brownpetsclog : petsc petsclog.f90.h
495*753a1a87SJed Brownpetscmat : petscvec petscmat.f90.h
496*753a1a87SJed Brownpetscmg : petscksp petscmg.f90.h
497*753a1a87SJed Brownpetscpc : petscmat petscpc.f90.h
498*753a1a87SJed Brownpetscsnes : petscksp petscsnes.f90.h
499*753a1a87SJed Brownpetscsys : petsc petscsys.f90.h
500*753a1a87SJed Brownpetscts : petscsnes petscts.f90.h
501*753a1a87SJed Brownpetsc : petsc.f90.h
502*753a1a87SJed Brownpetscvec : petscis petscvec.f90.h
503*753a1a87SJed Brownpetscviewer : petsc petscviewer.f90.h
504*753a1a87SJed Brownpetscmesh : petsc petscmesh.f90.h
505*753a1a87SJed Brownmodules : petscao petscdm petscdraw petscis petscksp petsclog petscmat petscmg petscpc petscsnes petscsys petscts petsc petscvec petscviewer petscmesh
506