|
1 | | -# Minimal makefile for Sphinx documentation |
| 1 | +# Makefile for Sphinx documentation |
2 | 2 | # |
3 | 3 |
|
4 | 4 | # You can set these variables from the command line, and also |
5 | 5 | # from the environment for the first two. |
6 | 6 | SPHINXOPTS ?= |
7 | | -SPHINXBUILD ?= sphinx-build |
| 7 | +SPHINXBUILD ?= sphinx-multiversion |
8 | 8 | SOURCEDIR = source |
9 | 9 | BUILDDIR = build |
| 10 | +UNAME = "Windows_NT" |
| 11 | +ifeq ($(OS),Windows_NT) |
| 12 | +UNAME_AVAIL = "false" |
| 13 | +else |
| 14 | +UNAME_AVAIL = "true" |
| 15 | +endif |
| 16 | + |
| 17 | +ifeq ($(UNAME_AVAIL), "true") |
| 18 | +UNAME = $(shell uname -s) |
| 19 | +endif |
10 | 20 |
|
11 | 21 | # Put it first so that "make" without argument is like "make help". |
12 | 22 | help: |
13 | | - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 23 | + @$(SPHINXBUILD) --help |
14 | 24 |
|
15 | 25 | .PHONY: help Makefile |
16 | 26 |
|
17 | | -# Catch-all target: route all unknown targets to Sphinx using the new |
18 | | -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). |
| 27 | +# Catch-all target: route all unknown targets to Sphinx |
| 28 | +# $(O) is meant as a shortcut for $(SPHINXOPTS). |
19 | 29 | %: Makefile |
20 | | - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 30 | +ifeq ($(UNAME_AVAIL), "true") |
| 31 | +ifeq ($(UNAME), Darwin) |
| 32 | + #We are on OSX |
| 33 | + mkdir -p tmptmp |
| 34 | + TMPDIR=$(CURDIR)/tmptmp $(SPHINXBUILD) "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(0) |
| 35 | + rm -r tmptmp |
| 36 | + cp ./index.html "$(BUILDDIR)/index.html" |
| 37 | +else |
| 38 | + #We are on Linux |
| 39 | + @$(SPHINXBUILD) "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(0) |
| 40 | + cp ./index.html "$(BUILDDIR)/index.html" |
| 41 | +endif |
| 42 | +else |
| 43 | + #We are on Windows_NT |
| 44 | + @$(SPHINXBUILD) "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(0) |
| 45 | + copy .\index.html "$(BUILDDIR)\index.html" |
| 46 | +endif |
| 47 | + |
| 48 | + |
| 49 | +local: |
| 50 | + sphinx-build "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(0) |
| 51 | + |
| 52 | +# We are no longer using make functionality of sphinx-build |
| 53 | +# because sphinx-multiverison does not support it |
| 54 | +# therefore we must define make clean ourselves. |
| 55 | +clean: |
| 56 | +ifeq ($(OS),Windows_NT) |
| 57 | + del /s "$(BUILDDIR)" |
| 58 | +else |
| 59 | + rm -r "$(BUILDDIR)/"* |
| 60 | +endif |
0 commit comments