forked from dfelinto/blender-manual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
143 lines (116 loc) · 4.16 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
SPHINXOPTS =
PAPER =
SPHINXBUILD = sphinx-build
BUILDDIR = build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d "$(BUILDDIR)/doctrees" $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) manual
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) manual
# full paths
CHAPTERS_FULL:=$(filter %/, $(wildcard manual/*/))
# names only
CHAPTERS:=$(notdir $(sort $(CHAPTERS_FULL:%/=%)))
# intersect make goals and possible chapters
QUICKY_CHAPTERS=$(filter $(MAKECMDGOALS),$(CHAPTERS))
# -----------------------
# for echoing output only
ifeq ($(QUICKY_CHAPTERS), )
CONTENTS_HTML="contents.html"
else
CONTENTS_HTML="contents_quicky.html"
endif
# os specific
ifeq ($(OS), Darwin)
# OSX
OPEN_CMD="open"
else
# Linux/FreeBSD
OPEN_CMD="xdg-open"
endif
# end output for echoing
# ----------------------
ifneq "$(findstring singlehtml, $(MAKECMDGOALS))" ""
.DEFAULT_GOAL := singlehtml
else ifneq "$(findstring pdf, $(MAKECMDGOALS))" ""
.DEFAULT_GOAL := pdf
else
.DEFAULT_GOAL := html
endif
$(CHAPTERS): $(.DEFAULT_GOAL)
html: FORCE
# './' (input), './html/' (output)
QUICKY_CHAPTERS=$(QUICKY_CHAPTERS) \
$(SPHINXBUILD) -b html $(SPHINXOPTS) ./manual "$(BUILDDIR)/html"
@echo "To view, run:"
@echo " "$(OPEN_CMD) $(shell pwd)"/$(BUILDDIR)/html/$(CONTENTS_HTML)"
singlehtml: FORCE
# './' (input), './html/' (output)
QUICKY_CHAPTERS=$(QUICKY_CHAPTERS) \
$(SPHINXBUILD) -b singlehtml $(SPHINXOPTS) ./manual "$(BUILDDIR)/singlehtml"
@echo "To view, run:"
@echo " "$(OPEN_CMD) $(shell pwd)"/$(BUILDDIR)/singlehtml/$(CONTENTS_HTML)"
pdf: FORCE
QUICKY_CHAPTERS=$(QUICKY_CHAPTERS) \
sphinx-build -b latex ./manual "$(BUILDDIR)/latex"
make -C "$(BUILDDIR)/latex" LATEXOPTS="-interaction nonstopmode"
@echo " "$(OPEN_CMD)" $(BUILDDIR)/latex/blender_manual.pdf"
readme: FORCE
rst2html readme.rst > readme.html
check_syntax: FORCE
- python3 tools/rst_check_syntax.py --long > rst_check_syntax.log
- @echo "Lines:" `cat rst_check.log | wc -l`
- gvim --nofork -c "cfile rst_check_syntax.log" -c "cope" -c "clast"
- rm rst_check_syntax.log
check_structure: FORCE
- python3 tools/rst_check_structure.py --image --locale
# - python3 tools/rst_check_structure.py --image > rst_check_structure.log
# - @echo "Lines:" `cat rst_check.log | wc -l`
# - gvim --nofork -c "cfile rst_check_structure.log" -c "cope" -c "clast"
# - rm rst_check_structure.log
clean: FORCE
rm -rf "$(BUILDDIR)/html" "$(BUILDDIR)/singlehtml" "$(BUILDDIR)/latex" "$(BUILDDIR)/locale"
update_po: FORCE
- ./tools/maintenance/update_po.sh
report_po_progress: FORCE
- python3 tools/report_translation_progress.py --quiet \
`find locale/ -maxdepth 1 -mindepth 1 -type d -not -iwholename '*.svn*' -printf 'locale/%f\n' | sort`
gettext: FORCE
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
# -----------------------------------------------------------------------------
# Help for build targets
help:
@echo ""
@echo "Documentation"
@echo "============="
@echo ""
@echo "Convenience targets provided for building docs"
@echo "- html - create HTML pages (default)"
@echo "- singlehtml - create a single (huge) HTML file"
@echo "- pdf - create a PDF with latex"
@echo " warning: this currently has some problems,"
@echo " though the PDF generates, there are various unresolved issues."
@echo "- readme - create 'readme.html'"
@echo " ... otherwise defaults to HTML"
@echo ""
@echo "Chapters - for quickly building a single chapter"
@echo ""
@$(foreach ch,$(CHAPTERS),echo "- "$(ch);)
@echo ""
@echo ""
@echo "Checking"
@echo "========"
@echo ""
@echo "- check_syntax Check the syntax of all .rst files."
@echo "- check_structure Check the structure of all .rst files."
@echo ""
@echo ""
@echo "Maintenance"
@echo "==========="
@echo ""
@echo "- update_po Update the PO translations files from the RST source."
@echo "- report_po_progress Report progress on each languages translations."
FORCE: