xref: /DragonOS/docs/Makefile (revision abc421a67f4aaf473e8028a207222fc3986493d8)
10d0705a1Slongjin# Minimal makefile for Sphinx documentation
20d0705a1Slongjin#
30d0705a1Slongjin
40d0705a1Slongjin# You can set these variables from the command line, and also
50d0705a1Slongjin# from the environment for the first two.
60d0705a1SlongjinSPHINXOPTS    ?=
70d0705a1SlongjinSPHINXBUILD   ?= sphinx-build
80d0705a1SlongjinSOURCEDIR     = .
90d0705a1SlongjinBUILDDIR      = _build
100d0705a1Slongjin
11920bda59SLoGinLANGUAGE      = zh_CN
12920bda59SLoGin
13920bda59SLoGinSPHINXOPTS	+= -D language=$(LANGUAGE)
14920bda59SLoGin
15920bda59SLoGinexport CURRENT_GIT_COMMIT_HASH := $(shell git rev-parse --short HEAD)
16920bda59SLoGin
17920bda59SLoGinGIT_STATUS := $(shell git status --porcelain --untracked-files=no)
18920bda59SLoGin
19920bda59SLoGinifeq ($(strip $(GIT_STATUS)),)
20920bda59SLoGin    export CURRENT_GIT_COMMIT_DIRTY = 0
21920bda59SLoGinelse
22920bda59SLoGin    export CURRENT_GIT_COMMIT_DIRTY = 1
23920bda59SLoGinendif
24920bda59SLoGin
250d0705a1Slongjin# Put it first so that "make" without argument is like "make help".
260d0705a1Slongjinhelp:
270d0705a1Slongjin	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
280d0705a1Slongjin
290d0705a1Slongjin.PHONY: help Makefile
300d0705a1Slongjin
310d0705a1Slongjin# Catch-all target: route all unknown targets to Sphinx using the new
320d0705a1Slongjin# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
330d0705a1Slongjin%: Makefile
340d0705a1Slongjin	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35c635d8a9SLoGin
36c635d8a9SLoGin.PHONY:
37c635d8a9SLoGinhtml-multiversion:
38920bda59SLoGin	rm -rf ./$(BUILDDIR) && CURRENT_GIT_COMMIT_DIRTY=0 sphinx-multiversion $(SPHINXOPTS) "$(SOURCEDIR)" ./$(BUILDDIR)/html && cp -rf ./$(BUILDDIR)/html/master/* ./$(BUILDDIR)/html/
39*abc421a6SLoGin
40*abc421a6SLoGinhttp_server:
41*abc421a6SLoGin	python3 -m http.server --directory $(BUILDDIR)/html
42