blob: 2d06cedd0be53447f0435c5cdfb651d8711d309c [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
Klement Sekera277b89c2016-10-28 13:20:27 +020022ifeq ($(IN_VENV),0)
23 $(error "Not running inside virtualenv (are you running 'make test-doc' from root?)")
24endif
Klement Sekeraf62ae122016-10-11 11:47:09 +020025
Matej Klotton86d87c42016-11-11 11:38:55 +010026.PHONY: regen-api-doc
27regen-api-doc: verify-virtualenv
28 @mkdir -p $(API_DOC_GEN_DIR)
Matej Klotton86d87c42016-11-11 11:38:55 +010029 @cp $(SRC_DOC_DIR)/index.rst $(API_DOC_GEN_DIR)
Klement Sekerae7c034b2017-01-26 14:54:47 +010030 @cp $(SRC_DOC_DIR)/indices.rst $(API_DOC_GEN_DIR)
31 @cp $(SRC_DOC_DIR)/overview.rst $(API_DOC_GEN_DIR)
Dave Wallaceeddd8e32021-05-12 21:43:59 -040032 sphinx-apidoc -o $(API_DOC_GEN_DIR) -H "Module documentation" $(TEST_DIR)
Klement Sekeraf62ae122016-10-11 11:47:09 +020033
34.PHONY: html
Matej Klotton86d87c42016-11-11 11:38:55 +010035html: regen-api-doc verify-virtualenv
Dave Wallacef0797d12019-11-15 17:29:15 -050036 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(HTML_DOC_GEN_DIR)