aboutsummaryrefslogtreecommitdiffstats
path: root/docs/Makefile
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2022-03-25 12:06:51 +0100
committerDave Wallace <dwallacelf@gmail.com>2022-05-24 16:58:36 -0400
commit1e167a4aadcf254cc8b755b3b45843604de58cb2 (patch)
tree89ebf6ef02059cd2615956ab4b05834ebde39748 /docs/Makefile
parent26c39878ad8c2e5e673956327badcd6e419488db (diff)
docs: make docs build incremental
This patch makes the `make docs` directive incremental avoiding re-running the siphon when the source hasn't changed, and leveraging sphinx internal cache. It adds a `make rebuild-docs` directive for cases where this caching logic might break, e.g. in CI. The virtualenv doesn't also get recreated on each build, which might be enough when writing docs, provided automated process leverage its rebuild counterpart. Type: improvement Change-Id: Ie90de3adebeed017b249cad81c6c160719f71e8d Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'docs/Makefile')
-rw-r--r--docs/Makefile45
1 files changed, 15 insertions, 30 deletions
diff --git a/docs/Makefile b/docs/Makefile
index 71ee034b331..01e8d659bff 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -21,7 +21,6 @@ WS_ROOT ?= $(CURDIR)/..
BR ?= $(WS_ROOT)/build-root
DOCS_DIR ?= $(WS_ROOT)/docs
-VENV_DIR ?= $(DOCS_DIR)/venv
SPHINX_SCRIPTS_DIR ?= $(WS_ROOT)/docs/scripts
# Work out the OS if we haven't already
@@ -40,11 +39,11 @@ endif
SPHINXOPTS = --keep-going -n -W
SPHINXBUILD = sphinx-build
SPHINXPROJ = fdio-vpp
-SOURCEDIR = .
BUILDDIR = ${BR}/docs
BUILDDIR_SRC = ${BUILDDIR}/src
BUILDDIR_OUT = ${BUILDDIR}/html
SCRIPTS_DIR = _scripts
+VENV_DIR ?= $(BUILDDIR)/venv
# Put it first so that "make" without argument is like "make help".
@@ -55,28 +54,6 @@ help:
$(SPHINXBUILD) --help ;\
)
-.PHONY: checkdeps
-checkdeps:
- @echo "Checking whether dependencies for Docs are installed..."
-ifeq ($(OS_ID),ubuntu)
- @set -e; inst=; \
- for i in $(DOC_DEB_DEPENDS); do \
- dpkg-query --show $$i >/dev/null 2>&1 || inst="$$inst $$i"; \
- done; \
- if [ "$$inst" ]; then \
- sudo apt-get update; \
- sudo apt-get $(CONFIRM) $(FORCE) install $$inst; \
- fi
-endif
-
-.PHONY: spell
-spell: clean checkdeps venv ${BUILDDIR_SRC}
- @( \
- . ${VENV_DIR}/bin/activate; \
- make -C ${SCRIPTS_DIR} generate && \
- $(SPHINXBUILD) -b spelling $(SPHINXOPTS) $(BUILDDIR_SRC) $(BUILDDIR_OUT); \
- )
-
.PHONY: venv
venv:
@( \
@@ -89,22 +66,30 @@ venv:
fi; \
)
-${BUILDDIR_SRC}:
- @mkdir -p ${BUILDDIR_SRC}
- @cp -r $(SOURCEDIR) ${BUILDDIR_SRC}
- @cd ${BUILDDIR_SRC} && find . -type l -exec cp --remove-destination -L ${DOCS_DIR}/{} {} \;
+.PHONY: spell
+spell: venv
+ @( \
+ . ${VENV_DIR}/bin/activate; \
+ make -C ${SCRIPTS_DIR} generate && \
+ $(SPHINXBUILD) -b spelling $(SPHINXOPTS) $(BUILDDIR_SRC) $(BUILDDIR_OUT); \
+ )
+
+.PHONY: rebuild-spell
+rebuild-spell: clean spell
.PHONY: docs
-docs: clean venv ${BUILDDIR_SRC}
+docs: venv
@( \
. ${VENV_DIR}/bin/activate; \
make -C ${SCRIPTS_DIR} generate && \
$(SPHINXBUILD) $(SPHINXOPTS) -b html $(BUILDDIR_SRC) $(BUILDDIR_OUT); \
)
+.PHONY: rebuild
+rebuild: clean docs
+
.PHONY: clean
clean:
- @rm -rf $(BUILDDIR) ${VENV_DIR}
@make -C ${SCRIPTS_DIR} clean
.PHONY: build