xref: /aosp_15_r20/external/pytorch/functorch/docs/Makefile (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1# Minimal makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line.
5SPHINXOPTS    ?= -WT --keep-going
6SPHINXBUILD   ?= sphinx-build
7SPHINXPROJ    ?= functorch
8SOURCEDIR     ?= source
9BUILDDIR      ?= build
10PYCMD         ?= python
11
12# Put it first so that "make" without argument is like "make help".
13help:
14	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
15
16docset: html
17	doc2dash --name $(SPHINXPROJ) --icon $(SOURCEDIR)/_static/img/pytorch-logo-flame.png --enable-js --online-redirect-url https://pytorch.org/docs/ --force $(BUILDDIR)/html/
18
19	# Manually fix because Zeal doesn't deal well with `icon.png`-only at 2x resolution.
20	cp $(SPHINXPROJ).docset/icon.png $(SPHINXPROJ).docset/icon@2x.png
21	convert $(SPHINXPROJ).docset/icon@2x.png -resize 16x16 $(SPHINXPROJ).docset/icon.png
22
23html-stable:
24	# stable differs from `make html` in two ways:
25	# 1) The stable logo is used instead of the unstable logo
26	# 2) There will not be a link to the stable docs.
27	# See conf.py for more details.
28	RELEASE=1 make html
29
30.PHONY: help Makefile docset
31
32# Catch-all target: route all unknown targets to Sphinx using the new
33# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
34%: Makefile
35	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
36
37clean:
38	@echo "Removing everything under 'build' and 'source/generated'.."
39	@rm -rf $(BUILDDIR)/html/ $(BUILDDIR)/doctrees $(SOURCEDIR)/generated
40