-
Notifications
You must be signed in to change notification settings - Fork 633
/
Makefile
69 lines (58 loc) · 2.21 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.DEFAULT_GOAL := all
# Replace this path with your local build of doxyrest:
export PYTHONPATH := $(HOME)/code/doxyrest_b/doxyrest/sphinx/:$(PYTHONPATH)
export PATH := $(HOME)/code/doxyrest_b/build/doxyrest/bin/Release:$(PATH)
export MRPT_VERSION_STR := $(shell head -n1 ../version_prefix.txt)
export MRPT_LIST_INCLUDE_DIRS := $(shell for f in ../libs/*/include; do printf "$$(realpath $$f) "; done)
export MRPT_DOX_INPUT_DIRS := $(shell for f in ../libs/*; do printf "$$(realpath $$f) "; done)
# Use to quickly test the documentation scripts:
ifeq ($(MRPT_DOCS_FAST_TEST),1)
export MRPT_DOX_INPUT_DIRS := $(shell realpath ../libs/gui)
endif
.PHONY: clean
clean:
rm -fr html
rm -fr \
source/xml-dir \
source/class_* \
source/enum_* \
source/namespace_* \
source/group_* \
source/struct_* \
source/page_* \
source/union_* \
source/global.rst source/doxygen-index.rst \
2> /dev/null || true
.PHONY: all
all:
make html
python-venv: requirements.txt
# Note: the DEB_PYTHON_INSTALL_LAYOUT=deb below
# is required in u22.04 to fix a bug in virtualenv.
# That env var can be removed once virtualenv > 20.16.5 is everywhere.
# Read: https://askubuntu.com/a/1415153/97996
# Create virtual env for building the docs
DEB_PYTHON_INSTALL_LAYOUT=deb virtualenv -p /usr/bin/python3 venv
bash -c "source venv/bin/activate && pip install -r requirements.txt"
html-and-view:
make html
xdg-open html/index.html
html: python-venv
echo "Building docs for these directories: ${MRPT_DOX_INPUT_DIRS}"
echo "Using MRPT_LIST_INCLUDE_DIRS: ${MRPT_LIST_INCLUDE_DIRS}"
# 1) Build Doxygen
cd source && doxygen
# 2) Doxygen XML -> RST
cd source && bash -c "source ../venv/bin/activate && doxyrest -c doxyrest-config.lua"
# Remove main doc file created for nanoflann:
rm source/page_index.rst 2>/dev/null || true
# 3) RST -> HTML with Sphinx
bash -c "source venv/bin/activate && sphinx-build -b html source/ html/"
# 4) Copy images:
# Doxygen has this limitation, images cannot be parsed into XML/HTML with
# a relative path, so we must copy them to the root directory.
cp source/images/* html/
# Copy remote images also:
bash remote-static-files.sh
pydocs-from-local-build:
cd html && bash ../../python/build-pydocs-from-local-build.sh