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 | |
| 11 | DOC_DEB_DEPENDS = enchant libenchant-dev |
| 12 | DOC_RPM_DEPENDS = enchant libenchant-dev |
| 13 | |
John DeNisco | 2d1a043 | 2018-07-26 16:21:31 -0400 | [diff] [blame] | 14 | |
| 15 | # You can set these variables from the command line. |
| 16 | SPHINXOPTS = |
| 17 | SPHINXBUILD = sphinx-build |
jdenisco | 3bfeff7 | 2019-05-17 17:43:31 +0000 | [diff] [blame] | 18 | SPHINXPROJ = fdio-vpp |
John DeNisco | 2d1a043 | 2018-07-26 16:21:31 -0400 | [diff] [blame] | 19 | SOURCEDIR = . |
| 20 | BUILDDIR = _build |
| 21 | |
| 22 | # Put it first so that "make" without argument is like "make help". |
| 23 | help: |
| 24 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
| 25 | |
| 26 | .PHONY: help Makefile |
| 27 | |
| 28 | # Catch-all target: route all unknown targets to Sphinx using the new |
| 29 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). |
| 30 | %: Makefile |
Paul Vinciguerra | 340c15c | 2019-11-05 15:34:36 -0500 | [diff] [blame] | 31 | @echo "Checking whether dependencies for Docs are installed..." |
| 32 | ifeq ($(OS_ID),ubuntu) |
| 33 | @set -e; inst=; \ |
| 34 | for i in $(DOC_DEB_DEPENDS); do \ |
| 35 | dpkg-query --show $$i >/dev/null 2>&1 || inst="$$inst $$i"; \ |
| 36 | done; \ |
| 37 | if [ "$$inst" ]; then \ |
| 38 | sudo apt-get update; \ |
| 39 | sudo apt-get $(CONFIRM) $(FORCE) install $$inst; \ |
| 40 | fi |
| 41 | else ifneq ("$(wildcard /etc/redhat-release)","") |
| 42 | @sudo yum install $(CONFIRM) $(DOC_RPM_DEPENDS) |
| 43 | endif |
John DeNisco | c96d618 | 2019-11-06 10:58:28 -0800 | [diff] [blame] | 44 | # Disable spell checking for now |
| 45 | # @python3 -m pip install sphinxcontrib-spelling |
| 46 | # @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" -W -b spelling $(O) |
jdenisco | 3bfeff7 | 2019-05-17 17:43:31 +0000 | [diff] [blame] | 47 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |