xref: /aosp_15_r20/external/pytorch/docs/Makefile (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1# Minimal makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line.
5SPHINXOPTS    ?= -j auto -WT --keep-going
6SPHINXBUILD   ?= sphinx-build
7SPHINXPROJ    ?= PyTorch
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
16figures:
17	@$(PYCMD) source/scripts/build_activation_images.py
18	@$(PYCMD) source/scripts/build_quantization_configs.py
19
20onnx:
21	@$(PYCMD) source/scripts/onnx/build_onnx_torchscript_supported_aten_op_csv_table.py
22	@$(PYCMD) source/scripts/onnx/build_onnx_dynamo_diagnostics_rules_md.py $(SOURCEDIR)/generated/onnx_dynamo_diagnostics_rules
23
24opset:
25	@$(PYCMD) source/scripts/build_opsets.py
26
27exportdb:
28	@$(PYCMD) source/scripts/exportdb/generate_example_rst.py
29
30docset: html
31	doc2dash --name $(SPHINXPROJ) --icon $(SOURCEDIR)/_static/img/pytorch-logo-flame.png --enable-js --online-redirect-url https://pytorch.org/docs/ --force $(BUILDDIR)/html/
32
33	# Manually fix because Zeal doesn't deal well with `icon.png`-only at 2x resolution.
34	cp $(SPHINXPROJ).docset/icon.png $(SPHINXPROJ).docset/icon@2x.png
35	convert $(SPHINXPROJ).docset/icon@2x.png -resize 16x16 $(SPHINXPROJ).docset/icon.png
36
37html-stable:
38	# stable differs from `make html` in two ways:
39	# 1) The stable logo is used instead of the unstable logo
40	# 2) There will not be a link to the stable docs.
41	# See conf.py for more details.
42	RELEASE=1 make html
43
44.PHONY: help Makefile docset onnx exportdb
45
46# Catch-all target: route all unknown targets to Sphinx using the new
47# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
48%: Makefile figures onnx opset exportdb
49	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
50
51clean:
52	@echo "Removing everything under 'build' and 'source/generated'.."
53	@rm -rf $(BUILDDIR)/html/ $(BUILDDIR)/doctrees $(SOURCEDIR)/generated $(BUILDDIR)/auto_gen_aten_op_list.csv
54