John DeNisco | 2d1a043 | 2018-07-26 16:21:31 -0400 | [diff] [blame] | 1 | # Minimal makefile for Sphinx documentation |
| 2 | # |
Paul Vinciguerra | 340c15c | 2019-11-05 15:34:36 -0500 | [diff] [blame] | 3 | # We support MacOS for docs generation |
| 4 | ifeq ($(shell uname),Darwin) |
| 5 | OS_ID = darwin |
| 6 | endif |
| 7 | |
| 8 | # Work out the OS if we haven't already |
| 9 | OS_ID ?= $(shell grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') |
| 10 | |
Paul Vinciguerra | a26f544 | 2020-03-11 13:28:27 -0400 | [diff] [blame] | 11 | DOC_DEB_DEPENDS = enchant |
| 12 | DOC_RPM_DEPENDS = enchant |
John DeNisco | 2d1a043 | 2018-07-26 16:21:31 -0400 | [diff] [blame] | 13 | |
| 14 | # You can set these variables from the command line. |
| 15 | SPHINXOPTS = |
| 16 | SPHINXBUILD = sphinx-build |
jdenisco | 3bfeff7 | 2019-05-17 17:43:31 +0000 | [diff] [blame] | 17 | SPHINXPROJ = fdio-vpp |
John DeNisco | 2d1a043 | 2018-07-26 16:21:31 -0400 | [diff] [blame] | 18 | SOURCEDIR = . |
| 19 | BUILDDIR = _build |
| 20 | |
| 21 | # Put it first so that "make" without argument is like "make help". |
| 22 | help: |
| 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 Vinciguerra | a26f544 | 2020-03-11 13:28:27 -0400 | [diff] [blame] | 30 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 31 | |
| 32 | spell: |
Paul Vinciguerra | 340c15c | 2019-11-05 15:34:36 -0500 | [diff] [blame] | 33 | @echo "Checking whether dependencies for Docs are installed..." |
| 34 | ifeq ($(OS_ID),ubuntu) |
| 35 | @set -e; inst=; \ |
| 36 | for i in $(DOC_DEB_DEPENDS); do \ |
| 37 | dpkg-query --show $$i >/dev/null 2>&1 || inst="$$inst $$i"; \ |
| 38 | done; \ |
| 39 | if [ "$$inst" ]; then \ |
| 40 | sudo apt-get update; \ |
| 41 | sudo apt-get $(CONFIRM) $(FORCE) install $$inst; \ |
| 42 | fi |
| 43 | else ifneq ("$(wildcard /etc/redhat-release)","") |
| 44 | @sudo yum install $(CONFIRM) $(DOC_RPM_DEPENDS) |
| 45 | endif |
Paul Vinciguerra | a26f544 | 2020-03-11 13:28:27 -0400 | [diff] [blame] | 46 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" -W -b spelling $(O) |