X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=docs%2FMakefile;h=4e8f1634b212a8d6469e9c1e2f010de36d4d6a80;hb=c701e5718201fbfb205998343da70c816c57795f;hp=60e4b90b94a2745b42c7622da8eb3d5c0c769f66;hpb=2d1a04371a8e61f9d5ba8b028f41fcbcec017b9c;p=vpp.git diff --git a/docs/Makefile b/docs/Makefile index 60e4b90b94a..4e8f1634b21 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,10 +1,21 @@ # 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-firstcut +SPHINXPROJ = fdio-vpp SOURCEDIR = . BUILDDIR = _build @@ -17,4 +28,20 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file + @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 +# Disable spell checking for now +# @python3 -m pip install sphinxcontrib-spelling +# @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" -W -b spelling $(O) + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)