X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=docs%2FMakefile;h=6c5960d18c487736e986d969cb7e0f2a4f121afc;hb=4422753b9f7edf7ff391f97a10c1b8a7dbd7dafb;hp=430877792a8a146ff91b3fa8e9c78e45f6768d54;hpb=3bfeff7a9812c025637ee232cca03a6f083bdbc6;p=vpp.git diff --git a/docs/Makefile b/docs/Makefile index 430877792a8..6c5960d18c4 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,5 +1,15 @@ # 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 +DOC_RPM_DEPENDS = enchant # You can set these variables from the command line. SPHINXOPTS = @@ -18,3 +28,19 @@ help: # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +spell: + @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 + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" -W -b spelling $(O)