Update git submodules
[LibreOffice.git] / extras / CustomTarget_autocorr.mk
blobf97c8f1d2d719a4a07b2088e2e376a74dbdf55f1
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 $(eval $(call gb_CustomTarget_CustomTarget,extras/source/autocorr))
12 autocorr_PYTHONCOMMAND := $(call gb_ExternalExecutable_get_command,python)
14 extras_AUTOCORR_LANGS := \
15 af-ZA:af-ZA \
16 bg:bg-BG \
17 ca:ca-ES \
18 cs:cs-CZ \
19 da:da-DK \
20 de:de \
21 dsb:dsb \
22 el:el-GR \
23 en-AU:en-AU \
24 en-GB:en-GB \
25 en-US:en-US \
26 en-ZA:en-ZA \
27 es:es \
28 fa:fa-IR \
29 fi:fi-FI \
30 fr:fr \
31 ga-IE:ga-IE \
32 hr:hr-HR \
33 hsb:hsb \
34 hu:hu-HU \
35 is:is-IS \
36 it:it \
37 ja:ja-JP \
38 ko:ko-KR \
39 lb-LU:lb-LU \
40 lt:lt-LT \
41 mn:mn-MN \
42 nl:nl-NL \
43 nl-BE:nl-BE \
44 pl:pl-PL \
45 pt:pt-PT \
46 pt-BR:pt-BR \
47 ro:ro-RO \
48 ru:ru-RU \
49 sk:sk-SK \
50 sl:sl-SI \
51 sr-CS:sr-CS \
52 sr-Latn-CS:sr-Latn-CS \
53 sr-Latn-ME:sr-Latn-ME \
54 sr-Latn-RS:sr-Latn-RS \
55 sr-ME:sr-ME \
56 sr-RS:sr-RS \
57 sv:sv-SE \
58 tr:tr-TR \
59 vi:vi-VN \
60 vro:vro-EE \
61 zh-CN:zh-CN \
62 zh-TW:zh-TW \
64 extras_AUTOCORR_SHORTLANG = $(firstword $(subst :, ,$(filter %:$(1),$(extras_AUTOCORR_LANGS))))
66 extras_AUTOCORR_XMLFILES := \
67 af-ZA/DocumentList.xml \
68 af-ZA/META-INF/manifest.xml \
69 af-ZA/SentenceExceptList.xml \
70 af-ZA/WordExceptList.xml \
71 bg/DocumentList.xml \
72 bg/META-INF/manifest.xml \
73 bg/SentenceExceptList.xml \
74 bg/WordExceptList.xml \
75 ca/DocumentList.xml \
76 ca/META-INF/manifest.xml \
77 ca/SentenceExceptList.xml \
78 ca/WordExceptList.xml \
79 cs/DocumentList.xml \
80 cs/META-INF/manifest.xml \
81 da/DocumentList.xml \
82 da/META-INF/manifest.xml \
83 da/SentenceExceptList.xml \
84 da/WordExceptList.xml \
85 de/DocumentList.xml \
86 de/META-INF/manifest.xml \
87 de/SentenceExceptList.xml \
88 de/WordExceptList.xml \
89 dsb/DocumentList.xml \
90 dsb/META-INF/manifest.xml \
91 el/DocumentList.xml \
92 el/META-INF/manifest.xml \
93 el/SentenceExceptList.xml \
94 el/WordExceptList.xml \
95 en-AU/DocumentList.xml \
96 en-AU/META-INF/manifest.xml \
97 en-AU/SentenceExceptList.xml \
98 en-AU/WordExceptList.xml \
99 en-GB/DocumentList.xml \
100 en-GB/META-INF/manifest.xml \
101 en-GB/SentenceExceptList.xml \
102 en-GB/WordExceptList.xml \
103 en-US/DocumentList.xml \
104 en-US/META-INF/manifest.xml \
105 en-US/SentenceExceptList.xml \
106 en-US/WordExceptList.xml \
107 en-ZA/DocumentList.xml \
108 en-ZA/META-INF/manifest.xml \
109 en-ZA/SentenceExceptList.xml \
110 en-ZA/WordExceptList.xml \
111 es/DocumentList.xml \
112 es/META-INF/manifest.xml \
113 es/SentenceExceptList.xml \
114 es/WordExceptList.xml \
115 fa/DocumentList.xml \
116 fa/META-INF/manifest.xml \
117 fi/DocumentList.xml \
118 fi/META-INF/manifest.xml \
119 fi/SentenceExceptList.xml \
120 fi/WordExceptList.xml \
121 fr/DocumentList.xml \
122 fr/META-INF/manifest.xml \
123 fr/SentenceExceptList.xml \
124 fr/WordExceptList.xml \
125 ga-IE/DocumentList.xml \
126 ga-IE/META-INF/manifest.xml \
127 ga-IE/SentenceExceptList.xml \
128 ga-IE/WordExceptList.xml \
129 hr/DocumentList.xml \
130 hr/META-INF/manifest.xml \
131 hr/SentenceExceptList.xml \
132 hr/WordExceptList.xml \
133 hsb/DocumentList.xml \
134 hsb/META-INF/manifest.xml \
135 hu/DocumentList.xml \
136 hu/META-INF/manifest.xml \
137 hu/SentenceExceptList.xml \
138 hu/WordExceptList.xml \
139 is/DocumentList.xml \
140 is/META-INF/manifest.xml \
141 is/SentenceExceptList.xml \
142 it/DocumentList.xml \
143 it/META-INF/manifest.xml \
144 it/SentenceExceptList.xml \
145 it/WordExceptList.xml \
146 ja/DocumentList.xml \
147 ja/META-INF/manifest.xml \
148 ja/SentenceExceptList.xml \
149 ko/DocumentList.xml \
150 ko/META-INF/manifest.xml \
151 ko/SentenceExceptList.xml \
152 lb-LU/DocumentList.xml \
153 lb-LU/META-INF/manifest.xml \
154 lt/DocumentList.xml \
155 lt/META-INF/manifest.xml \
156 lt/SentenceExceptList.xml \
157 lt/WordExceptList.xml \
158 mn/DocumentList.xml \
159 mn/META-INF/manifest.xml \
160 mn/SentenceExceptList.xml \
161 mn/WordExceptList.xml \
162 nl-BE/DocumentList.xml \
163 nl-BE/META-INF/manifest.xml \
164 nl-BE/SentenceExceptList.xml \
165 nl-BE/WordExceptList.xml \
166 nl/DocumentList.xml \
167 nl/META-INF/manifest.xml \
168 nl/SentenceExceptList.xml \
169 nl/WordExceptList.xml \
170 pl/DocumentList.xml \
171 pl/META-INF/manifest.xml \
172 pl/SentenceExceptList.xml \
173 pl/WordExceptList.xml \
174 pt-BR/DocumentList.xml \
175 pt-BR/META-INF/manifest.xml \
176 pt-BR/SentenceExceptList.xml \
177 pt-BR/WordExceptList.xml \
178 pt/DocumentList.xml \
179 pt/META-INF/manifest.xml \
180 pt/SentenceExceptList.xml \
181 pt/WordExceptList.xml \
182 ro/DocumentList.xml \
183 ro/META-INF/manifest.xml \
184 ro/SentenceExceptList.xml \
185 ro/WordExceptList.xml \
186 ru/DocumentList.xml \
187 ru/META-INF/manifest.xml \
188 ru/SentenceExceptList.xml \
189 ru/WordExceptList.xml \
190 sk/DocumentList.xml \
191 sk/META-INF/manifest.xml \
192 sk/SentenceExceptList.xml \
193 sk/WordExceptList.xml \
194 sl/DocumentList.xml \
195 sl/META-INF/manifest.xml \
196 sl/SentenceExceptList.xml \
197 sl/WordExceptList.xml \
198 sr-CS/DocumentList.xml \
199 sr-CS/META-INF/manifest.xml \
200 sr-CS/SentenceExceptList.xml \
201 sr-CS/WordExceptList.xml \
202 sr-Latn-CS/DocumentList.xml \
203 sr-Latn-CS/META-INF/manifest.xml \
204 sr-Latn-CS/SentenceExceptList.xml \
205 sr-Latn-CS/WordExceptList.xml \
206 sr-Latn-ME/DocumentList.xml \
207 sr-Latn-ME/META-INF/manifest.xml \
208 sr-Latn-ME/SentenceExceptList.xml \
209 sr-Latn-ME/WordExceptList.xml \
210 sr-Latn-RS/DocumentList.xml \
211 sr-Latn-RS/META-INF/manifest.xml \
212 sr-Latn-RS/SentenceExceptList.xml \
213 sr-Latn-RS/WordExceptList.xml \
214 sr-ME/DocumentList.xml \
215 sr-ME/META-INF/manifest.xml \
216 sr-ME/SentenceExceptList.xml \
217 sr-ME/WordExceptList.xml \
218 sr-RS/DocumentList.xml \
219 sr-RS/META-INF/manifest.xml \
220 sr-RS/SentenceExceptList.xml \
221 sr-RS/WordExceptList.xml \
222 sv/DocumentList.xml \
223 sv/META-INF/manifest.xml \
224 sv/SentenceExceptList.xml \
225 sv/WordExceptList.xml \
226 tr/DocumentList.xml \
227 tr/META-INF/manifest.xml \
228 tr/SentenceExceptList.xml \
229 tr/WordExceptList.xml \
230 vi/DocumentList.xml \
231 vi/META-INF/manifest.xml \
232 vi/WordExceptList.xml \
233 vro/DocumentList.xml \
234 vro/META-INF/manifest.xml \
235 zh-CN/DocumentList.xml \
236 zh-CN/META-INF/manifest.xml \
237 zh-CN/SentenceExceptList.xml \
238 zh-TW/DocumentList.xml \
239 zh-TW/META-INF/manifest.xml \
240 zh-TW/SentenceExceptList.xml \
242 # param: shortlang
243 extras_AUTOCORR_XMLFILES_LANG = $(subst $(1)/,,$(filter $(1)/%,$(extras_AUTOCORR_XMLFILES)))
245 $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%/mimetype : \
246 | $(dir $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%/mimetype).dir
247 $(call gb_Output_announce,autocorr/$*/mimetype,$(true),TCH,1)
248 $(call gb_Trace_StartRange,autocorr/$*/mimetype,TCH)
249 touch $@
250 $(call gb_Trace_EndRange,autocorr/$*/mimetype,TCH)
252 .SECONDEXPANSION:
253 # secondexpansion since the pattern not just covers a file, but also a directory portion with
254 # different number of elements (just the lang or lang/META-INF) and thus the directory dependency
255 # needs the stem of the actual target to work as intended
256 $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/%.xml : $(SRCDIR)/extras/source/autocorr/lang/%.xml \
257 | $(call gb_ExternalExecutable_get_dependencies,xsltproc) \
258 $$(dir $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/$$*.xml).dir
259 $(call gb_Output_announce,autocorr/$*.xml,$(true),XSL,1)
260 $(call gb_Trace_StartRange,autocorr/$*.xml,XSL)
261 $(call gb_ExternalExecutable_get_command,xsltproc) --nonet -o $@ $(SRCDIR)/extras/util/compact.xsl $<
262 $(call gb_Trace_EndRange,autocorr/$*.xml,XSL)
264 # secondexpansion necessary since the .dat are created with longlang form, while the other files
265 # are created in the shortlang directory, and thus % cannot be used verbatim, the second expansion
266 # allows the actual stem from the target to be used in the macro calls
267 # there's no reason for the different directories though, so a janitorial cleanup would be
268 # TODO: get rid of the shortform:longform language names when assembling the autocorr files
269 $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/acor_%.dat : \
270 $$(addprefix \
271 $(call gb_CustomTarget_get_workdir,extras/source/autocorr)/$$(call extras_AUTOCORR_SHORTLANG,$$*)/,\
272 mimetype \
273 $$(call extras_AUTOCORR_XMLFILES_LANG,$$(call extras_AUTOCORR_SHORTLANG,$$*))) \
274 | $(call gb_ExternalExecutable_get_dependencies,python)
275 $(call gb_Output_announce,autocorr/acor_$*.dat,$(true),ZIP,2)
276 $(call gb_Trace_StartRange,autocorr/acor_$*.dat,ZIP)
277 $(call gb_Helper_abbreviate_dirs,\
278 cd $(dir $<) && \
279 $(autocorr_PYTHONCOMMAND) $(SRCDIR)/bin/check-autocorr.py DocumentList.xml && \
280 zip -q0X --filesync --must-match $@ mimetype && \
281 zip -qrX --must-match $@ $(call extras_AUTOCORR_XMLFILES_LANG,$(call extras_AUTOCORR_SHORTLANG,$*)) \
283 $(call gb_Trace_EndRange,autocorr/acor_$*.dat,ZIP)
285 # vim: set noet sw=4 ts=4: