forked from OSGeo/OSGeoLive-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
261 lines (229 loc) · 8.77 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
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
TMP = /tmp/osgeolive_make
TRANSLATIONS = ca de el es id it fr ja ko pl ru zh
LANGUAGES = en $(TRANSLATIONS)
PDF_LANG = en
START_DIR = $(shell pwd)
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)
if [ -e licenses.csv ] ; then \
rm -f licenses.csv ; \
fi ; \
if [ -e index.rst ] ; then \
rm -f index.rst ; \
fi ; \
# remove symbolic linked files
rm -f `find ./*/ -type l -print`
link_to_en_docs:
# For quickstart, standards and overview docs which have not been
# translated, link to english doc
for LANG in $(TRANSLATIONS) ; do \
mkdir -p $$LANG/overview $$LANG/quickstart $$LANG/standards ; \
for DOC in en/overview/* en/quickstart/* en/standards/* ; do \
TRANSLATED_DOC=`echo $$DOC | sed -e"s/en/$$LANG/"` ; \
TARGET_EN=`echo $$DOC | sed -e"s#^#../../#"` ; \
if [ ! -f $$TRANSLATED_DOC ] ; then \
rm -f $$TRANSLATED_DOC ; \
ln -s $$TARGET_EN $$TRANSLATED_DOC ; \
fi ; \
done ; \
done
# link to english docs for the docs in head directory
for LANG in $(TRANSLATIONS) ; do \
for DOC in en/download.rst en/contact.rst en/index.rst en/sponsors.rst en/sponsors_osgeo.rst en/disclaimer.rst en/presentation.rst en/copyright.rst en/metrics.rst en/mac_installers.rst en/win_installers.rst ; do \
TRANSLATED_DOC=`echo $$DOC | sed -e"s/en/$$LANG/"` ; \
TARGET_EN=`echo $$DOC | sed -e"s#^#../#"` ; \
if [ ! -f $$TRANSLATED_DOC ] ; then \
rm -f $$TRANSLATED_DOC ; \
ln -s $$TARGET_EN $$TRANSLATED_DOC ; \
fi ; \
done ; \
done
sphinxbuild: link_to_en_docs licenses.csv
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
fix_header_links: sphinxbuild
# Correct relative links for the headers for the top level directory
for FILE in $(BUILDDIR)/html/*/*.html ; do \
for ITEM in \
contact.html \
index.html \
../index.html \
download.html \
metrics.html \
mac_installers.html \
win_installers.html \
sponsors.html \
presentation.html \
disclaimer.html \
copyright.html \
overview/overview.html \
standards/standards.html \
; do \
sed -e "s#\(\.\./\)\($$ITEM\)#\2#" $$FILE > $(TMP) ; mv $(TMP) $$FILE ; \
done; \
done
index2: sphinxbuild
# Create links from index.html files to:
# quickstart.html,
# overview.html,
# standards.html
for ITEM in quickstart overview standards ; do \
for LANG in $(LANGUAGES) ; do \
if [ -e $(BUILDDIR)/html/$$LANG/$$ITEM/$$ITEM.html ] ; then \
cd $(BUILDDIR)/html/$$LANG/$$ITEM ; \
ln -sf $$ITEM.html index.html ;\
cd $(START_DIR) ; \
fi; \
done; \
done
win_installer_links: sphinxbuild
# Create symbolic link to windows and mac installer directories,
# otherwise remove hyperlink to the directory in index.html
if [ -e /cdrom/WindowsInstallers ] ; then \
cd $(BUILDDIR)/html/ ;\
ln -s /cdrom/WindowsInstallers . ;\
ln -s /cdrom/MacInstallers . ;\
cd $(START_DIR) ;\
fi
banner_links: sphinxbuild
# Copy the banner to the _images directory
cp images/banner.png $(BUILDDIR)/html/_images/banner.png
# Correct relative links to banner in top pages
for FILE in $(BUILDDIR)/html/*/*.html ; do \
sed -e "s#../../_images/banner.png#../_images/banner.png#" $$FILE > $(TMP); \
mv $(TMP) $$FILE; \
done
css:
# Copy css file
cp osgeolive.css $(BUILDDIR)/html/
licenses.csv :
echo `pwd`
bin/extract_licenses.sh > licenses.csv
fix_index:
cp index.template index.rst
presentation:
for LANG in en $(TRANSLATIONS) ; do \
mkdir -p $(BUILDDIR)/html/$$LANG; \
if [ -d $$LANG/presentation ] ; then \
bin/make_presentation.sh $$LANG/presentation $(BUILDDIR)/html/$$LANG/presentation ; \
else \
rm -rf $(BUILDDIR)/html/$$LANG/presentation; \
ln -s ../en/presentation $(BUILDDIR)/html/$$LANG/presentation; \
fi; \
done; \
html: fix_index sphinxbuild fix_header_links banner_links win_installer_links css link_to_en_docs link_to_en_docs presentation
# Just build the English documentation, by moving translations into TMP dir
# Use this to quickly check new documentation
# Do "make revert" to copy translations back
small: css
mkdir -p $(TMP)
if [ -e ca ] ; then \
mv $(TRANSLATIONS) $(TMP) ; \
fi
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
# Move translation files back from TMP direct. Run after "make small"
revert:
mv $(TMP)/* .
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/OSGeo-Live.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/OSGeo-Live.qhc"
link_to_en_docs_pdf:
# For quickstart, standards and overview docs which have not been
# translated, link to english doc
for LANG in $(PDF_LANG) ; do \
for DOC in en/overview/* en/quickstart/* en/standards/* ; do \
TRANSLATED_DOC=`echo $$DOC | sed -e"s/en/$$LANG/"` ; \
TARGET_EN=`echo $$DOC | sed -e"s#^#../../#"` ; \
if [ ! -f $$TRANSLATED_DOC ] ; then \
rm -f $$TRANSLATED_DOC ; \
ln -s $$TARGET_EN $$TRANSLATED_DOC ; \
fi ; \
done ; \
done
# link to english docs for the docs in head directory
for LANG in $(PDF_LANG) ; do \
for DOC in en/download.rst en/contact.rst en/index.rst en/sponsors.rst en/sponsors_osgeo.rst en/disclaimer.rst en/presentation.rst en/copyright.rst en/metrics.rst en/mac_installers.rst en/win_installers.rst ; do \
TRANSLATED_DOC=`echo $$DOC | sed -e"s/en/$$LANG/"` ; \
TARGET_EN=`echo $$DOC | sed -e"s#^#../#"` ; \
if [ ! -f $$TRANSLATED_DOC ] ; then \
rm -f $$TRANSLATED_DOC ; \
ln -s $$TARGET_EN $$TRANSLATED_DOC ; \
fi ; \
done ; \
done
fix_index_pdf:
for LANG in $(PDF_LANG) ; do \
cat index_pdf.template | sed "s/LANG_PDF/$$LANG/#" > index.rst ; \
done
latex: fix_index_pdf licenses.csv link_to_en_docs_pdf
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
latexpdf: fix_index_pdf licenses.csv link_to_en_docs_pdf
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."