-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
64 lines (51 loc) · 2.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# From https://stackoverflow.com/a/18137056
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_absdir := $(dir $(mkfile_path))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
SPHINX_DOCKER_IMG=sphinxdoc/sphinx
# SPHINX_DOCKER_IMG=sphinxdoc/sphinx-latexpdf
SPHINX_DOCKER_VERSION=3.5.4
SPHINX_TAG=${SPHINX_DOCKER_IMG}:${SPHINX_DOCKER_VERSION}
docker-fix-permissions:
docker run -it --rm --name sphinx-oeb --volume="${mkfile_absdir}:/docs" ${SPHINX_TAG} chown -R $(shell id -u):$(shell id -g) /docs
sphinx-podman-oneshot:
#chmod go+w "${mkfile_absdir}/docs" "${mkfile_absdir}/docs/Gemfile.lock"
podman run -it --rm --name sphinx-oeb --volume="${mkfile_absdir}:/docs" ${SPHINX_TAG} make html
sphinx-podman-serve:
#chmod go+w "${mkfile_absdir}/docs" "${mkfile_absdir}/docs/Gemfile.lock"
podman run -it --rm --name sphinx-oeb --volume="${mkfile_absdir}:/docs" ${SPHINX_TAG} make __serverhtml
sphinx-docker-oneshot:
docker run -it --rm --name sphinx-oeb --volume="${mkfile_absdir}:/docs" ${SPHINX_TAG} make html
# Next one fixes permissions
docker run -it --rm --name sphinx-oeb --volume="${mkfile_absdir}:/docs" ${SPHINX_TAG} chown -R $(shell id -u):$(shell id -g) /docs
sphinx-docker-serve:
docker run -it --rm --name sphinx-oeb --volume="${mkfile_absdir}:/docs" ${SPHINX_TAG} make __serverhtml
# Next one fixes permissions
docker run -it --rm --name sphinx-oeb --volume="${mkfile_absdir}:/docs" ${SPHINX_TAG} chown -R $(shell id -u):$(shell id -g) /docs
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
__serverhtml: Makefile
apt-get update
apt-get install -y inotify-tools
pip install -r requirements.txt
-@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@while read CHANGED ; do \
$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) ; \
done | inotifywait -m -e close_write,move,delete --exclude _build --exclude '.*' -r /docs
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
pip install -r requirements.txt
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)