vpp/docs/Makefile
Paul Vinciguerra 340c15c6ed docs: add spellcheck to 'make docs' sphinx docs
The CI gate will fail if there are typos in the docs.

  writing output... [ 21%] events/Summits/OpensourceSummit...
  writing output... [ 22%] events/Summits/UKNO/2017_04_30_...

  featuresbyrelease/vpp16.06.rst:34:Rasberry:vpp16.06
  writing output... [100%] usecases/vppinazure
  Spelling checker messages written to /vpp/docs/_build/html/output.txt

  Warning, treated as error:
  Found 1 misspelled words
  Makefile:31: recipe for target 'html' failed
  make[1]: *** [html] Error 2
  make[1]: Leaving directory '/vpp/docs'

If you introduce a term that is not recognized,
please add it to custom dictionary at
docs/spelling_wordlist.txt.

Type: feature

Change-Id: Id49be4fbee617f544f1ab8e78e7de8a4df36448b
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-11-06 17:53:42 +00:00

47 lines
1.4 KiB
Makefile

# Minimal makefile for Sphinx documentation
#
# We support MacOS for docs generation
ifeq ($(shell uname),Darwin)
OS_ID = darwin
endif
# Work out the OS if we haven't already
OS_ID ?= $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
DOC_DEB_DEPENDS = enchant libenchant-dev
DOC_RPM_DEPENDS = enchant libenchant-dev
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = fdio-vpp
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@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
else ifneq ("$(wildcard /etc/redhat-release)","")
@sudo yum install $(CONFIRM) $(DOC_RPM_DEPENDS)
endif
@python3 -m pip install sphinxcontrib-spelling
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" -W -b spelling $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)