-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (51 loc) · 1.8 KB
/
Makefile
File metadata and controls
64 lines (51 loc) · 1.8 KB
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
# Make file to generate documentation
SOURCE = source
OUT = build
LINKCHECKDIR = $(OUT)/linkcheck
PYTHON := python3
ifeq ($(OS),Windows_NT)
PYTHON := python
endif
BUILD = $(PYTHON) -m sphinx
OPTS =-c . -W # Treat warnings as errors
DICTIONARIES := codespell_dictionary.txt codespell_whitelist.txt
help:
@$(BUILD) -M help "$(SOURCE)" "$(OUT)" $(OPTS)
@echo " multiversion to build documentation for all branches"
multiversion: Makefile
sphinx-multiversion $(OPTS) "$(SOURCE)" build/html
@echo "<html><head><meta http-equiv=\"refresh\" content=\"0; url=jazzy/index.html\" /></head></html>" > build/html/index.html
$(PYTHON) make_sitemapindex.py
%: Makefile
@$(BUILD) -M $@ "$(SOURCE)" "$(OUT)" $(OPTS)
lint:
./sphinx-lint-with-ros source
test:
doc8 --ignore D001 --ignore-path build
test-tools:
$(PYTHON) -m pytest test/
spellcheck:
git ls-files '*.md' '*.rst' | xargs codespell --config codespell.cfg
check-dictionaries:
@echo "Checking dictionaries..."
@for dict in $(DICTIONARIES); do \
echo "Checking $$dict..."; \
if grep -E -n "^\s*$$|\s$$|^\s" $$dict; then \
echo "Dictionary $$dict contains empty lines or leading/trailing spaces, triming..."; \
sed -E -i.bak -e 's/^[[:space:]]+//; s/[[:space:]]+$$//; /^$$/d' $$dict && rm $$dict.bak; \
fi; \
done
sort-dictionaries:
@echo "Sorting dictionaries..."
@for dict in $(DICTIONARIES); do \
echo "Sorting $$dict..."; \
if ! LC_ALL=C sort -f -b -c $$dict; then \
echo "Dictionary $$dict is not sorted, sorting..."; \
LC_ALL=C sort -f -b -o $$dict $$dict; \
fi; \
done
linkcheck:
$(BUILD) -b linkcheck $(OPTS) $(SOURCE) $(LINKCHECKDIR)
@echo
@echo "Check finished. Report is in $(LINKCHECKDIR)."
.PHONY: help Makefile multiversion test test-unit linkcheck lint spellcheck check-dictionaries sort-dictionaries