xref: /petsc/doc/makefile (revision 5e642da6b4a46709adce9ab5b0b0e76c08844485)
14754a72fSPatrick Sanan# Initially generated with sphinx-quickstart
24754a72fSPatrick Sanan
34754a72fSPatrick Sanan# You can set these variables from the command line, and also
44754a72fSPatrick Sanan# from the environment for the first two.
54754a72fSPatrick SananSPHINXOPTS    ?=
64754a72fSPatrick SananSPHINXBUILD   ?= sphinx-build
74754a72fSPatrick SananSOURCEDIR     = .
84754a72fSPatrick SananBUILDDIR      = _build
94754a72fSPatrick SananLINKCHECKDIR  = _build/linkcheck
104754a72fSPatrick Sanan
114754a72fSPatrick Sanan# First so that "make" without arguments is like "make help".
124754a72fSPatrick Sananhelp:
1386a7890dSBarry Smith	-@echo "   make sphinxhtml - build the HTML website inside a created Python virtual environment (venv)"
1486a7890dSBarry Smith
1586a7890dSBarry Smith# The following does not work because it triggers the loading of docutils that many people may not have in Python
1686a7890dSBarry Smith#	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
174754a72fSPatrick Sanan
184754a72fSPatrick Sanan.PHONY: help makefile checklinks
194754a72fSPatrick Sanan
2088932633SBarry Smithchecklinks_rule:
214754a72fSPatrick Sanan	@$(SPHINXBUILD) -b linkcheck "$(SOURCEDIR)" "$(LINKCHECKDIR)" $(SPHINXOPTS)
224754a72fSPatrick Sanan	@echo
234754a72fSPatrick Sanan	@echo "Check finished. Report is in $(LINKCHECKDIR)."
244754a72fSPatrick Sanan
2588932633SBarry Smithchecklinks:
26ff7a8e4fSBarry Smith	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
2788932633SBarry Smith
2892d13c0eSBarry Smithclean:
2992d13c0eSBarry Smith	-@${RM} -rf _build __pycache__
30fc94438bSBarry Smith
314754a72fSPatrick Sananimages:
3273fdd05bSBarry Smith	git clone https://gitlab.com/petsc/images.git -b main-2 --depth=1 images
334754a72fSPatrick Sanan
344754a72fSPatrick Sananwebsite-deploy: images
35a019710eSSatish Balay	$(SPHINXBUILD) -b dirhtml "$(SOURCEDIR)" "$(BUILDDIR)"  -T -E -j auto $(SPHINXOPTS)
364754a72fSPatrick Sanan
3766c9fbddSBarry Smith# use this rule to build the documentation on your machine when working on PETSc documentation
38*7f019730SBarry Smithdocs:
39*7f019730SBarry Smith	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
40997fbc66SBarry Smith
41*7f019730SBarry Smithdocspdf:
42*7f019730SBarry Smith	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
43fc94438bSBarry Smith
44*7f019730SBarry Smith# Catch-all target: route all unknown targets to Sphinx using the new "make mode" option.
454754a72fSPatrick Sanan%: makefile images
46a019710eSSatish Balay	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)"  -j auto $(SPHINXOPTS)
47