xref: /DragonOS/docs/Makefile (revision 920bda5958b1ac1c143b3f1c5663d42b1574733e)
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
11*920bda59SLoGinLANGUAGE      = zh_CN
12*920bda59SLoGin
13*920bda59SLoGinSPHINXOPTS	+= -D language=$(LANGUAGE)
14*920bda59SLoGin
15*920bda59SLoGinexport CURRENT_GIT_COMMIT_HASH := $(shell git rev-parse --short HEAD)
16*920bda59SLoGin
17*920bda59SLoGinGIT_STATUS := $(shell git status --porcelain --untracked-files=no)
18*920bda59SLoGin
19*920bda59SLoGinifeq ($(strip $(GIT_STATUS)),)
20*920bda59SLoGin    export CURRENT_GIT_COMMIT_DIRTY = 0
21*920bda59SLoGinelse
22*920bda59SLoGin    export CURRENT_GIT_COMMIT_DIRTY = 1
23*920bda59SLoGinendif
24*920bda59SLoGin
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:
38*920bda59SLoGin	rm -rf ./$(BUILDDIR) && CURRENT_GIT_COMMIT_DIRTY=0 sphinx-multiversion $(SPHINXOPTS) "$(SOURCEDIR)" ./$(BUILDDIR)/html && cp -rf ./$(BUILDDIR)/html/master/* ./$(BUILDDIR)/html/
39