Makefile 1.2 KB

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