2019-11-15 17:29:15 -05:00
|
|
|
# Makefile for VPP Test documentation
|
2016-10-11 11:47:09 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
SPHINXOPTS =
|
2018-11-08 11:21:39 +01:00
|
|
|
SRC_DOC_DIR = $(TEST_DIR)/doc
|
2016-10-28 13:20:27 +02:00
|
|
|
SPHINXBUILD = sphinx-build
|
2019-11-15 17:29:15 -05:00
|
|
|
HTML_DOC_GEN_DIR = $(TEST_DOC_BR)/html
|
|
|
|
API_DOC_GEN_DIR = $(TEST_DOC_BR)/api
|
2016-10-11 11:47:09 +02:00
|
|
|
|
|
|
|
# Internal variables.
|
2019-11-15 17:29:15 -05:00
|
|
|
ALLSPHINXOPTS = -d $(TEST_DOC_BR)/.sphinx-cache $(SPHINXOPTS) $(API_DOC_GEN_DIR) -c $(SRC_DOC_DIR)
|
2018-11-08 11:21:39 +01:00
|
|
|
IN_VENV:=$(shell if pip -V | grep "venv" 2>&1 > /dev/null; then echo 1; else echo 0; fi)
|
2016-10-28 13:20:27 +02:00
|
|
|
|
|
|
|
.PHONY: verify-virtualenv
|
|
|
|
verify-virtualenv:
|
2019-11-15 17:29:15 -05:00
|
|
|
ifndef TEST_DIR
|
|
|
|
$(error TEST_DIR is not set)
|
|
|
|
endif
|
|
|
|
ifndef TEST_DOC_BR
|
|
|
|
$(error TEST_DOC_BR is not set)
|
|
|
|
endif
|
|
|
|
ifndef BUILD_TEST_SRC
|
|
|
|
$(error BUILD_TEST_SRC is not set)
|
|
|
|
endif
|
2016-10-28 13:20:27 +02:00
|
|
|
ifeq ($(IN_VENV),0)
|
|
|
|
$(error "Not running inside virtualenv (are you running 'make test-doc' from root?)")
|
|
|
|
endif
|
2016-10-11 11:47:09 +02:00
|
|
|
|
2016-11-11 11:38:55 +01:00
|
|
|
.PHONY: regen-api-doc
|
|
|
|
regen-api-doc: verify-virtualenv
|
|
|
|
@mkdir -p $(API_DOC_GEN_DIR)
|
|
|
|
@cp $(SRC_DOC_DIR)/index.rst $(API_DOC_GEN_DIR)
|
2017-01-26 14:54:47 +01:00
|
|
|
@cp $(SRC_DOC_DIR)/indices.rst $(API_DOC_GEN_DIR)
|
|
|
|
@cp $(SRC_DOC_DIR)/overview.rst $(API_DOC_GEN_DIR)
|
2019-11-15 17:29:15 -05:00
|
|
|
sphinx-apidoc -o $(API_DOC_GEN_DIR) -H "Module documentation" $(BUILD_TEST_SRC)
|
2016-10-11 11:47:09 +02:00
|
|
|
|
|
|
|
.PHONY: html
|
2016-11-11 11:38:55 +01:00
|
|
|
html: regen-api-doc verify-virtualenv
|
2019-11-15 17:29:15 -05:00
|
|
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(HTML_DOC_GEN_DIR)
|