xref: /petsc/doc/makefile (revision ccfb0f9f40a0131988d7995ed9679700dae2a75a)
1# Initially generated with sphinx-quickstart
2
3# You can set these variables from the command line, and also
4# from the environment for the first two.
5SPHINXOPTS    ?=
6SPHINXBUILD   ?= sphinx-build
7SOURCEDIR     = .
8BUILDDIR      = _build
9LINKCHECKDIR  = _build/linkcheck
10
11# First so that "make" without arguments is like "make help".
12help:
13	-@echo "   make sphinxhtml - build the HTML website inside a created Python virtual environment (venv)"
14
15# The following does not work because it triggers the loading of docutils that many people may not have in Python
16#	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
17
18.PHONY: help makefile checklinks
19
20checklinks_rule:
21	@$(SPHINXBUILD) -b linkcheck "$(SOURCEDIR)" "$(LINKCHECKDIR)" $(SPHINXOPTS)
22	@echo
23	@echo "Check finished. Report is in $(LINKCHECKDIR)."
24
25checklinks:
26	cd .. ; ${RM} -rf petsc-doc-env; python3 -m venv petsc-doc-env ; source petsc-doc-env/bin/activate ; python3 -m pip install -r doc/requirements.txt ; cd doc ; make checklinks_rule; deactivate
27
28clean:
29	-@${RM} -rf _build __pycache__
30
31images:
32	git clone https://gitlab.com/petsc/images.git -b main-2 --depth=1 images
33
34website-deploy: images
35	$(SPHINXBUILD) -b dirhtml "$(SOURCEDIR)" "$(BUILDDIR)"  -T -E -j auto $(SPHINXOPTS)
36
37# use this rule to build the documentation on your machine when working on PETSc documentation
38docs:
39	cd .. ; if [ ! -z ${PETSC_ARCH} ]; then export PETSC_DOC=${PETSC_ARCH}-doc; ${RM} -rf $${PETSC_DOC} ;  cp -r  doc $${PETSC_DOC}; else export PETSC_DOC=doc ; fi;  python3 -m venv petsc-doc-env ; . petsc-doc-env/bin/activate ; python3 -m pip install --quiet -r doc/requirements.txt ; cd $${PETSC_DOC} ;  make  SPHINXOPTS="-T -E -W --keep-going -j 8" html  ;  deactivate
40
41docspdf:
42	cd .. ; if [ ! -z ${PETSC_ARCH} ]; then export PETSC_DOC=${PETSC_ARCH}-doc; ${RM} -rf $${PETSC_DOC} ;  cp -r  doc $${PETSC_DOC}; else export PETSC_DOC=doc ; fi;  python3 -m venv petsc-doc-env ; . petsc-doc-env/bin/activate ; python3 -m pip install --quiet -r doc/requirements.txt ; cd $${PETSC_DOC} ;  make  SPHINXOPTS="-T -E -W --keep-going -j 8" latexpdf  ;  deactivate
43
44# Catch-all target: route all unknown targets to Sphinx using the new "make mode" option.
45%: makefile images
46	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)"  -j auto $(SPHINXOPTS)
47