xref: /DragonOS/docs/Makefile (revision 80c9e8f8f0adb25c1a33ff09cb51e7df5b1cdd99)
1# Minimal makefile for Sphinx documentation
2#
3
4# You can set these variables from the command line, and also
5# from the environment for the first two.
6SPHINXOPTS    ?=
7SPHINXBUILD   ?= sphinx-build
8SOURCEDIR     = .
9BUILDDIR      = _build
10
11LANGUAGE      = zh_CN
12
13SPHINXOPTS	+= -D language=$(LANGUAGE)
14
15export CURRENT_GIT_COMMIT_HASH := $(shell git rev-parse --short HEAD)
16
17GIT_STATUS := $(shell git status --porcelain --untracked-files=no)
18
19ifeq ($(strip $(GIT_STATUS)),)
20    export CURRENT_GIT_COMMIT_DIRTY = 0
21else
22    export CURRENT_GIT_COMMIT_DIRTY = 1
23endif
24
25# Put it first so that "make" without argument is like "make help".
26help:
27	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
28
29.PHONY: help Makefile
30
31# Catch-all target: route all unknown targets to Sphinx using the new
32# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
33%: Makefile
34	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35
36.PHONY:
37html-multiversion:
38	rm -rf ./$(BUILDDIR) && CURRENT_GIT_COMMIT_DIRTY=0 sphinx-multiversion $(SPHINXOPTS) "$(SOURCEDIR)" ./$(BUILDDIR)/html && cp -rf ./$(BUILDDIR)/html/master/* ./$(BUILDDIR)/html/
39
40http_server:
41	python3 -m http.server --directory $(BUILDDIR)/html
42