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 # This gbuild module handles building of localized help packs. The main
11 # entry point is class HelpTarget; the other classes should be
12 # considered private implementation details and not used directly from
13 # outside of this file.
15 # All defined objects must be named <help-module>/<lang>. If this naming
16 # scheme is not followed, bad things will happen!
18 # Overview of classes and dependencies
20 # class task depends on
21 # HelpTranslatePartTarget l10n of xhp files in one dir xhp file(s)
22 # HelpTranslateTarget l10n of xhp files HelpTranslatePartTarget
23 # HelpTreeTarget l10n of tree file tree file
24 # HelpLinkTarget linking help module HelpTranslateTarget
26 # HelpJarTarget creating jar of xhp files HelpLinkTarget
27 # HelpIndexTarget indexing help module HelpLinkTarget
28 # HelpTarget creating help pack HelpIndexTarget
32 # class HelpTranslatePartTarget
34 # Translates .xhp files in one directory.
36 gb_HelpTranslatePartTarget_DEPS
:= $(call gb_Executable_get_runtime_dependencies
,helpex
)
37 gb_HelpTranslatePartTarget_COMMAND
:= $(call gb_Executable_get_command
,helpex
)
39 define gb_HelpTranslatePartTarget__command
40 $(call gb_Output_announce
,$(2),$(true
),HPX
,1)
41 HELPFILES
=$(call var2file
,$(shell $(gb_MKTEMP
)),100,$(sort $(filter %.xhp
,$(3)))) && \
42 $(call gb_Helper_abbreviate_dirs
, \
43 $(if
$(filter-out qtz
,$(HELP_LANG
)), \
44 POFILES
=$(call var2file
,$(shell $(gb_MKTEMP
)),100,$(sort $(POFILES
))) && \
45 $(gb_HelpTranslatePartTarget_COMMAND
) \
49 -o
$(call gb_HelpTranslatePartTarget_get_workdir
,$(2)) && \
52 $(gb_HelpTranslatePartTarget_COMMAND
) \
56 -o
$(call gb_HelpTranslatePartTarget_get_workdir
,$(2)) \
64 $(dir $(call gb_HelpTranslatePartTarget_get_target
,%)).
dir :
65 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
67 $(call gb_HelpTranslatePartTarget_get_target
,%) : $(gb_HelpTranslatePartTarget_DEPS
)
68 $(call gb_HelpTranslatePartTarget__command
,$@
,$*,$^
)
70 .PHONY
: $(call gb_HelpTranslatePartTarget_get_clean_target
,%)
71 $(call gb_HelpTranslatePartTarget_get_clean_target
,%) :
72 $(call gb_Output_announce
,$*,$(false
),HPX
,1)
73 $(call gb_Helper_abbreviate_dirs
,\
75 $(call gb_HelpTranslatePartTarget_get_target
,$*) \
76 $(call gb_HelpTranslatePartTarget_get_workdir
,$*) \
79 # Translate a set of .xhp files from one directory.
81 # gb_HelpTranslatePartTarget_HelpTranslatePartTarget target lang dir
82 define gb_HelpTranslatePartTarget_HelpTranslatePartTarget
83 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) : HELP_LANG
:= $(2)
84 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) : POFILES
:= $(gb_POLOCATION
)/$(2)/$(3).po
86 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) : $(gb_Module_CURRENTMAKEFILE
)
87 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) : $(gb_POLOCATION
)/$(2)/$(3).po
88 $(gb_POLOCATION
)/$(2)/$(3).po
:
89 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpTranslatePartTarget_get_target
,$(1))).
dir
90 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) :|
$(call gb_HelpTranslatePartTarget_get_workdir
,$(1))/.
dir
94 define gb_HelpTranslatePartTarget_add_file
95 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) : $(2)
99 # class HelpTranslateTarget
101 # Translates a set of .xhp files.
103 gb_HelpTranslateTarget__get_lang
= $(lastword
$(subst /, ,$(1)))
105 gb_HelpTranslateTarget__get_partname
= $(call gb_HelpTranslateTarget__get_lang
,$(1))/$(patsubst %/,%,$(2))
106 gb_HelpTranslateTarget__get_part_workdir
= $(call gb_HelpTranslatePartTarget_get_workdir
,$(call gb_HelpTranslateTarget__get_partname
,$(1),$(2)))
108 gb_HelpTranslateTarget_get_translated_target
= $(call gb_HelpTranslatePartTarget_get_translated_target
,$(call gb_HelpTranslateTarget__get_partname
,$(1),$(dir $(2))),$(notdir $(2)))
109 gb_HelpTranslateTarget__get_any_translated_target
= $(abspath
$(call gb_HelpTranslatePartTarget_get_translated_target
,,$(1)))
110 gb_HelpTranslateTarget_get_workdir
= $(call gb_HelpTranslateTarget__get_part_workdir
,$(1),$(2))
112 $(dir $(call gb_HelpTranslateTarget_get_target
,%)).
dir :
113 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
115 $(dir $(call gb_HelpTranslateTarget_get_target
,%))%/.
dir :
116 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
118 $(call gb_HelpTranslateTarget_get_target
,%) :
119 $(call gb_Output_announce
,$*,$(true
),XHP
,2)
122 $(call gb_HelpTranslateTarget__get_any_translated_target
,%) :
125 .PHONY
: $(call gb_HelpTranslateTarget_get_clean_target
,%)
126 $(call gb_HelpTranslateTarget_get_clean_target
,%) :
127 $(call gb_Output_announce
,$*,$(false
),XHP
,2)
128 $(call gb_Helper_abbreviate_dirs
,\
129 rm -f
$(call gb_HelpTranslateTarget_get_target
,$*) \
132 # Localizes a set of .xhp files to one language.
134 # gb_HelpTranslateTarget_HelpTranslateTarget module
135 define gb_HelpTranslateTarget_HelpTranslateTarget
136 $(call gb_HelpTranslateTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpTranslateTarget_get_target
,$(1))).
dir
140 # gb_HelpTranslateTarget__make_part module part lang dir
141 define gb_HelpTranslateTarget__make_part
142 $(call gb_HelpTranslatePartTarget_HelpTranslatePartTarget
,$(2),$(3),$(patsubst %/,%,$(4)))
144 $(call gb_HelpTranslateTarget_get_target
,$(1)) : $(call gb_HelpTranslatePartTarget_get_target
,$(2))
145 $(call gb_HelpTranslateTarget_get_clean_target
,$(1)) : $(call gb_HelpTranslatePartTarget_get_clean_target
,$(2))
149 # gb_HelpTranslateTarget__add_file module dir file
150 define gb_HelpTranslateTarget__add_file
151 $(call gb_HelpTranslatePartTarget_add_file
,$(call gb_HelpTranslateTarget__get_partname
,$(1),$(2)),$(SRCDIR
)/$(3).xhp
)
152 $(call gb_HelpTranslateTarget_get_translated_target
,$(1),$(3)) : $(call gb_HelpTranslateTarget_get_target
,$(1))
156 # gb_HelpTranslateTarget__add_files_impl module lang dir(s) file(s)
157 define gb_HelpTranslateTarget__add_files_impl
158 $(foreach part
,$(3),$(call gb_HelpTranslateTarget__make_part
,$(1),$(call gb_HelpTranslateTarget__get_partname
,$(1),$(part
)),$(2),$(part
)))
159 $(foreach file
,$(4),$(call gb_HelpTranslateTarget__add_file
,$(1),$(dir $(file
)),$(file
)))
163 # gb_HelpTranslateTarget__add_files module file(s)
164 define gb_HelpTranslateTarget__add_files
165 $(call gb_HelpTranslateTarget__add_files_impl
,$(1),$(call gb_HelpTranslateTarget__get_lang
,$(1)),$(sort $(dir $(2))),$(2))
169 # gb_HelpTranslateTarget_add_file module file
170 define gb_HelpTranslateTarget_add_file
171 $(call gb_HelpTranslateTarget__add_files
,$(1),$(2))
175 # gb_HelpTranslateTarget_add_files module file(s)
176 define gb_HelpTranslateTarget_add_files
177 $(call gb_HelpTranslateTarget__add_files
,$(1),$(2))
183 # Translates a .tree file.
185 gb_HelpTreeTarget_DEPS
:= $(call gb_Executable_get_runtime_dependencies
,treex
)
186 gb_HelpTreeTarget_COMMAND
:= $(call gb_Executable_get_command
,treex
)
188 define gb_HelpTreeTarget__command
189 $(call gb_Output_announce
,$(2),$(true
),TRE
,1)
190 $(call gb_Helper_abbreviate_dirs
,\
191 $(if
$(filter-out qtz
,$(HELP_LANG
)), \
192 POFILES
=$(call var2file
,$(shell $(gb_MKTEMP
)),100,$(POFILES
)) && \
193 $(gb_HelpTreeTarget_COMMAND
) \
198 -r
$(HELP_TEXTDIR
) && \
201 $(gb_HelpTreeTarget_COMMAND
) \
212 $(dir $(call gb_HelpTreeTarget_get_target
,%)).
dir :
213 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
215 $(dir $(call gb_HelpTreeTarget_get_target
,%))%/.
dir :
216 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
218 $(call gb_HelpTreeTarget_get_target
,%) : $(gb_HelpTreeTarget_DEPS
)
219 $(if
$(HELP_TEXTDIR
),,$(call gb_Output_error
,HelpTreeTarget
: no help text
dir for .tree was set
))
220 $(if
$(HELP_TREE
),,$(call gb_Output_error
,HelpTreeTarget
: no .tree file to translate was set
))
221 $(call gb_HelpTreeTarget__command
,$@
,$*)
223 .PHONY
: $(call gb_HelpTreeTarget_get_clean_target
,%)
224 $(call gb_HelpTreeTarget_get_clean_target
,%) :
225 $(call gb_Output_announce
,$*,$(false
),TRE
,1)
226 $(call gb_Helper_abbreviate_dirs
,\
227 rm -f
$(call gb_HelpTreeTarget_get_target
,$*) \
230 # Translate a .tree file.
232 # gb_HelpTreeTarget_HelpTreeTarget target lang
233 define gb_HelpTreeTarget_HelpTreeTarget
234 $(call gb_HelpTreeTarget_get_target
,$(1)) : HELP_LANG
:= $(2)
235 $(call gb_HelpTreeTarget_get_target
,$(1)) : HELP_TEXTDIR
:=
236 $(call gb_HelpTreeTarget_get_target
,$(1)) : HELP_TREE
:=
237 $(call gb_HelpTreeTarget_get_target
,$(1)) : POFILES
:=
239 $(call gb_HelpTreeTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpTreeTarget_get_target
,$(1))).
dir
243 # gb_HelpTreeTarget__set_pofiles target pofiles
244 define gb_HelpTreeTarget__set_pofiles
245 $(call gb_HelpTreeTarget_get_target
,$(1)) : POFILES
:= $(2)
246 $(call gb_HelpTreeTarget_get_target
,$(1)) : $(2)
251 # gb_HelpTreeTarget_set_treefile target treefile
252 define gb_HelpTreeTarget_set_treefile
253 $(call gb_HelpTreeTarget__set_pofiles
,$(1),$(gb_POLOCATION
)/$(lastword
$(subst /, ,$(1)))/$(patsubst %/,%,$(dir $(2))).po
)
255 $(call gb_HelpTreeTarget_get_target
,$(1)) : HELP_TREE
:= $(SRCDIR
)/$(2).tree
256 $(call gb_HelpTreeTarget_get_target
,$(1)) : $(SRCDIR
)/$(2).tree
260 # gb_HelpTreeTarget_set_helptextdir target dir
261 define gb_HelpTreeTarget_set_helptextdir
262 $(call gb_HelpTreeTarget_get_target
,$(1)) : HELP_TEXTDIR
:= $(2)
266 # class HelpLinkTarget
268 # Links a help module.
270 gb_HelpLinkTarget_HELPLINKERDEPS
:= $(call gb_Executable_get_runtime_dependencies
,HelpLinker
)
271 gb_HelpLinkTarget_HELPLINKERCOMMAND
:= $(call gb_Executable_get_command
,HelpLinker
)
272 gb_HelpLinkTarget_COMPACTTARGET
:= $(OUTDIR
)/bin
/compact.xsl
273 gb_HelpLinkTarget_EMBEDTARGET
:= $(OUTDIR
)/bin
/embed.xsl
274 gb_HelpLinkTarget_IDXCAPTIONTARGET
:= $(OUTDIR
)/bin
/idxcaption.xsl
275 gb_HelpLinkTarget_IDXCONTENTTARGET
:= $(OUTDIR
)/bin
/idxcontent.xsl
276 gb_HelpLinkTarget_DEPS
:= \
277 $(gb_HelpLinkTarget_HELPLINKERDEPS
) \
278 $(gb_HelpLinkTarget_COMPACTTARGET
) \
279 $(gb_HelpLinkTarget_EMBEDTARGET
) \
280 $(gb_HelpLinkTarget_IDXCAPTIONTARGET
) \
281 $(gb_HelpLinkTarget_IDXCONTENTTARGET
)
283 # delete index files here too just to be on the safe side...
284 # the index files in the .idxl dir are ceated by HelpIndexer,
285 # the ones outside the dir by HelpLinker
286 define gb_HelpLinkTarget__command
287 $(call gb_Output_announce
,$(2),$(true
),HLK
,3)
288 $(if
$(HELP_INDEXED
),rm -rf
$(addprefix $(HELP_WORKDIR
)/,$(HELP_INDEXED
)) && \
)
289 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),100,\
291 -mod
$(HELP_MODULE
) \
292 $(if
$(HELP_INDEXED
),,-noindex
) \
294 -o
$(WORKDIR
)/dummy.zip \
295 -src
$(HELP_SRCDIR
) \
296 -zipdir
$(HELP_WORKDIR
) \
297 -compact
$(gb_HelpLinkTarget_COMPACTTARGET
) \
298 -idxcaption
$(gb_HelpLinkTarget_IDXCAPTIONTARGET
) \
299 -idxcontent
$(gb_HelpLinkTarget_IDXCONTENTTARGET
) \
300 -sty
$(gb_HelpLinkTarget_EMBEDTARGET
) \
301 $(if
$(HELP_CONFIGFILE
),-add
$(HELP_MODULE
).cfg
$(HELP_CONFIGFILE
)) \
302 $(if
$(HELP_TREE
),-add
$(HELP_MODULE
).tree
$(HELP_TREE
)) \
303 $(foreach file
,$(HELP_ADD_FILES
),-add
$(notdir $(file
)) $(file
)) \
304 $(foreach extra
,$(HELP_EXTRA_ADD_FILES
),-add
$(subst $(COMMA
), ,$(extra
))) \
306 $(if
$(HELP_LINKED_MODULES
),\
307 $(shell cat
$(foreach module
,$(HELP_LINKED_MODULES
),$(call gb_HelpTarget_get_filelist
,$(module
)))) \
310 $(gb_HelpLinkTarget_HELPLINKERCOMMAND
) @
$${RESPONSEFILE} && \
312 rm -f
$${RESPONSEFILE}
316 $(dir $(call gb_HelpLinkTarget_get_target
,%)).
dir :
317 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
319 $(dir $(call gb_HelpLinkTarget_get_target
,%))%/.
dir :
320 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
322 $(call gb_HelpLinkTarget_get_target
,%) : $(gb_HelpLinkTarget_DEPS
)
323 $(call gb_HelpLinkTarget__command
,$@
,$*)
325 .PHONY
: $(call gb_HelpLinkTarget_get_clean_target
,%)
326 $(call gb_HelpLinkTarget_get_clean_target
,%) :
327 $(call gb_Output_announce
,$*,$(false
),HLK
,3)
328 rm -f
$(call gb_HelpLinkTarget_get_target
,$*)
330 # Create a help linking target.
332 # depend on makefile to re-build when files are removed
334 # gb_HelpLinkTarget_HelpLinkTarget name module lang workdir
335 define gb_HelpLinkTarget_HelpLinkTarget
336 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_ADD_FILES
:=
337 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_CONFIGFILE
:=
338 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_EXTRA_ADD_FILES
:=
339 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_FILES
:=
340 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_INDEXED
:=
341 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_MODULE
:= $(2)
342 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_LANG
:= $(3)
343 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_LINKED_MODULES
:=
344 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_SRCDIR
:=
345 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_TREE
:=
346 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_WORKDIR
:= $(4)
348 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(gb_Module_CURRENTMAKEFILE
)
349 $(call gb_HelpLinkTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpLinkTarget_get_target
,$(1))).
dir
353 # gb_HelpLinkTarget_set_configfile target configfile
354 define gb_HelpLinkTarget_set_configfile
355 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_CONFIGFILE
:= $(2)
356 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(2)
360 # gb_HelpLinkTarget_set_sourcedir target source
361 define gb_HelpLinkTarget_set_sourcedir
362 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_SRCDIR
:= $(2)
366 # gb_HelpLinkTarget_set_treefile target treefile
367 define gb_HelpLinkTarget_set_treefile
368 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_TREE
:= $(2)
369 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(2)
373 # gb_HelpLinkTarget_set_indexed target indexfiles
374 define gb_HelpLinkTarget_set_indexed
375 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_INDEXED
:= $(2)
379 # gb_HelpLinkTarget_add_helpfile target helpfile
380 define gb_HelpLinkTarget_add_helpfile
381 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_FILES
+= $(2)
382 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(2)
386 # Add an arbitrary file to the help pack.
388 # The file will be added to the root directory of the pack.
390 # gb_HelpLinkTarget_add_file target file
391 define gb_HelpLinkTarget_add_file
392 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_ADD_FILES
+= $(2)
393 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(2)
397 # Add an arbitrary file to the help pack under a new name.
399 # The file will be added to the root directory of the pack.
401 # gb_HelpLinkTarget_add_renamed_file target filename file
402 define gb_HelpLinkTarget_add_renamed_file
403 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_EXTRA_ADD_FILES
+= $(strip $(2)),$(strip $(3))
404 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(3)
408 # Link with help files from another help module.
410 # gb_HelpLinkTarget_use_linked_module target help
411 define gb_HelpLinkTarget_use_linked_module
412 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_LINKED_MODULES
+= $(2)
416 # class HelpIndexTarget
418 # Creates a full-text search index for a help module.
420 gb_HelpIndexTarget_DEPS
:= $(call gb_Executable_get_runtime_dependencies
,HelpIndexer
)
421 gb_HelpIndexTarget_COMMAND
:= $(call gb_Executable_get_command
,HelpIndexer
)
423 # first delete the index stuff since when it is generated an existing _0.cfs
424 # will not be overwritten; instead a new _1.cfs etc. created until disk is full
425 define gb_HelpIndexTarget__command
426 $(call gb_Output_announce
,$*,$(true
),HIX
,3)
427 $(call gb_Helper_abbreviate_dirs
,\
429 rm -rf
$(HELP_WORKDIR
)/$(HELP_MODULE
).idxl \
430 && $(gb_HelpIndexTarget_COMMAND
) \
431 -dir $(HELP_WORKDIR
) \
433 -mod
$(HELP_MODULE
) \
436 ||
( rm -rf
$(HELP_MODULE
).
* ; false
)
440 $(dir $(call gb_HelpIndexTarget_get_target
,%)).
dir :
441 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
443 $(dir $(call gb_HelpIndexTarget_get_target
,%))%/.
dir :
444 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
446 $(call gb_HelpIndexTarget_get_target
,%) : $(gb_HelpIndexTarget_DEPS
)
447 $(call gb_HelpIndexTarget__command
,$@
,$*)
449 .PHONY
: $(call gb_HelpIndexTarget_get_clean_target
,%)
450 $(call gb_HelpIndexTarget_get_clean_target
,%) :
451 $(call gb_Output_announce
,$*,$(false
),HIX
,3)
452 rm -f
$(call gb_HelpIndexTarget_get_target
,$*)
454 # Create a help indexing target.
456 # gb_HelpIndexTarget_HelpIndexTarget target module lang workdir
457 define gb_HelpIndexTarget_HelpIndexTarget
458 $(call gb_HelpIndexTarget_get_target
,$(1)) : HELP_LANG
:= $(3)
459 $(call gb_HelpIndexTarget_get_target
,$(1)) : HELP_MODULE
:= $(2)
460 $(call gb_HelpIndexTarget_get_target
,$(1)) : HELP_WORKDIR
:= $(4)
462 $(call gb_HelpIndexTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpIndexTarget_get_target
,$(1))).
dir
466 # class HelpJarTarget
468 # Packs help files processed by HelpLinker into a jar in the workdir.
470 gb_HelpJarTarget_COMMAND
:= zip
472 define gb_HelpJarTarget__get_command
473 $(call gb_Output_announce
,$*,$(true
),HEJ
,3)
474 cd
$(HELP_WORKDIR
) && \
475 $(gb_HelpJarTarget_COMMAND
) -q
-0 -rX
--filesync
--must-match
$(HELP_MODULE
).jar text
/$(HELP_MODULE
) && \
479 $(dir $(call gb_HelpJarTarget_get_target
,%)).
dir :
480 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
482 $(dir $(call gb_HelpJarTarget_get_target
,%))%/.
dir :
483 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
485 $(call gb_HelpJarTarget_get_target
,%) :
486 $(call gb_HelpJarTarget__get_command
,$@
,$*)
488 $(call gb_HelpJarTarget_get_clean_target
,%) :
489 $(call gb_Output_announce
,$*,$(false
),HEJ
,3)
490 rm -f
$(call gb_HelpJarTarget_get_target
,$*)
492 # gb_HelpJarTarget_HelpJarTarget target module workdir
493 define gb_HelpJarTarget_HelpJarTarget
494 $(call gb_HelpJarTarget_get_target
,$(1)) : HELP_MODULE
:= $(2)
495 $(call gb_HelpJarTarget_get_target
,$(1)) : HELP_WORKDIR
:= $(3)
497 $(call gb_HelpJarTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpJarTarget_get_target
,$(1))).
dir
503 # Creates one language version of a help module.
505 # Provides a filelist called HelpTarget/<name>, that is not built by
506 # default (i.e., the user of HelpTarget has to explicitly depend on the
509 gb_HelpTarget_DEFAULT_LANG
:= en-US
511 gb_HelpTarget__get_module
= $(patsubst %/$(call gb_HelpTarget__get_lang
,$(1)),%,$(1))
512 gb_HelpTarget__get_lang
= $(lastword
$(subst /, ,$(1)))
513 gb_HelpTarget__test_default_lang
= $(filter $(gb_HelpTarget_DEFAULT_LANG
),$(1))
514 gb_HelpTarget__is_default_lang
= $(call gb_HelpTarget__test_default_lang
,$(call gb_HelpTarget__get_lang
,$(1)))
516 define gb_HelpTarget__get_helpdir
517 $(if
$(call gb_HelpTarget__is_default_lang
,$(1)) \
519 ,$(call gb_HelpTranslateTarget_get_workdir
,$(1),$(2)) \
523 define gb_HelpTarget__get_helpfile
524 $(if
$(call gb_HelpTarget__is_default_lang
,$(1)) \
525 ,$(SRCDIR
)/$(2).xhp \
526 ,$(call gb_HelpTranslateTarget_get_translated_target
,$(1),$(2)) \
530 define gb_HelpTarget__get_treefile
531 $(if
$(call gb_HelpTarget__is_default_lang
,$(1)) \
532 ,$(SRCDIR
)/$(2).tree \
533 ,$(call gb_HelpTreeTarget_get_target
,$(1)) \
537 define gb_HelpTarget__command
538 $(call gb_Output_announce
,$(2),$(true
),HLP
,4)
542 $(dir $(call gb_HelpTarget_get_target
,%)).
dir :
543 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
545 $(dir $(call gb_HelpTarget_get_target
,%))%/.
dir :
546 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
548 # Translation of the module's .xhp files and all used modules is done.
549 # Also creates the list for gb_HelpTarget_get_filelist.
550 $(call gb_HelpTarget_get_translation_target
,%) :
551 rm -f
$@
&& mv
$(call var2file
,$@.tmp
,100,$(HELP_FILES
)) $@
553 # Translation of the module's .xhp files and all used and linked modules
555 $(call gb_HelpTarget_get_linked_target
,%) :
558 $(call gb_HelpTarget_get_target
,%) :
559 $(call gb_HelpTarget__command
,$@
,$*)
561 .PHONY
: $(call gb_HelpTarget_get_clean_target
,%)
562 $(call gb_HelpTarget_get_clean_target
,%) :
563 $(call gb_Output_announce
,$*,$(false
),HLP
,4)
564 $(call gb_Helper_abbreviate_dirs
,\
566 $(call gb_HelpTarget_get_linked_target
,$*) \
567 $(call gb_HelpTarget_get_target
,$*) \
568 $(call gb_HelpTarget_get_translation_target
,$*) \
569 $(call gb_HelpTarget_get_workdir
,$*) \
572 gb_HelpTarget_get_packagename
= HelpTarget
/$(1)
574 # Create a help target.
576 # depend on makefile to re-build filelist when files are removed
578 # gb_HelpTarget_HelpTarget target module lang
579 define gb_HelpTarget_HelpTarget
580 $(call gb_HelpTarget_get_target
,$(1)) : HELP_MODULE
:= $(2)
581 $(call gb_HelpTarget_get_target
,$(1)) : HELP_LANG
:= $(3)
583 $(call gb_HelpTarget_get_translation_target
,$(1)) : HELP_FILES
:=
584 $(call gb_HelpTarget_get_translation_target
,$(1)) : $(gb_Module_CURRENTMAKEFILE
)
586 $(call gb_HelpTarget__HelpTarget_impl
,$(1),$(2),$(3),$(call gb_HelpTarget_get_workdir
,$(1)),$(call gb_HelpTarget_get_packagename
,$(1)))
590 # gb_HelpTarget__HelpTarget_impl target module lang workdir package
591 define gb_HelpTarget__HelpTarget_impl
592 $(if
$(call gb_HelpTarget__test_default_lang
,$(3)),,$(call gb_HelpTarget__HelpTarget_impl_lang
,$(1),$(2),$(3),$(4)))
593 $(call gb_HelpLinkTarget_HelpLinkTarget
,$(1),$(2),$(3),$(4))
594 $(call gb_HelpIndexTarget_HelpIndexTarget
,$(1),$(2),$(3),$(4))
595 $(call gb_HelpJarTarget_HelpJarTarget
,$(1),$(2),$(4))
596 $(call gb_Package_Package_internal
,$(5),$(4))
597 $(call gb_Package_set_outdir
,$(5),$(INSTDIR
))
599 $(call gb_HelpTarget_get_linked_target
,$(1)) : $(call gb_HelpTarget_get_translation_target
,$(1))
600 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(call gb_HelpTarget_get_linked_target
,$(1))
601 $(call gb_HelpLinkTarget_get_target
,$(1)) :|
$(call gb_HelpTarget_get_workdir
,$(1))/.
dir
602 $(call gb_HelpTarget_get_target
,$(1)) : $(call gb_HelpLinkTarget_get_target
,$(1))
603 $(call gb_Package_get_preparation_target
,$(5)) : $(call gb_HelpTarget_get_target
,$(1))
605 $(call gb_HelpTarget_get_linked_target
,$(1)) :|
$(dir $(call gb_HelpTarget_get_linked_target
,$(1))).
dir
606 $(call gb_HelpTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpTarget_get_target
,$(1))).
dir
607 $(call gb_HelpTarget_get_translation_target
,$(1)) :|
$(dir $(call gb_HelpTarget_get_translation_target
,$(1))).
dir
609 $(call gb_HelpTarget_get_clean_target
,$(1)) : $(call gb_HelpLinkTarget_get_clean_target
,$(1))
613 # gb_HelpTarget__HelpTarget_impl_lang target module lang workdir
614 define gb_HelpTarget__HelpTarget_impl_lang
615 $(call gb_HelpTranslateTarget_HelpTranslateTarget
,$(1),$(3))
616 $(call gb_HelpTreeTarget_HelpTreeTarget
,$(1),$(3))
618 $(call gb_HelpTarget_get_translation_target
,$(1)) : $(call gb_HelpTranslateTarget_get_target
,$(1))
619 $(call gb_HelpTreeTarget_get_target
,$(1)) : $(call gb_HelpTarget_get_linked_target
,$(1))
621 $(call gb_HelpTarget_get_clean_target
,$(1)) : $(call gb_HelpTranslateTarget_get_clean_target
,$(1))
622 $(call gb_HelpTarget_get_clean_target
,$(1)) : $(call gb_HelpTreeTarget_get_clean_target
,$(1))
626 # Get list of the various index files.
628 # gb_HelpTarget__add_index_files target module
629 define gb_HelpTarget__get_index_files
630 $(foreach suffix,.db .ht .idxl
/_0.cfs .idxl
/segments_3 .idxl
/segments.gen .key
,$(addsuffix $(suffix),$(call gb_HelpTarget__get_module
,$(1))))
633 # gb_HelpTarget__add_file target file
634 define gb_HelpTarget__add_file
635 $(call gb_Package_add_file
,$(call gb_HelpTarget_get_packagename
,$(1)),help
/$(call gb_HelpTarget__get_lang
,$(1))/$(2),$(2))
639 # Set config. file used for the help module.
641 # The configfile is relative to $(SRCDIR) and without extension.
643 # gb_HelpTarget_set_configfile target configfile
644 define gb_HelpTarget_set_configfile
645 $(call gb_HelpLinkTarget_set_configfile
,$(1),$(SRCDIR
)/$(2).cfg
)
646 $(call gb_HelpTarget__add_file
,$(1),$(call gb_HelpTarget__get_module
,$(1)).cfg
)
650 # gb_HelpTarget_set_helpdir target helpdir
651 define gb_HelpTarget_set_helpdir
652 $(call gb_HelpLinkTarget_set_sourcedir
,$(1),$(call gb_HelpTarget__get_helpdir
,$(1),$(2)))
656 # gb_HelpTarget_set_treefile target treefile textdir
657 define gb_HelpTarget_set_treefile
658 $(if
$(call gb_HelpTarget__is_default_lang
,$(1)),,\
659 $(call gb_HelpTreeTarget_set_treefile
,$(1),$(2)) \
660 $(call gb_HelpTreeTarget_set_helptextdir
,$(1),$(call gb_HelpTarget__get_helpdir
,$(1),$(3))) \
662 $(call gb_HelpLinkTarget_set_treefile
,$(1),$(call gb_HelpTarget__get_treefile
,$(1),$(2)))
663 $(call gb_HelpTarget__add_file
,$(1),$(call gb_HelpTarget__get_module
,$(1)).tree
)
667 # Produce full text search index, bookmark list, etc.
669 # gb_HelpTarget_set_indexed target
670 define gb_HelpTarget_set_indexed
671 $(call gb_HelpLinkTarget_set_indexed
,$(1),$(call gb_HelpTarget__get_index_files
,$(1)))
672 $(foreach file
,$(call gb_HelpTarget__get_index_files
,$(1)),$(call gb_HelpTarget__add_file
,$(1),$(file
)))
674 $(call gb_HelpIndexTarget_get_target
,$(1)) : $(call gb_HelpLinkTarget_get_target
,$(1))
675 $(call gb_HelpTarget_get_target
,$(1)) : $(call gb_HelpIndexTarget_get_target
,$(1))
676 $(call gb_HelpTarget_get_clean_target
,$(1)) : $(call gb_HelpIndexTarget_get_clean_target
,$(1))
680 # gb_HelpTarget__add_jar target
681 define gb_HelpTarget__add_jar
682 $(call gb_HelpTarget__add_file
,$(1),$(call gb_HelpTarget__get_module
,$(1)).jar
)
683 $(call gb_HelpJarTarget_get_target
,$(1)) : $(call gb_HelpLinkTarget_get_target
,$(1))
684 $(call gb_HelpTarget_get_target
,$(1)) : $(call gb_HelpJarTarget_get_target
,$(1))
685 $(call gb_HelpTarget_get_clean_target
,$(1)) : $(call gb_HelpJarTarget_get_clean_target
,$(1))
689 define gb_HelpTarget__add_helpfile_impl
690 $(call gb_HelpLinkTarget_add_helpfile
,$(1),$(2))
692 $(call gb_HelpTarget_get_translation_target
,$(1)) : HELP_FILES
+= $(2)
696 # gb_HelpTarget__add_helpfile target helpfile
697 define gb_HelpTarget__add_helpfile
698 $(call gb_HelpTarget__add_helpfile_impl
,$(1),$(call gb_HelpTarget__get_helpfile
,$(1),$(2)))
702 # gb_HelpTarget_add_helpfile target helpfile
703 define gb_HelpTarget_add_helpfile
704 $(call gb_HelpTranslateTarget_add_file
,$(1),$(2))
705 $(call gb_HelpTarget__add_helpfile
,$(1),$(2))
706 $(call gb_HelpTarget__add_jar
,$(1))
710 # gb_HelpTarget_add_helpfiles target helpfile(s)
711 define gb_HelpTarget_add_helpfiles
712 $(call gb_HelpTranslateTarget_add_files
,$(1),$(2))
713 $(foreach helpfile
,$(2),$(call gb_HelpTarget__add_helpfile
,$(1),$(helpfile
)))
714 $(call gb_HelpTarget__add_jar
,$(1))
718 # gb_HelpTarget_add_file target file
719 define gb_HelpTarget_add_file
720 $(call gb_HelpLinkTarget_add_file
,$(1),$(SRCDIR
)/$(2))
721 $(call gb_HelpTarget__add_file
,$(1),$(notdir $(2)))
725 # gb_HelpTarget_add_files target file(s)
726 define gb_HelpTarget_add_files
727 $(foreach file
,$(2),$(call gb_HelpTarget_add_file
,$(1),$(file
)))
731 # Add a localized file from helpdir under a new name.
733 # This is a hack needed for err.html in shared help module.
735 # gb_HelpTarget_add_helpdir_file target filename file
736 define gb_HelpTarget_add_helpdir_file
737 $(call gb_HelpLinkTarget_add_renamed_file
,$(1),$(2),$(call gb_HelpTarget__get_helpfile
,$(1),$(3)))
738 $(call gb_HelpTarget__add_file
,$(1),$(2))
742 # gb_HelpTarget_use_module target module
743 define gb_HelpTarget_use_module
744 $(call gb_HelpTarget_get_translation_target
,$(1)) : $(call gb_HelpTarget_get_translation_target
,$(2))
748 # gb_HelpTarget_use_modules target module(s)
749 define gb_HelpTarget_use_modules
750 $(foreach module
,$(2),$(call gb_HelpTarget_use_module
,$(1),$(module
)))
754 # gb_HelpTarget_use_linked_module target module
755 define gb_HelpTarget_use_linked_module
756 $(call gb_HelpLinkTarget_use_linked_module
,$(1),$(2))
757 $(call gb_HelpTarget_get_linked_target
,$(1)) : $(call gb_HelpTarget_get_translation_target
,$(2))
761 # gb_HelpTarget_use_linked_modules target module(s)
762 define gb_HelpTarget_use_linked_modules
763 $(foreach module
,$(2),$(call gb_HelpTarget_use_linked_module
,$(1),$(module
)))
767 # vim: set noet sw=4 ts=4: