Skip to content

Commit 9a3e988

Browse files
committed
Add 'make htmlview' and be consistent with our other Makefiles
1 parent d3834da commit 9a3e988

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

Diff for: Makefile

+19-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
1-
CPYTHON_PATH = ../cpython
1+
# You can set these variables from the command line.
2+
CPYTHON_PATH = ../cpython
3+
PYTHON = python3
24
PACKAGE_ABS_PATH = $(shell pwd)/$(shell find dist/python-docs-theme-*.tar.gz)
35

46

5-
.PHONY: html
6-
html: venv
7-
cd $(CPYTHON_PATH)/Doc && \
8-
make html
9-
7+
.PHONY: help
8+
help:
9+
@echo "Please use \`make <target>' where <target> is one of"
10+
@echo " venv to create a venv with necessary tools at $(CPYTHON_PATH)/Doc/venv"
11+
@echo " html to make standalone CPython HTML files"
12+
@echo " htmlview to open the index page built by the html target in your browser"
1013

1114
.PHONY: venv
1215
venv:
13-
python3 -m pip install build
14-
python3 -m build
16+
$(PYTHON) -m pip install build
17+
$(PYTHON) -m build
1518
cd $(CPYTHON_PATH)/Doc \
1619
&& make venv \
1720
&& ./venv/bin/pip install $(PACKAGE_ABS_PATH)
1821

19-
.PHONY: help
20-
help:
21-
@echo "html: default rule; run the \`venv\` rule, and also rebuild the CPython docs"
22-
@echo "venv: build the package, and install it into the virtual environment"
23-
@echo " at $(CPYTHON_PATH)/Doc/venv"
22+
.PHONY: html
23+
html: venv
24+
cd $(CPYTHON_PATH)/Doc && \
25+
make html
26+
27+
.PHONY: htmlview
28+
htmlview: html
29+
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('$(CPYTHON_PATH)/Doc/build/html/index.html'))"

0 commit comments

Comments
 (0)