blob: 49938640a349a385f505a67d453625c9070576f0 [file] [log] [blame]
John DeNisco2d1a0432018-07-26 16:21:31 -04001# Minimal makefile for Sphinx documentation
2#
Paul Vinciguerra340c15c2019-11-05 15:34:36 -05003# We support MacOS for docs generation
4ifeq ($(shell uname),Darwin)
5OS_ID = darwin
6endif
7
8# Work out the OS if we haven't already
9OS_ID ?= $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
10
Paul Vinciguerraa26f5442020-03-11 13:28:27 -040011DOC_DEB_DEPENDS = enchant
12DOC_RPM_DEPENDS = enchant
John DeNisco2d1a0432018-07-26 16:21:31 -040013
14# You can set these variables from the command line.
15SPHINXOPTS =
16SPHINXBUILD = sphinx-build
jdenisco3bfeff72019-05-17 17:43:31 +000017SPHINXPROJ = fdio-vpp
John DeNisco2d1a0432018-07-26 16:21:31 -040018SOURCEDIR = .
19BUILDDIR = _build
20
21# Put it first so that "make" without argument is like "make help".
22help:
23 @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
24
25.PHONY: help Makefile
26
27# Catch-all target: route all unknown targets to Sphinx using the new
28# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
29%: Makefile
Paul Vinciguerra630ca992020-03-24 16:37:40 -040030# Generate dynamic content
31 @python3 ./includes_renderer.py
Paul Vinciguerraa26f5442020-03-11 13:28:27 -040032 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
33
34spell:
Paul Vinciguerra340c15c2019-11-05 15:34:36 -050035 @echo "Checking whether dependencies for Docs are installed..."
36ifeq ($(OS_ID),ubuntu)
37 @set -e; inst=; \
38 for i in $(DOC_DEB_DEPENDS); do \
39 dpkg-query --show $$i >/dev/null 2>&1 || inst="$$inst $$i"; \
40 done; \
41 if [ "$$inst" ]; then \
42 sudo apt-get update; \
43 sudo apt-get $(CONFIRM) $(FORCE) install $$inst; \
44 fi
45else ifneq ("$(wildcard /etc/redhat-release)","")
46 @sudo yum install $(CONFIRM) $(DOC_RPM_DEPENDS)
47endif
Paul Vinciguerraa26f5442020-03-11 13:28:27 -040048 @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" -W -b spelling $(O)