blob: 608df0a1baf70af154b109de9504738b1b4b0608 [file] [log] [blame]
Dave Wallacef0797d12019-11-15 17:29:15 -05001# Makefile for VPP Test documentation
Klement Sekeraf62ae122016-10-11 11:47:09 +02002#
3
Klement Sekeraf62ae122016-10-11 11:47:09 +02004SPHINXOPTS =
Klement Sekerab8c72a42018-11-08 11:21:39 +01005SRC_DOC_DIR = $(TEST_DIR)/doc
Klement Sekera277b89c2016-10-28 13:20:27 +02006SPHINXBUILD = sphinx-build
Dave Wallacef0797d12019-11-15 17:29:15 -05007HTML_DOC_GEN_DIR = $(TEST_DOC_BR)/html
8API_DOC_GEN_DIR = $(TEST_DOC_BR)/api
Klement Sekeraf62ae122016-10-11 11:47:09 +02009
10# Internal variables.
Dave Wallacef0797d12019-11-15 17:29:15 -050011ALLSPHINXOPTS = -d $(TEST_DOC_BR)/.sphinx-cache $(SPHINXOPTS) $(API_DOC_GEN_DIR) -c $(SRC_DOC_DIR)
Klement Sekerab8c72a42018-11-08 11:21:39 +010012IN_VENV:=$(shell if pip -V | grep "venv" 2>&1 > /dev/null; then echo 1; else echo 0; fi)
Klement Sekera277b89c2016-10-28 13:20:27 +020013
14.PHONY: verify-virtualenv
15verify-virtualenv:
Dave Wallacef0797d12019-11-15 17:29:15 -050016ifndef TEST_DIR
17 $(error TEST_DIR is not set)
18endif
19ifndef TEST_DOC_BR
20 $(error TEST_DOC_BR is not set)
21endif
22ifndef BUILD_TEST_SRC
23 $(error BUILD_TEST_SRC is not set)
24endif
Klement Sekera277b89c2016-10-28 13:20:27 +020025ifeq ($(IN_VENV),0)
26 $(error "Not running inside virtualenv (are you running 'make test-doc' from root?)")
27endif
Klement Sekeraf62ae122016-10-11 11:47:09 +020028
Matej Klotton86d87c42016-11-11 11:38:55 +010029.PHONY: regen-api-doc
30regen-api-doc: verify-virtualenv
31 @mkdir -p $(API_DOC_GEN_DIR)
Matej Klotton86d87c42016-11-11 11:38:55 +010032 @cp $(SRC_DOC_DIR)/index.rst $(API_DOC_GEN_DIR)
Klement Sekerae7c034b2017-01-26 14:54:47 +010033 @cp $(SRC_DOC_DIR)/indices.rst $(API_DOC_GEN_DIR)
34 @cp $(SRC_DOC_DIR)/overview.rst $(API_DOC_GEN_DIR)
Dave Wallacef0797d12019-11-15 17:29:15 -050035 sphinx-apidoc -o $(API_DOC_GEN_DIR) -H "Module documentation" $(BUILD_TEST_SRC)
Klement Sekeraf62ae122016-10-11 11:47:09 +020036
37.PHONY: html
Matej Klotton86d87c42016-11-11 11:38:55 +010038html: regen-api-doc verify-virtualenv
Dave Wallacef0797d12019-11-15 17:29:15 -050039 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(HTML_DOC_GEN_DIR)