summaryrefslogtreecommitdiff
path: root/solenv/gbuild/Configuration.mk
blob: 068bbd54ee54c506a06fd5a559eae05b3cc98f1d (plain)
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
#   Licensed to the Apache Software Foundation (ASF) under one or more
#   contributor license agreements. See the NOTICE file distributed
#   with this work for additional information regarding copyright
#   ownership. The ASF licenses this file to you under the Apache
#   License, Version 2.0 (the "License"); you may not use this file
#   except in compliance with the License. You may obtain a copy of
#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
#

# Configuration files: a bit of an overview of the targets:
#
# Configuration
# => XcsTarget: schemas
# 	 => buildtools
#	 => Xcs source
# => XcuDataTarget: data
# 	 => buildtools
#    => XcsTarget (schema)
#	 => Xcu data source
# => XcuModuleTaret: modules
# 	 => buildtools
#	 => Xcu data source
# => XcuLangpackTarget: langpack (per lang)
# 	 => buildtools
#	 => Xcu data source
# => zip (per lang)
#	 => XcuResTarget: resources (per lang)
# 	    => buildtools
#	    => XcuMergeTarget: merge
#          => buildtools (cfgex)
#	       => Xcu data source
#          => *.po
#       => XcsTarget (schema)

# Per-repo pattern rules for each repository do not work for all targets
# because the prerequisites of some targets need to have the stem mangled
# and this does not seem to be possible in GNU make because when the stem is
# matched variables have already been expanded (this was possible in dmake).
#
# So to keep things consistent the Configuration takes a parameter for the
# repository and all targets use that to find the source file.
#
# Targets where % rule per repo works: XcsTarget XcuDataTarget XcuMergeTarget
# fails: XcuModuleTarget XcuLangpackTarget XcuResTarget
#
gb_Configuration__get_source = $(SRCDIR)/$(2)

# The main LibreOffice registry (cf. officecfg/Configuration_officecfg.mk):
gb_Configuration_PRIMARY_REGISTRY_NAME := registry
gb_Configuration_PRIMARY_REGISTRY_SCHEMA_ROOT = \
    $(SRCDIR)/officecfg/registry/schema

gb_Configuration__stringparam_schemaRoot = --stringparam schemaRoot \
    $(if $(PRIMARY_REGISTRY), \
        $(gb_Configuration_PRIMARY_REGISTRY_SCHEMA_ROOT), \
        $(call gb_XcsTarget_get_outdir_target,))

gb_Configuration_XSLTCOMMAND = $(call gb_ExternalExecutable_get_command,xsltproc)
gb_Configuration_XSLTCOMMAND_DEPS = $(call gb_ExternalExecutable_get_dependencies,xsltproc)

# XcsTarget class

# need to locate a schema file corresponding to some XCU file in the outdir
define gb_XcsTarget_for_XcuTarget
$(call gb_XcsTarget_get_outdir_target,$(basename $(1)).xcs)
endef

gb_Configuration_LANGS := en-US $(filter-out en-US,$(gb_WITH_LANG))

gb_XcsTarget_XSLT_SchemaVal := $(OUTDIR)/xml/processing/schema_val.xsl
gb_XcsTarget_XSLT_Sanity := $(OUTDIR)/xml/processing/sanity.xsl
gb_XcsTarget_XSLT_SchemaTrim := $(OUTDIR)/xml/processing/schema_trim.xsl
gb_XcsTarget_DTD_Schema := $(OUTDIR)/xml/registry/component-schema.dtd

define gb_XcsTarget__command
$(call gb_Output_announce,$(2),$(true),XCS,1)
$(call gb_Helper_abbreviate_dirs,\
	mkdir -p $(dir $(1)) && \
	$(gb_Configuration_XSLTCOMMAND) --nonet \
		--noout \
		--stringparam componentName $(subst /,.,$(basename $(XCSFILE))) \
		--stringparam root $(subst $(XCSFILE),,$(3)) \
		$(gb_Configuration__stringparam_schemaRoot) \
		$(gb_XcsTarget_XSLT_SchemaVal) \
		$(3) && \
	$(gb_Configuration_XSLTCOMMAND) --nonet \
		--noout \
		$(gb_XcsTarget_XSLT_Sanity) \
		$(3) && \
	$(gb_Configuration_XSLTCOMMAND) --nonet \
		-o $(1) \
		$(gb_XcsTarget_XSLT_SchemaTrim) \
		$(3))
endef

$(call gb_XcsTarget_get_target,%) : \
	    $(gb_XcsTarget_XSLT_SchemaVal) $(gb_XcsTarget_XSLT_Sanity) \
		$(gb_XcsTarget_XSLT_SchemaTrim) $(gb_XcsTarget_DTD_Schema) \
		| $(gb_Configuration_XSLTCOMMAND_DEPS)
	$(call gb_XcsTarget__command,$@,$*,$(filter %.xcs,$^))

$(call gb_XcsTarget_get_clean_target,%) :
	$(call gb_Output_announce,$*,$(false),XCS,1)
	$(call gb_Helper_abbreviate_dirs,\
		rm -f $(call gb_XcsTarget_get_target,$*) \
			  $(call gb_XcsTarget_get_outdir_target,$(XCSFILE)))

# the .dir is for make 3.81, which ignores trailing /
$(dir $(call gb_XcsTarget_get_outdir_target,%))%/.dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
$(dir $(call gb_XcsTarget_get_outdir_target,%)).dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))

$(call gb_XcsTarget_get_outdir_target,%) :
	$(call gb_Helper_abbreviate_dirs,\
		$(call gb_Deliver_deliver,$<,$@))


# XcuDataTarget class

gb_XcuTarget_XSLT_AllLang := $(OUTDIR)/xml/processing/alllang.xsl
gb_XcuDataTarget_XSLT_DataVal := $(OUTDIR)/xml/processing/data_val.xsl
gb_XcuDataTarget_DTD_ComponentUpdate := $(OUTDIR)/xml/registry/component-update.dtd

define gb_XcuDataTarget__command
$(call gb_Output_announce,$(2),$(true),XCU,2)
$(call gb_Helper_abbreviate_dirs,\
	mkdir -p $(dir $(1)) && \
	$(gb_Configuration_XSLTCOMMAND) --nonet \
		--noout \
		--stringparam xcs $(call gb_XcsTarget_for_XcuTarget,$(XCUFILE)) \
		$(gb_Configuration__stringparam_schemaRoot) \
		--path $(gb_Configuration_registry) \
		$(gb_XcuDataTarget_XSLT_DataVal) \
		$(3) && \
	$(gb_Configuration_XSLTCOMMAND) --nonet \
		-o $(1) \
		--stringparam xcs $(call gb_XcsTarget_for_XcuTarget,$(XCUFILE)) \
		$(gb_Configuration__stringparam_schemaRoot) \
		--path $(gb_Configuration_registry) \
		$(gb_XcuTarget_XSLT_AllLang) \
		$(3))
endef

$(call gb_XcuDataTarget_get_target,%) : $(gb_XcuDataTarget_XSLT_DataVal) \
		$(gb_XcuTarget_XSLT_AllLang) $(gb_XcuDataTarget_DTD_ComponentUpdate) \
		| $(gb_Configuration_XSLTCOMMAND_DEPS)
	$(call gb_XcuDataTarget__command,$@,$*,$(filter %.xcu,$^))

$(call gb_XcuDataTarget_get_clean_target,%) :
	$(call gb_Output_announce,$*,$(false),XCU,2)
	$(call gb_Helper_abbreviate_dirs,\
		rm -f $(call gb_XcuDataTarget_get_target,$*) \
			  $(call gb_XcuDataTarget_get_outdir_target,$(XCUFILE)))

# the .dir is for make 3.81, which ignores trailing /
$(dir $(call gb_XcuDataTarget_get_outdir_target,))%/.dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
$(dir $(call gb_XcuDataTarget_get_outdir_target,)).dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))

$(call gb_XcuDataTarget_get_outdir_target,%) :
	$(call gb_Helper_abbreviate_dirs,\
		$(call gb_Deliver_deliver,$<,$@))


# XcuModuleTarget class

define gb_XcuDataSource_for_XcuModuleTarget
$(call gb_Configuration__get_source,$(1),$(basename $(subst -,.,$(basename $(2)))).xcu)
endef

define gb_XcsTarget_for_XcuModuleTarget
$(call gb_XcsTarget_get_outdir_target,$(basename $(subst -,.,$(basename $(1)))).xcs)
endef

define gb_XcuModuleTarget__command
$(call gb_Output_announce,$(2),$(true),XCU,3)
$(call gb_Helper_abbreviate_dirs,\
	mkdir -p $(dir $(1)) && \
	$(gb_Configuration_XSLTCOMMAND) --nonet \
		-o $(1) \
		--stringparam xcs $(4) \
		$(gb_Configuration__stringparam_schemaRoot) \
		--stringparam module $(notdir $(subst -,/,$(basename $(notdir $(2))))) \
		$(gb_XcuTarget_XSLT_AllLang) \
		$(3))
endef

$(call gb_XcuModuleTarget_get_target,%) : $(gb_XcuTarget_XSLT_AllLang) \
		| $(gb_Configuration_XSLTCOMMAND_DEPS)
	$(call gb_XcuModuleTarget__command,$@,$*,$(filter %.xcu,$^),$(filter %.xcs,$^))

$(call gb_XcuModuleTarget_get_clean_target,%) :
	$(call gb_Output_announce,$*,$(false),XCU,3)
	$(call gb_Helper_abbreviate_dirs,\
		rm -f $(call gb_XcuModuleTarget_get_target,$*) \
			  $(call gb_XcuModuleTarget_get_outdir_target,$(XCUFILE)))

# the .dir is for make 3.81, which ignores trailing /
$(dir $(call gb_XcuModuleTarget_get_outdir_target,))%/.dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))

$(call gb_XcuModuleTarget_get_outdir_target,%) :
	$(call gb_Helper_abbreviate_dirs,\
		$(call gb_Deliver_deliver,$<,$@))


# XcuLangpackTarget class

gb_XcuLangpackTarget__get_name_with_lang = $(basename $(1))-$(2)$(suffix $(1))

gb_XcuLangpackTarget__get_outdir_target_with_lang = \
 $(call gb_XcuLangpackTarget_get_outdir_target,$(call gb_XcuLangpackTarget__get_name_with_lang,$(1),$(2)))
gb_XcuLangpackTarget__get_target_with_lang = \
 $(call gb_XcuLangpackTarget_get_target,$(call gb_XcuLangpackTarget__get_name_with_lang,$(1),$(2)))

gb_XcuLangpackTarget_SED_delcomment := $(OUTDIR)/xml/processing/delcomment.sed

define gb_XcuLangpackTarget__command
$(call gb_Output_announce,$(2),$(true),XCU,4)
$(call gb_Helper_abbreviate_dirs,\
	mkdir -p $(dir $(1)) && \
	sed -e "s/__LANGUAGE__/$(LANG)/" -f $(gb_XcuLangpackTarget_SED_delcomment)\
	    $(3) > $(1))
endef

$(call gb_XcuLangpackTarget_get_target,%) : \
		$(gb_XcuLangpackTarget_SED_delcomment)
	$(call gb_XcuLangpackTarget__command,$@,$*,$(filter %.tmpl,$^))

$(call gb_XcuLangpackTarget_get_clean_target,%) :
	$(call gb_Output_announce,$*,$(false),XCU,4)
	$(call gb_Helper_abbreviate_dirs,\
		rm -f $(foreach lang,$(gb_Configuration_LANGS),\
			  $(call gb_XcuLangpackTarget__get_target_with_lang,$*,$(lang)) \
			  $(call gb_XcuLangpackTarget__get_outdir_target_with_lang,$(XCUFILE),$(lang))))

# the .dir is for make 3.81, which ignores trailing /
$(dir $(call gb_XcuLangpackTarget_get_outdir_target,))%/.dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
$(dir $(call gb_XcuLangpackTarget_get_outdir_target,)).dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))

$(call gb_XcuLangpackTarget_get_outdir_target,%) :
	$(call gb_Helper_abbreviate_dirs,\
		$(call gb_Deliver_deliver,$<,$@))


# XcuMergeTarget class

gb_XcuMergeTarget_CFGEXDEPS := $(call gb_Executable_get_runtime_dependencies,cfgex)
gb_XcuMergeTarget_CFGEXCOMMAND := $(call gb_Executable_get_command,cfgex)

# PRJNAME is computed from the stem (parameter $(2))
define gb_XcuMergeTarget__command
$(call gb_Output_announce,$(2),$(true),XCU,5)
MERGEINPUT=`$(gb_MKTEMP)` && \
echo $(POFILES) > $${MERGEINPUT} && \
$(call gb_Helper_abbreviate_dirs,\
	mkdir -p $(dir $(1)) && \
	$(gb_XcuMergeTarget_CFGEXCOMMAND) \
		-p $(firstword $(subst /, ,$(2))) \
		-i $(3) \
		-o $(1) \
		-m $${MERGEINPUT} \
		-l all) && \
rm -rf $${MERGEINPUT}

endef

$(call gb_XcuMergeTarget_get_target,%) : $(gb_XcuMergeTarget_CFGEXDEPS)
	$(if $(filter $(words $(POFILES)),$(words $(wildcard $(POFILES)))),\
		$(call gb_XcuMergeTarget__command,$@,$*,$(filter %.xcu,$^)),\
		mkdir -p $(dir $@) && cp $(filter %.xcu,$^) $@)

$(call gb_XcuMergeTarget_get_clean_target,%) :
	$(call gb_Output_announce,$*,$(false),XCU,5)
	$(call gb_Helper_abbreviate_dirs,\
		rm -f $(call gb_XcuMergeTarget_get_target,$*))

# $(call gb_XcuMergeTarget_XcuMergeTarget,target,zipfile,prefix,xcufile)
define gb_XcuMergeTarget_XcuMergeTarget
$(call gb_XcuMergeTarget_get_target,$(1)) : \
	$(call gb_Configuration__get_source,$(2),$(3)/$(4)) \
	$(wildcard $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(1))).po))
$(call gb_XcuMergeTarget_get_target,$(1)) : \
	POFILES := $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(1))).po)
$(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(patsubst %/,%,$(dir $(1))).po) :
endef


# XcuResTarget class

# locale is extracted from the stem (parameter $(2))
define gb_XcuResTarget__command
$(call gb_Output_announce,$(2),$(true),XCU,6)
$(call gb_Helper_abbreviate_dirs,\
	mkdir -p $(dir $(1)) && \
	$(gb_Configuration_XSLTCOMMAND) --nonet \
		-o $(1) \
		--stringparam xcs $(call gb_XcsTarget_for_XcuTarget,$(XCUFILE)) \
		$(gb_Configuration__stringparam_schemaRoot) \
		--stringparam locale $(word 2,$(subst /, ,$(2))) \
		--path $(gb_Configuration_registry) \
		$(gb_XcuTarget_XSLT_AllLang) \
		$(3))
endef

$(call gb_XcuResTarget_get_target,%) : $(gb_XcuTarget_XSLT_AllLang) \
		| $(gb_Configuration_XSLTCOMMAND_DEPS)
	$(call gb_XcuResTarget__command,$@,$*,$(filter %.xcu,$^))

$(call gb_XcuResTarget_get_clean_target,%) :
	$(call gb_Output_announce,$*,$(false),XCU,6)
	$(call gb_Helper_abbreviate_dirs,\
		rm -f $(call gb_XcuResTarget_get_target,$*))

# $(call gb_XcuResTarget_XcuResTarget,target,zipfile,prefix,xcufile,lang)
# this depends either on the source or on the merge target (if WITH_LANG)
define gb_XcuResTarget_XcuResTarget
ifeq ($(strip $(gb_WITH_LANG)),)
$(call gb_XcuResTarget_get_target,$(1)) : \
	$(call gb_Configuration__get_source,$(2),$(3)/$(4))
else
$(call gb_XcuResTarget_get_target,$(1)) : \
	$(call gb_XcuMergeTarget_get_target,$(3)/$(4))
endif
$(call gb_XcuResTarget_get_target,$(1)) : \
	$(call gb_XcsTarget_for_XcuTarget,$(4))
$(call gb_XcuResTarget_get_target,$(1)) : PRIMARY_REGISTRY := $(filter $(2),$(gb_Configuration_PRIMARY_REGISTRY_NAME))
$(call gb_XcuResTarget_get_target,$(1)) : XCUFILE := $(4)
endef


# Configuration class

$(call gb_Configuration_get_clean_target,%) :
	$(call gb_Output_announce,$*,$(false),CFG,1)
	$(call gb_Helper_abbreviate_dirs,\
		rm -f $(call gb_Configuration_get_target,$*) $(call gb_Configuration_get_preparation_target,$*))

$(call gb_Configuration_get_target,%) :
	$(call gb_Output_announce,$*,$(true),CFG,1)
	$(call gb_Helper_abbreviate_dirs,\
		mkdir -p $(dir $@) && touch $@)

$(call gb_Configuration_get_preparation_target,%) :
	$(call gb_Helper_abbreviate_dirs,\
		mkdir -p $(dir $@) && touch $@)

# TODO: ?
define gb_Configuration_Configuration_nozip
$$(eval $$(call gb_Module_register_target,$(call gb_Configuration_get_target,$(1)),$(call gb_Configuration_get_clean_target,$(1))))
$(call gb_Helper_make_userfriendly_targets,$(1),Configuration)
endef

# $(call gb_Configuration_Configuration,zipfile,repo,nodeliver)
# cannot use target local variable for REPO because it's needed in prereq
# last parameter may be used to turn off delivering of files
define gb_Configuration_Configuration
$(eval gb_Configuration_NODELIVER_$(1) := $(2))
$(foreach lang,$(gb_Configuration_LANGS),$(eval \
	$(call gb_Zip_Zip_internal,$(1)_$(lang),$(call gb_XcuResTarget_get_target,$(1)/$(lang)))))
$(foreach lang,$(gb_Configuration_LANGS),$(eval \
	$(call gb_Configuration_get_target,$(1)) : \
	 $(call gb_Zip_get_final_target,$(1)_$(lang))))
$(foreach lang,$(gb_Configuration_LANGS),$(eval \
	$(call gb_Configuration_get_clean_target,$(1)) : \
	 $(call gb_Zip_get_clean_target,$(1)_$(lang))))

$$(eval $$(call gb_Module_register_target,$(call gb_Configuration_get_target,$(1)),$(call gb_Configuration_get_clean_target,$(1))))
$(call gb_Helper_make_userfriendly_targets,$(1),Configuration)

endef

# $(call gb_Configuration_add_schema,zipfile,prefix,xcsfile)
# FIXME this is always delivered because commands depend on it...
# hopefully extensions do not need to add schemas with same name as officecfg
define gb_Configuration_add_schema
$(call gb_Configuration_get_clean_target,$(1)) : \
	$(call gb_XcsTarget_get_clean_target,$(2)/$(3))
$(call gb_XcsTarget_get_target,$(2)/$(3)) : \
	$(call gb_Configuration__get_source,$(1),$(2)/$(3)) \
	$(call gb_Configuration_get_preparation_target,$(1))
$(call gb_XcsTarget_get_target,$(2)/$(3)) : PRIMARY_REGISTRY := $(filter $(1),$(gb_Configuration_PRIMARY_REGISTRY_NAME))
$(call gb_XcsTarget_get_target,$(2)/$(3)) : XCSFILE := $(3)
$(call gb_XcsTarget_get_clean_target,$(2)/$(3)) : XCSFILE := $(3)
$(call gb_Configuration_get_target,$(1)) : \
	$(call gb_XcsTarget_get_outdir_target,$(3))
$(call gb_XcsTarget_get_outdir_target,$(3)) : \
	$(call gb_XcsTarget_get_target,$(2)/$(3)) \
	| $(dir $(call gb_XcsTarget_get_outdir_target,$(3))).dir
$(call gb_Deliver_add_deliverable,$(call gb_XcsTarget_get_outdir_target,$(3)),\
	$(call gb_XcsTarget_get_target,$(2)/$(3)),$(2)/$(3))

endef

#$(call gb_Configuration_add_schemas,zipfile,prefix,xcsfiles)
define gb_Configuration_add_schemas
$(foreach xcs,$(3),$(call gb_Configuration_add_schema,$(1),$(2),$(xcs)))

endef

# $(call gb_Configuration_add_data,zipfile,prefix,xcufile)
define gb_Configuration_add_data
$(call gb_Configuration_get_clean_target,$(1)) : \
	$(call gb_XcuDataTarget_get_clean_target,$(2)/$(3))
$(call gb_XcuDataTarget_get_target,$(2)/$(3)) : \
	$(call gb_Configuration__get_source,$(1),$(2)/$(3)) \
	$(call gb_Configuration_get_preparation_target,$(1)) \
	$(call gb_XcsTarget_for_XcuTarget,$(3))
$(call gb_XcuDataTarget_get_target,$(2)/$(3)) : PRIMARY_REGISTRY := $(filter $(1),$(gb_Configuration_PRIMARY_REGISTRY_NAME))
$(call gb_XcuDataTarget_get_target,$(2)/$(3)) : XCUFILE := $(3)
$(call gb_XcuDataTarget_get_clean_target,$(2)/$(3)) : XCUFILE := $(3)
ifeq ($(strip $(gb_Configuration_NODELIVER_$(1))),)
$(call gb_Configuration_get_target,$(1)) : \
	$(call gb_XcuDataTarget_get_outdir_target,$(3))
$(call gb_XcuDataTarget_get_outdir_target,$(3)) : \
	$(call gb_XcuDataTarget_get_target,$(2)/$(3)) \
	| $(dir $(call gb_XcuDataTarget_get_outdir_target,$(3))).dir
$(call gb_Deliver_add_deliverable,\
	$(call gb_XcuDataTarget_get_outdir_target,$(3)),\
	$(call gb_XcuDataTarget_get_target,$(2)/$(3)),\
	$(2)/$(3))
else
$(call gb_Configuration_get_target,$(1)) : \
	$(call gb_XcuDataTarget_get_target,$(2)/$(3))
endif

endef

#$(call gb_Configuration_add_datas,zipfile,prefix,xcufiles)
define gb_Configuration_add_datas
$(foreach xcu,$(3),$(call gb_Configuration_add_data,$(1),$(2),$(xcu)))

endef

# $(call gb_Configuration_add_spool_module,zipfile,prefix,xcufile)
define gb_Configuration_add_spool_module
$(call gb_Configuration_get_clean_target,$(1)) : \
	$(call gb_XcuModuleTarget_get_clean_target,$(2)/$(3))
$(call gb_XcuModuleTarget_get_target,$(2)/$(3)) : \
	$(call gb_XcuDataSource_for_XcuModuleTarget,$(1),$(2)/$(3)) \
	$(call gb_Configuration_get_preparation_target,$(1)) \
	$(call gb_XcsTarget_for_XcuModuleTarget,$(3))
$(call gb_XcuModuleTarget_get_target,$(2)/$(3)) : PRIMARY_REGISTRY := $(filter $(1),$(gb_Configuration_PRIMARY_REGISTRY_NAME))
$(call gb_XcuModuleTarget_get_clean_target,$(2)/$(3)) : XCUFILE := $(3)
ifeq ($(strip $(gb_Configuration_NODELIVER_$(1))),)
$(call gb_Configuration_get_target,$(1)) : \
	$(call gb_XcuModuleTarget_get_outdir_target,$(3))
$(call gb_XcuModuleTarget_get_outdir_target,$(3)) : \
	$(call gb_XcuModuleTarget_get_target,$(2)/$(3)) \
	| $(dir $(call gb_XcuModuleTarget_get_outdir_target,$(3))).dir
$(call gb_Deliver_add_deliverable,\
	$(call gb_XcuModuleTarget_get_outdir_target,$(3)),\
	$(call gb_XcuModuleTarget_get_target,$(2)/$(3)),\
	$(2)/$(3))
else
$(call gb_Configuration_get_target,$(1)) : \
	$(call gb_XcuModuleTarget_get_target,$(2)/$(3))
endif

endef

# $(call gb_Configuration_add_spool_modules,zipfile,prefix,xcufiles)
define gb_Configuration_add_spool_modules
$(foreach xcu,$(3),$(call gb_Configuration_add_spool_module,$(1),$(2),$(xcu)))

endef

define gb_Configuration__add_langpack
$(if $(gb_Configuration_NODELIVER_$(1)),\
	$(error TODO not needed yet: cannot add langpack if nodeliver))
$(call gb_Configuration_get_clean_target,$(1)) : \
	$(call gb_XcuLangpackTarget_get_clean_target,$(2)/$(3))
$(call gb_Configuration_get_target,$(1)) : \
	$(call gb_XcuLangpackTarget__get_outdir_target_with_lang,$(3),$(4))
$(call gb_XcuLangpackTarget__get_target_with_lang,$(2)/$(3),$(4)) : \
	$(SRCDIR)/$(2)/$(3).tmpl
$(call gb_XcuLangpackTarget_get_clean_target,$(2)/$(3)) : XCUFILE := $(3)
$(call gb_XcuLangpackTarget__get_target_with_lang,$(2)/$(3),$(4)) : LANG := $(4)
$(call gb_XcuLangpackTarget__get_outdir_target_with_lang,$(3),$(4)) : \
	$(call gb_XcuLangpackTarget__get_target_with_lang,$(2)/$(3),$(4)) \
	| $(dir $(call gb_XcuLangpackTarget__get_outdir_target_with_lang,$(3),$(4))).dir
$(call gb_Deliver_add_deliverable,\
	$(call gb_XcuLangpackTarget__get_outdir_target_with_lang,$(3),$(4)),\
	$(call gb_XcuLangpackTarget__get_target_with_lang,$(2)/$(3),$(4)),\
	$(call gb_XcuLangpackTarget__get_name_with_lang,$(2)/$(3),$(4)))

endef

# $(call gb_Configuration_add_spool_langpack,zipfile,prefix,xcufile)
define gb_Configuration_add_spool_langpack
$(foreach lang,$(gb_Configuration_LANGS),$(eval \
	$(call gb_Configuration__add_langpack,$(1),$(2),$(strip $(3)),$(lang))))

endef

# $(call gb_Configuration_add_localized_data,zipfile,prefix,xcufile)
define gb_Configuration_add_localized_data
$(eval $(call gb_Configuration_add_data,$(1),$(2),$(3)))
ifneq ($(strip $(gb_WITH_LANG)),)
$(eval $(call gb_XcuMergeTarget_XcuMergeTarget,$(2)/$(3),$(1),$(2),$(3)))
$(eval $(call gb_Configuration_get_clean_target,$(1)) : \
	$(call gb_XcuMergeTarget_get_clean_target,$(2)/$(3)))
endif
$(foreach lang,$(gb_Configuration_LANGS),$(eval \
 $(call gb_XcuResTarget_XcuResTarget,$(1)/$(lang)/$(3),$(1),$(2),$(3),$(lang))))
$(foreach lang,$(gb_Configuration_LANGS),$(eval \
    $(call gb_Zip_add_file,$(1)_$(lang),$(3))))
$(foreach lang,$(gb_Configuration_LANGS),$(eval \
  $(call gb_Configuration_get_clean_target,$(1)) : \
	$(call gb_XcuResTarget_get_clean_target,$(1)/$(lang)/$(3))))

endef

# $(call gb_Configuration_add_localized_datas,zipfile,prefix,xcufile)
define gb_Configuration_add_localized_datas
$(foreach xcu,$(3),$(call gb_Configuration_add_localized_data,$(1),$(2),$(xcu)))

endef

# Set extra registry this configuration can use schemas from.
#
# Example:
# # foo needs schemas from the main configuration
# $(eval $(call gb_Configuration_use_configuration,foo,registry))
define gb_Configuration_use_configuration
$(call gb_Configuration_get_preparation_target,$(1)) : $(call gb_Configuration_get_target,$(2))

endef

# apparently extensions package the XcuMergeTarget directly...
# trivial convenience function to get the right file:
ifeq ($(gb_WITH_LANG),)
gb_XcuFile_for_extension = $(call gb_Configuration__get_source,,$(1))
else
gb_XcuFile_for_extension = $(call gb_XcuMergeTarget_get_target,$(1))
endif

# vim: set noet sw=4 ts=4: