forked from MapServer/MapServer-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
293 lines (260 loc) · 9.98 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# Makefile for Sphinx documentation
#
# $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/$$lang;
#
# You can set these variables from the command line.
BUILDDIR = build
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER = a4
SHELL = /bin/bash
TRANSLATIONS_STATIC = it es zh_cn
TRANSLATIONS_I18N = de el fr id sq tr
LANGUAGES = en $(TRANSLATIONS_STATIC) $(TRANSLATIONS_I18N)
BUILD_LANGUAGES = $(TRANSLATIONS_I18N) $(TRANSLATIONS_STATIC)
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees/$$lang $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) -c . -A language=$$lang -D language=$$lang -A languages='$(LANGUAGES)'
ALLSPHINXOPTSI18N = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) -c . -a -A language=$$lang -D language=$$lang -A languages='$(LANGUAGES)'
# Only for Gettext
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) -c . -A language=en -D language=en -A languages='en'
.PHONY: help clean html web pickle htmlhelp latex changes linkcheck
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " init to preprocess translation directories"
@echo " compile_messages to compile po to mo files"
@echo " generate_po_from_tmpl to duplicate pot to po files for a language, e.g from translated\pot directory to translated\lang"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " all-pdf to make PDF file"
@echo " all-ps to make PS file"
@echo " changes to make an overview over all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " gettext to generate pot files from en rst files"
@echo " gettext_copy to duplicate pot files from gettext dir to translated\pot"
clean:
-rm -rf $(BUILDDIR)/* init compile_messages
clean-repo: clean
@set -e; for lang in $(TRANSLATIONS_STATIC) ;\
do \
for file in `find $$lang -type f -a -regex '.*\.*$$' -a -not -regex '.*\.$$' -a -not -regex '.*\.svn.*' -printf "%p\n" ; cd ..;`; \
do \
echo "Working on "$$file ; \
# is file in git? \
if [ ! -d "$$file" -a -n "`git status --porcelain $$file`" ]; then \
rm -f "$$file"; \
# is dir empty? \
ldir=`dirname "$$file" `; \
if [ ! -n "`ls -1 $$ldir`" ]; then \
echo "Removing empty dir "$$ldir; \
rm -rf "$$ldir"; \
fi \
fi \
done ; \
done
@echo "Clean-repo finished."
init: en/*
@set -e; for lang in $(TRANSLATIONS_STATIC) ;\
do \
for file in `cd en; find . -type f -name '*.txt' ; cd ..;`; \
do \
if [ ! -f $$lang/$$file ]; then \
mkdir -p `dirname "$$lang/$$file"`; \
(echo ".. meta::"; echo " :ROBOTS: NOINDEX") | cat - "en/$$file" > "$$lang/$$file"; \
fi \
done; \
for file in `cd en; find . -type f ; cd ..;`; \
do \
if [ ! -f $$lang/$$file ]; then \
mkdir -p `dirname "$$lang/$$file"`; \
cp -p "en/$$file" "$$lang/$$file"; \
fi \
done; \
done
@echo "Init finished. Other target can now be built.";\
touch init
compile_messages: init translated/*/*.po
@set -e; for lang in $(TRANSLATIONS_I18N) ;\
do \
echo "Compiling messages for $$lang..."; \
for f in `find ./translated/$$lang -type f -name \*.po`; \
do \
bn=`basename $$f .po`; \
echo "Compiling messages for $$f"; \
msgfmt $$f -o ./translated/$$lang/LC_MESSAGES/$$bn.mo; \
done; \
done
@echo "Messages compiled. Now you can build updated version for html and pdf.";\
touch compile_messages
generate_po_from_tmpl:
@for lang in $(TRANSLATIONS_I18N) ;\
do \
echo "Generate po files from pot files for $$lang..."; \
for f in `find ./translated/pot/ -name \*.pot -printf "%f\n"`; \
do \
echo "Copy pot files to po file for $$f"; \
cp ./translated/pot/$$f ./translated/$$lang/$${f%.*}.po; \
done; \
done
@echo "*.pot files copy to *.po files. Now you can start your translation.";\
update_po_from_pot:
@for lang in $(TRANSLATIONS_I18N) ;\
do \
echo "Update po files from pot files for $$lang..."; \
for f in `find ./translated/pot/ -name \*.pot -printf "%f\n"`; \
do \
echo "update po files from pot file for $$f"; \
msgmerge ./translated/$$lang/$${f%.*}.po ./translated/pot/$$f -U -N; \
done; \
done
@echo "*.po files updated from *.pot files.";\
html: compile_messages
@set -e; \
lang=en; \
mkdir -p $(BUILDDIR)/html $(BUILDDIR)/doctrees/$$lang; \
echo $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/html; \
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/html; \
for lang in $(BUILD_LANGUAGES); \
do \
mkdir -p $(BUILDDIR)/html/$$lang $(BUILDDIR)/doctrees/$$lang; \
if [[ "$(TRANSLATIONS_STATIC)" =~ "$$lang" ]]; then \
mkdir -p $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/html/$$lang; \
else \
if [[ "$(TRANSLATIONS_I18N)" =~ "$$lang" ]]; then \
$(SPHINXBUILD) -b html $(ALLSPHINXOPTSI18N) en build/html/$$lang; \
fi \
fi \
done
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html/<language>.";
gettext:
mkdir -p $(BUILDDIR)/gettext/en $(BUILDDIR)/doctrees/en; \
echo "$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) en $(BUILDDIR)/gettext/en";\
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) en $(BUILDDIR)/gettext/en;\
@echo "Build finished. The pot files pages are in $(BUILDDIR)/gettext/en.";\
gettext_copy:
cp $(BUILDDIR)/gettext/en/*.pot translated/pot/; \
@echo "Build finished. The pot files pages are in $(BUILDDIR)/gettext/en.";\
singlehtml: compile_messages
@set -e; for lang in en $(TRANSLATIONS_STATIC);\
do \
mkdir -p $(BUILDDIR)/singlehtml/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/singlehtml/$$lang;\
done
@set -e; for lang in $(TRANSLATIONI18N);\
do \
mkdir -p $(BUILDDIR)/singlehtml/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTSI18N) en $(BUILDDIR)/singlehtml/$$lang;\
done
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/singlehtml/<language>.";\
pickle: compile_messages
@set -e; for lang in en $(TRANSLATIONS_STATIC);\
do \
mkdir -p $(BUILDDIR)/pickle/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/pickle/$$lang;\
done
@set -e; for lang in $(TRANSLATIONI18N);\
do \
mkdir -p $(BUILDDIR)/pickle/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTSI18N) en $(BUILDDIR)/pickle/$$lang;\
done
@echo
@echo "Build finished; now you can process the pickle files."
web: pickle
json: compile_messages
@set -e; for lang in en $(TRANSLATIONS_STATIC);\
do \
mkdir -p $(BUILDDIR)/json/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/json/$$lang;\
done
@set -e; for lang in $(TRANSLATIONI18N);\
do \
mkdir -p $(BUILDDIR)/json/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b json $(ALLSPHINXOPTSI18N) en $(BUILDDIR)/json/$$lang;\
done
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp: compile_messages
@set -e; for lang in en $(TRANSLATIONS_STATIC);\
do \
mkdir -p $(BUILDDIR)/htmlhelp/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/htmlhelp/$$lang;\
done
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp/<language>."
latex: compile_messages
@set -e; \
mkdir -p $(BUILDDIR)/latex/en $(BUILDDIR)/doctrees/en; \
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) en $(BUILDDIR)/latex/en;
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex/<language>."
@echo "Run \`make all-pdf' or \`make all-ps'"
pdf: compile_messages
@set -e;\
$(SPHINXBUILD) -b pdf $(ALLSPHINXOPTS) en $(BUILDDIR)/pdf;\
for lang in $(TRANSLATIONS_STATIC);\
do \
mkdir -p $(BUILDDIR)/pdf/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b pdf $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/pdf/$$lang;\
done
@set -e; for lang in $(TRANSLATIONS_I18N);\
do \
mkdir -p $(BUILDDIR)/pdf/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b pdf $(ALLSPHINXOPTSI18N) en $(BUILDDIR)/pdf/$$lang;\
done
@echo
@echo "Build finished; the PDF files are in $(BUILDDIR)/pdf/<language>."\
@echo "Run \`make pdf' "
epub: compile_messages
@set -e; for lang in en;\
do \
mkdir -p $(BUILDDIR)/epub/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/epub/$$lang;\
done
@echo
@echo "Build finished; the epub files are in $(BUILDDIR)/epub/<language>."\
@echo "Run \`make epub' "
all-pdf: latex
@set -e; \
make -C $(BUILDDIR)/latex/en all-pdf ;
all-ps: latex
@set -e; for lang in $(LANGUAGES);\
do \
make -C $(BUILDDIR)/latex/$$lang all-ps ; \
if [ -d $(BUILDDIR)/html/$$lang ]; then \
mv -f $(BUILDDIR)/latex/$$lang/MapServer.pdf $(BUILDDIR)/html/$$lang ; \
fi \
done
changes:
@for lang in $(LANGUAGES);\
do \
mkdir -p $(BUILDDIR)/changes/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/changes/$$lang;\
done
@echo
@echo "The overview file is in $(BUILDDIR)/changes/<language>."
linkcheck:
@for lang in $(LANGUAGES);\
do \
mkdir -p $(BUILDDIR)/linkcheck/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/linkcheck/$$lang;\
done
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/<language>/output.txt."
labels:
@for lang in $(LANGUAGES);\
do \
mkdir -p $(BUILDDIR)/labels/$$lang $(BUILDDIR)/doctrees/$$lang; \
$(SPHINXBUILD) -b labels $(ALLSPHINXOPTS) $$lang $(BUILDDIR)/labels/$$lang;\
cp $(BUILDDIR)/labels/$$lang/labels.txt $$lang/include/labels.inc;\
done
@echo
@echo "Label generation complete; look for any errors in the above output " \
"or in $(BUILDDIR)/labels/<language>/labels.txt."
all: html all-pdf epub all-ps