1-include ../../../petscdir.mk 2.PHONY: default 3default: build 4default: opt=--inplace 5 6package = petsc4py 7MODULE = PETSc 8 9PYTHON = python$(py) 10MPIEXEC = mpiexec 11 12# ---- 13 14.PHONY: config build test 15config: 16 ${PYTHON} setup.py config ${opt} 17build: 18 ${PYTHON} setup.py build ${opt} 19test: 20 ${VALGRIND} ${PYTHON} ${PWD}/test/runtests.py ${opt} 21test-%: 22 ${MPIEXEC} -n $* ${VALGRIND} ${PYTHON} ${PWD}/test/runtests.py ${opt} 23 24.PHONY: srcbuild srcclean 25srcbuild: 26 ${PYTHON} setup.py build_src ${opt} 27srcclean: 28 -${RM} src/${package}/${MODULE}.c 29 -${RM} src/${package}/${MODULE}.h 30 -${RM} src/${package}/${MODULE}_api.h 31 32.PHONY: clean distclean fullclean 33clean: 34 ${PYTHON} setup.py clean --all 35distclean: clean 36 -${RM} -r build _configtest.* *.py[co] 37 -${RM} -r MANIFEST dist ${package}.egg-info 38 -${RM} -r `find . -name '__pycache__'` 39 -${RM} `find . -name '*.py[co]'` 40fullclean: distclean srcclean docsclean 41 -find . -name '*~' -exec rm -f {} ';' 42 43# ---- 44 45.PHONY: install uninstall 46install: build 47 ${PYTHON} setup.py install --prefix='' --user ${opt} 48uninstall: 49 -${RM} -r $(shell ${PYTHON} -m site --user-site)/${package} 50 -${RM} -r $(shell ${PYTHON} -m site --user-site)/${package}-*-py*.egg-info 51 52# ---- 53 54.PHONY: docs docs-html docs-pdf docs-misc 55docs: docs-html docs-pdf docs-misc 56docs-html: rst2html sphinx-html 57docs-pdf: sphinx-pdf 58docs-misc: sphinx-man sphinx-info 59 60RST2HTML = $(shell command -v rst2html || command -v rst2html.py || false) 61RST2HTMLOPTS = --input-encoding=utf-8 62RST2HTMLOPTS += --no-compact-lists 63RST2HTMLOPTS += --cloak-email-addresses 64.PHONY: rst2html 65rst2html: checkdocutils 66 ${RST2HTML} ${RST2HTMLOPTS} ./LICENSE.rst > docs/LICENSE.html 67 ${RST2HTML} ${RST2HTMLOPTS} ./CHANGES.rst > docs/CHANGES.html 68 ${RST2HTML} ${RST2HTMLOPTS} docs/index.rst > docs/index.html 69 70SPHINXBUILD = sphinx-build 71SPHINXOPTS = 72.PHONY: sphinx sphinx-html sphinx-pdf sphinx-man sphinx-info 73sphinx: sphinx-html sphinx-pdf sphinx-man sphinx-info 74sphinx-html: 75 mkdir -p build/doctrees docs/html 76 ${SPHINXBUILD} -b html -d build/doctrees ${SPHINXOPTS} \ 77 docs/source docs/html 78 ${RM} docs/html/.buildinfo 79sphinx-pdf: 80 mkdir -p build/doctrees build/latex 81 ${SPHINXBUILD} -b latex -d build/doctrees ${SPHINXOPTS} \ 82 docs/source build/latex 83 ${MAKE} -C build/latex all-pdf > /dev/null 84 mv build/latex/*.pdf docs/ 85sphinx-man: 86 mkdir -p build/doctrees build/man 87 ${SPHINXBUILD} -b man -d build/doctrees ${SPHINXOPTS} \ 88 docs/source build/man 89 mv build/man/*.[137] docs/ 90sphinx-info: 91 mkdir -p build/doctrees build/texinfo 92 ${SPHINXBUILD} -b texinfo -d build/doctrees ${SPHINXOPTS} \ 93 docs/source build/texinfo 94 ${MAKE} -C build/texinfo info > /dev/null 95 mv build/texinfo/*.info docs/ 96 97.PHONY: docsclean 98docsclean: 99 -${RM} docs/*.html docs/*.pdf 100 -${RM} docs/*.info docs/*.[137] 101 -${RM} -r docs/html 102 -${RM} -r docs/source/demo 103 -${RM} -r docs/source/reference 104 -${RM} docs/source/*.inv 105 106website: 107 ${RM} -r petsc-doc-env 108 ${PYTHON} -m venv petsc-doc-env 109 . petsc-doc-env/bin/activate && env CFLAGS=-O0 python -m pip install .[doc] 110 . petsc-doc-env/bin/activate && ${MAKE} sphinx-html SPHINXOPTS=-Wj2 111 mkdir -p ${LOC}/petsc4py 112 mv docs/html/* ${LOC}/petsc4py 113 114# ---- 115 116.PHONY: sdist 117sdist: 118 ${PYTHON} setup.py sdist ${opt} 119 120# ---- 121