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 HELPFILES
=$(call gb_var2file
,$(shell $(gb_MKTEMP
)),$(sort $(filter %.xhp
,$(3)))) && \
41 $(call gb_Helper_abbreviate_dirs
, \
42 $(if
$(filter-out qtz
,$(HELP_LANG
)), \
43 POFILES
=$(call gb_var2file
,$(shell $(gb_MKTEMP
)),$(sort $(POFILES
))) && \
44 $(gb_HelpTranslatePartTarget_COMMAND
) \
48 -o
$(call gb_HelpTranslatePartTarget_get_workdir
,$(2)) && \
51 $(gb_HelpTranslatePartTarget_COMMAND
) \
55 -o
$(call gb_HelpTranslatePartTarget_get_workdir
,$(2)) \
63 $(dir $(call gb_HelpTranslatePartTarget_get_target
,%)).
dir :
64 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
66 $(call gb_HelpTranslatePartTarget_get_target
,%) : $(gb_HelpTranslatePartTarget_DEPS
)
67 $(call gb_Output_announce
,$*,$(true
),HPX
,1)
68 $(call gb_Trace_StartRange
,$*,HPX
)
69 $(call gb_HelpTranslatePartTarget__command
,$@
,$*,$^
)
70 $(call gb_Trace_EndRange
,$*,HPX
)
72 clear_HelpTranslatePartTarget
:
73 $(call gb_Output_announce
,clear HelpTranslatePartTarget
,$(false
),HPX
,1)
74 rm -rf
$(call gb_HelpTranslatePartTarget_get_workdir
)
76 # Translate a set of .xhp files from one directory.
78 # gb_HelpTranslatePartTarget_HelpTranslatePartTarget target lang dir
79 define gb_HelpTranslatePartTarget_HelpTranslatePartTarget
80 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) : HELP_LANG
:= $(2)
81 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) : POFILES
:= $(3)
83 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) : $(gb_Module_CURRENTMAKEFILE
)
84 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) : $(3)
85 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpTranslatePartTarget_get_target
,$(1))).
dir
86 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) :|
$(call gb_HelpTranslatePartTarget_get_workdir
,$(1))/.
dir
90 define gb_HelpTranslatePartTarget_add_file
91 $(call gb_HelpTranslatePartTarget_get_target
,$(1)) : $(2)
95 # class HelpTranslateTarget
97 # Translates a set of .xhp files.
99 gb_HelpTranslateTarget__get_lang
= $(lastword
$(subst /, ,$(1)))
101 gb_HelpTranslateTarget__get_partname
= $(call gb_HelpTranslateTarget__get_lang
,$(1))/$(patsubst %/,%,$(2))
102 gb_HelpTranslateTarget__get_part_workdir
= $(call gb_HelpTranslatePartTarget_get_workdir
,$(call gb_HelpTranslateTarget__get_partname
,$(1),$(2)))
104 gb_HelpTranslateTarget_get_translated_target
= $(call gb_HelpTranslatePartTarget_get_translated_target
,$(call gb_HelpTranslateTarget__get_partname
,$(1),$(dir $(2))),$(notdir $(2)))
105 gb_HelpTranslateTarget__get_any_translated_target
= $(abspath
$(call gb_HelpTranslatePartTarget_get_translated_target
,,$(1)))
106 gb_HelpTranslateTarget_get_workdir
= $(call gb_HelpTranslateTarget__get_part_workdir
,$(1),$(2))
108 $(dir $(call gb_HelpTranslateTarget_get_target
,%)).
dir :
109 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
111 $(dir $(call gb_HelpTranslateTarget_get_target
,%))%/.
dir :
112 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
114 $(call gb_HelpTranslateTarget_get_target
,%) :
115 $(call gb_Output_announce
,$*,$(true
),XHP
,2)
116 $(call gb_Trace_MakeMark
,$*,XHP
)
119 $(call gb_HelpTranslateTarget__get_any_translated_target
,%) :
122 .PHONY
: $(call gb_HelpTranslateTarget_get_clean_target
,%)
123 $(call gb_HelpTranslateTarget_get_clean_target
,%) :
124 $(call gb_Output_announce
,$*,$(false
),XHP
,2)
125 $(call gb_Helper_abbreviate_dirs
,\
126 rm -f
$(call gb_HelpTranslateTarget_get_target
,$*) \
129 # Localizes a set of .xhp files to one language.
131 # gb_HelpTranslateTarget_HelpTranslateTarget module
132 define gb_HelpTranslateTarget_HelpTranslateTarget
133 $(call gb_HelpTranslateTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpTranslateTarget_get_target
,$(1))).
dir
137 # use wildcard to avoid spurious rebuilds if translation is missing
138 # gb_HelpTranslateTarget__make_part module part lang dir
139 define gb_HelpTranslateTarget__make_part
140 $(call gb_HelpTranslatePartTarget_HelpTranslatePartTarget
,$(2),$(3),$(wildcard $(gb_POLOCATION
)/$(3)/$(patsubst %/,%,$(4)).po
))
142 $(call gb_HelpTranslateTarget_get_target
,$(1)) : $(call gb_HelpTranslatePartTarget_get_target
,$(2))
143 $(call gb_HelpTranslateTarget_get_clean_target
,$(1)) : clear_HelpTranslatePartTarget
147 # gb_HelpTranslateTarget__add_file module dir file
148 define gb_HelpTranslateTarget__add_file
149 $(call gb_HelpTranslatePartTarget_add_file
,$(call gb_HelpTranslateTarget__get_partname
,$(1),$(2)),$(SRCDIR
)/$(3).xhp
)
150 $(call gb_HelpTranslateTarget_get_translated_target
,$(1),$(3)) : $(call gb_HelpTranslateTarget_get_target
,$(1))
154 # gb_HelpTranslateTarget__add_files_impl module lang dir(s) file(s)
155 define gb_HelpTranslateTarget__add_files_impl
156 $(foreach part
,$(3),$(call gb_HelpTranslateTarget__make_part
,$(1),$(call gb_HelpTranslateTarget__get_partname
,$(1),$(part
)),$(2),$(part
)))
157 $(foreach file
,$(4),$(call gb_HelpTranslateTarget__add_file
,$(1),$(dir $(file
)),$(file
)))
161 # gb_HelpTranslateTarget__add_files module file(s)
162 define gb_HelpTranslateTarget__add_files
163 $(call gb_HelpTranslateTarget__add_files_impl
,$(1),$(call gb_HelpTranslateTarget__get_lang
,$(1)),$(sort $(dir $(2))),$(2))
167 # gb_HelpTranslateTarget_add_file module file
168 define gb_HelpTranslateTarget_add_file
169 $(call gb_HelpTranslateTarget__add_files
,$(1),$(2))
173 # gb_HelpTranslateTarget_add_files module file(s)
174 define gb_HelpTranslateTarget_add_files
175 $(call gb_HelpTranslateTarget__add_files
,$(1),$(2))
181 # Translates a .tree file.
183 gb_HelpTreeTarget_DEPS
:= $(call gb_Executable_get_runtime_dependencies
,treex
)
184 gb_HelpTreeTarget_COMMAND
:= $(call gb_Executable_get_command
,treex
)
186 define gb_HelpTreeTarget__command
187 $(call gb_Helper_abbreviate_dirs
,\
188 $(if
$(filter-out qtz
,$(HELP_LANG
)), \
189 POFILES
=$(call gb_var2file
,$(shell $(gb_MKTEMP
)),$(POFILES
)) && \
190 $(gb_HelpTreeTarget_COMMAND
) \
195 -r
$(HELP_TEXTDIR
) && \
198 $(gb_HelpTreeTarget_COMMAND
) \
209 $(dir $(call gb_HelpTreeTarget_get_target
,%)).
dir :
210 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
212 $(dir $(call gb_HelpTreeTarget_get_target
,%))%/.
dir :
213 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
215 $(call gb_HelpTreeTarget_get_target
,%) : $(gb_HelpTreeTarget_DEPS
)
216 $(if
$(HELP_TEXTDIR
),,$(call gb_Output_error
,HelpTreeTarget
: no help text
dir for .tree was set
))
217 $(if
$(HELP_TREE
),,$(call gb_Output_error
,HelpTreeTarget
: no .tree file to translate was set
))
218 $(call gb_Output_announce
,$*,$(true
),TRE
,1)
219 $(call gb_Trace_StartRange
,$*,TRE
)
220 $(call gb_HelpTreeTarget__command
,$@
,$*)
221 $(call gb_Trace_EndRange
,$*,TRE
)
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)
250 # use wildcard to avoid spurious rebuilds if translation is missing
251 # gb_HelpTreeTarget_set_treefile target treefile
252 define gb_HelpTreeTarget_set_treefile
253 $(call gb_HelpTreeTarget__set_pofiles
,$(1),$(wildcard $(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
:= $(SRCDIR
)/xmlhelp
/util
/compact.xsl
273 gb_HelpLinkTarget_EMBEDTARGET
:= $(SRCDIR
)/xmlhelp
/util
/embed.xsl
274 gb_HelpLinkTarget_IDXCAPTIONTARGET
:= $(SRCDIR
)/xmlhelp
/util
/idxcaption.xsl
275 gb_HelpLinkTarget_IDXCONTENTTARGET
:= $(SRCDIR
)/xmlhelp
/util
/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 created by HelpIndexer,
285 # the ones outside the dir by HelpLinker
286 define gb_HelpLinkTarget__command
287 $(if
$(HELP_INDEXED
),rm -rf
$(addprefix $(HELP_WORKDIR
)/,$(HELP_INDEXED
)) && \
)
288 RESPONSEFILE
=$(call gb_var2file
,$(shell $(gb_MKTEMP
)),\
290 -mod
$(HELP_MODULE
) \
291 $(if
$(HELP_INDEXED
),,-noindex
) \
293 -o
$(WORKDIR
)/dummy.zip \
294 -src
$(HELP_SRCDIR
) \
295 -zipdir
$(HELP_WORKDIR
) \
296 -compact
$(gb_HelpLinkTarget_COMPACTTARGET
) \
297 -idxcaption
$(gb_HelpLinkTarget_IDXCAPTIONTARGET
) \
298 -idxcontent
$(gb_HelpLinkTarget_IDXCONTENTTARGET
) \
299 -sty
$(gb_HelpLinkTarget_EMBEDTARGET
) \
300 $(if
$(HELP_CONFIGFILE
),-add
$(HELP_MODULE
).cfg
$(HELP_CONFIGFILE
)) \
301 $(if
$(HELP_TREE
),-add
$(HELP_MODULE
).tree
$(HELP_TREE
)) \
302 $(foreach file
,$(HELP_ADD_FILES
),-add
$(notdir $(file
)) $(file
)) \
303 $(foreach extra
,$(HELP_EXTRA_ADD_FILES
),-add
$(subst $(COMMA
), ,$(extra
))) \
305 $(if
$(HELP_LINKED_MODULES
),\
306 $(shell cat
$(foreach module
,$(HELP_LINKED_MODULES
),$(call gb_HelpTarget_get_filelist
,$(module
)))) \
309 $(gb_HelpLinkTarget_HELPLINKERCOMMAND
) @
$${RESPONSEFILE} && \
311 rm -f
$${RESPONSEFILE}
315 $(dir $(call gb_HelpLinkTarget_get_target
,%)).
dir :
316 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
318 $(dir $(call gb_HelpLinkTarget_get_target
,%))%/.
dir :
319 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
321 $(call gb_HelpLinkTarget_get_target
,%) : $(gb_HelpLinkTarget_DEPS
)
322 $(call gb_Output_announce
,$*,$(true
),HLK
,3)
323 $(call gb_Trace_StartRange
,$*,HLK
)
324 $(call gb_HelpLinkTarget__command
,$@
,$*)
325 $(call gb_Trace_EndRange
,$*,HLK
)
327 .PHONY
: $(call gb_HelpLinkTarget_get_clean_target
,%)
328 $(call gb_HelpLinkTarget_get_clean_target
,%) :
329 $(call gb_Output_announce
,$*,$(false
),HLK
,3)
330 rm -f
$(call gb_HelpLinkTarget_get_target
,$*)
332 # Create a help linking target.
334 # depend on makefile to re-build when files are removed
336 # gb_HelpLinkTarget_HelpLinkTarget name module lang workdir
337 define gb_HelpLinkTarget_HelpLinkTarget
338 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_ADD_FILES
:=
339 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_CONFIGFILE
:=
340 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_EXTRA_ADD_FILES
:=
341 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_FILES
:=
342 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_INDEXED
:=
343 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_MODULE
:= $(2)
344 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_LANG
:= $(3)
345 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_LINKED_MODULES
:=
346 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_SRCDIR
:=
347 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_TREE
:=
348 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_WORKDIR
:= $(4)
350 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(gb_Module_CURRENTMAKEFILE
)
351 $(call gb_HelpLinkTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpLinkTarget_get_target
,$(1))).
dir
353 $(4)/$(2).tree
: $(call gb_HelpLinkTarget_get_target
,$(1))
357 # gb_HelpLinkTarget_set_configfile target configfile
358 define gb_HelpLinkTarget_set_configfile
359 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_CONFIGFILE
:= $(2)
360 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(2)
364 # gb_HelpLinkTarget_set_sourcedir target source
365 define gb_HelpLinkTarget_set_sourcedir
366 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_SRCDIR
:= $(2)
370 # gb_HelpLinkTarget_set_treefile target treefile
371 define gb_HelpLinkTarget_set_treefile
372 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_TREE
:= $(2)
373 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(2)
377 # gb_HelpLinkTarget_set_indexed target indexfiles
378 define gb_HelpLinkTarget_set_indexed
379 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_INDEXED
:= $(2)
380 $(addprefix $(call gb_HelpTarget_get_workdir
,$(1))/,$(2)) : $(call gb_HelpIndexTarget_get_target
,$(1))
384 # gb_HelpLinkTarget_add_helpfile target helpfile
385 define gb_HelpLinkTarget_add_helpfile
386 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_FILES
+= $(2)
387 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(2)
391 # Add an arbitrary file to the help pack.
393 # The file will be added to the root directory of the pack.
395 # gb_HelpLinkTarget_add_file target file
396 define gb_HelpLinkTarget_add_file
397 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_ADD_FILES
+= $(2)
398 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(2)
402 # Add an arbitrary file to the help pack under a new name.
404 # The file will be added to the root directory of the pack.
406 # gb_HelpLinkTarget_add_renamed_file target filename file
407 define gb_HelpLinkTarget_add_renamed_file
408 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_EXTRA_ADD_FILES
+= $(strip $(2)),$(strip $(3))
409 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(3)
410 $(call gb_HelpTarget_get_workdir
,$(1))/$(2) : $(call gb_HelpLinkTarget_get_target
,$(1))
415 # Link with help files from another help module.
417 # gb_HelpLinkTarget_use_linked_module target help
418 define gb_HelpLinkTarget_use_linked_module
419 $(call gb_HelpLinkTarget_get_target
,$(1)) : HELP_LINKED_MODULES
+= $(2)
423 # class HelpIndexTarget
425 # Creates a full-text search index for a help module.
427 gb_HelpIndexTarget_DEPS
:= $(call gb_Executable_get_runtime_dependencies
,HelpIndexer
)
428 gb_HelpIndexTarget_COMMAND
:= $(call gb_Executable_get_command
,HelpIndexer
)
430 # first delete the index stuff since when it is generated an existing _0.cfs
431 # will not be overwritten; instead a new _1.cfs etc. created until disk is full
432 define gb_HelpIndexTarget__command
433 $(call gb_Helper_abbreviate_dirs
,\
435 rm -rf
$(HELP_WORKDIR
)/$(HELP_MODULE
).idxl \
436 && $(gb_HelpIndexTarget_COMMAND
) \
437 -dir $(HELP_WORKDIR
) \
439 -mod
$(HELP_MODULE
) \
442 ||
( rm -rf
$(HELP_MODULE
).
* ; false
)
446 $(dir $(call gb_HelpIndexTarget_get_target
,%)).
dir :
447 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
449 $(dir $(call gb_HelpIndexTarget_get_target
,%))%/.
dir :
450 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
452 $(call gb_HelpIndexTarget_get_target
,%) : $(gb_HelpIndexTarget_DEPS
)
453 $(call gb_Output_announce
,$*,$(true
),HIX
,3)
454 $(call gb_Trace_StartRange
,$*,HIX
)
455 $(call gb_HelpIndexTarget__command
,$@
,$*)
456 $(call gb_Trace_EndRange
,$*,HIX
)
458 .PHONY
: $(call gb_HelpIndexTarget_get_clean_target
,%)
459 $(call gb_HelpIndexTarget_get_clean_target
,%) :
460 $(call gb_Output_announce
,$*,$(false
),HIX
,3)
461 rm -f
$(call gb_HelpIndexTarget_get_target
,$*)
463 # Create a help indexing target.
465 # gb_HelpIndexTarget_HelpIndexTarget target module lang workdir
466 define gb_HelpIndexTarget_HelpIndexTarget
467 $(call gb_HelpIndexTarget_get_target
,$(1)) : HELP_LANG
:= $(3)
468 $(call gb_HelpIndexTarget_get_target
,$(1)) : HELP_MODULE
:= $(2)
469 $(call gb_HelpIndexTarget_get_target
,$(1)) : HELP_WORKDIR
:= $(4)
471 $(call gb_HelpIndexTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpIndexTarget_get_target
,$(1))).
dir
475 # class HelpJarTarget
477 # Packs help files processed by HelpLinker into a jar in the workdir.
479 gb_HelpJarTarget_COMMAND
:= zip
481 define gb_HelpJarTarget__get_command
482 cd
$(HELP_WORKDIR
) && \
483 $(gb_HelpJarTarget_COMMAND
) -q
-0 -rX
--filesync
--must-match
$(HELP_MODULE
).jar text
/$(HELP_MODULE
) && \
487 $(dir $(call gb_HelpJarTarget_get_target
,%)).
dir :
488 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
490 $(dir $(call gb_HelpJarTarget_get_target
,%))%/.
dir :
491 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
493 $(call gb_HelpJarTarget_get_target
,%) :
494 $(call gb_Output_announce
,$*,$(true
),HEJ
,3)
495 $(call gb_Trace_StartRange
,$*,HEJ
)
496 $(call gb_HelpJarTarget__get_command
,$@
,$*)
497 $(call gb_Trace_EndRange
,$*,HEJ
)
499 $(call gb_HelpJarTarget_get_clean_target
,%) :
500 $(call gb_Output_announce
,$*,$(false
),HEJ
,3)
501 rm -f
$(call gb_HelpJarTarget_get_target
,$*)
503 # gb_HelpJarTarget_HelpJarTarget target module workdir
504 define gb_HelpJarTarget_HelpJarTarget
505 $(call gb_HelpJarTarget_get_target
,$(1)) : HELP_MODULE
:= $(2)
506 $(call gb_HelpJarTarget_get_target
,$(1)) : HELP_WORKDIR
:= $(3)
508 $(call gb_HelpJarTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpJarTarget_get_target
,$(1))).
dir
510 $(3)/$(2).jar
: $(call gb_HelpJarTarget_get_target
,$(1))
516 # Creates one language version of a help module.
518 # Provides a filelist called HelpTarget/<name>, that is not built by
519 # default (i.e., the user of HelpTarget has to explicitly depend on the
522 gb_HelpTarget_DEFAULT_LANG
:= en-US
524 gb_HelpTarget__get_module
= $(patsubst %/$(call gb_HelpTarget__get_lang
,$(1)),%,$(1))
525 gb_HelpTarget__get_lang
= $(lastword
$(subst /, ,$(1)))
526 gb_HelpTarget__test_default_lang
= $(filter $(gb_HelpTarget_DEFAULT_LANG
),$(1))
527 gb_HelpTarget__is_default_lang
= $(call gb_HelpTarget__test_default_lang
,$(call gb_HelpTarget__get_lang
,$(1)))
529 define gb_HelpTarget__get_helpdir
530 $(if
$(call gb_HelpTarget__is_default_lang
,$(1)) \
532 ,$(call gb_HelpTranslateTarget_get_workdir
,$(1),$(2)) \
536 define gb_HelpTarget__get_helpfile
537 $(if
$(call gb_HelpTarget__is_default_lang
,$(1)) \
538 ,$(SRCDIR
)/$(2).xhp \
539 ,$(call gb_HelpTranslateTarget_get_translated_target
,$(1),$(2)) \
543 define gb_HelpTarget__get_treefile
544 $(if
$(call gb_HelpTarget__is_default_lang
,$(1)) \
545 ,$(SRCDIR
)/$(2).tree \
546 ,$(call gb_HelpTreeTarget_get_target
,$(1)) \
550 define gb_HelpTarget__command
551 $(if
$(ENABLE_HTMLHELP
),,$(call gb_Output_announce
,$(2),$(true
),HLP
,4))
552 $(if
$(ENABLE_HTMLHELP
),,$(call gb_Trace_MakeMark
,$(2),HLP
))
556 $(dir $(call gb_HelpTarget_get_target
,%)).
dir :
557 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
559 $(dir $(call gb_HelpTarget_get_target
,%))%/.
dir :
560 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
562 # Translation of the module's .xhp files and all used modules is done.
563 # Also creates the list for gb_HelpTarget_get_filelist.
564 $(call gb_HelpTarget_get_translation_target
,%) :
565 $(file
>$@
,$(strip $(HELP_FILES
)))
567 # Translation of the module's .xhp files and all used and linked modules
569 $(call gb_HelpTarget_get_linked_target
,%) :
572 $(call gb_HelpTarget_get_target
,%) :
573 $(call gb_HelpTarget__command
,$@
,$*)
575 .PHONY
: $(call gb_HelpTarget_get_clean_target
,%)
576 $(call gb_HelpTarget_get_clean_target
,%) :
577 ifeq ($(ENABLE_HTMLHELP
),)
578 $(call gb_Output_announce
,$*,$(false
),HLP
,4)
580 $(call gb_Helper_abbreviate_dirs
,\
582 $(call gb_HelpTarget_get_linked_target
,$*) \
583 $(call gb_HelpTarget_get_target
,$*) \
584 $(call gb_HelpTarget_get_translation_target
,$*) \
585 $(call gb_HelpTarget_get_workdir
,$*) \
588 gb_HelpTarget_get_packagename
= HelpTarget
/$(1)
590 # Create a help target.
592 # depend on makefile to re-build filelist when files are removed
594 # gb_HelpTarget_HelpTarget target module lang
595 define gb_HelpTarget_HelpTarget
596 $(call gb_HelpTarget_get_target
,$(1)) : HELP_MODULE
:= $(2)
597 $(call gb_HelpTarget_get_target
,$(1)) : HELP_LANG
:= $(3)
599 $(call gb_HelpTarget_get_translation_target
,$(1)) : HELP_FILES
:=
600 $(call gb_HelpTarget_get_translation_target
,$(1)) : $(gb_Module_CURRENTMAKEFILE
)
602 $(call gb_HelpTarget__HelpTarget_impl
,$(1),$(2),$(3),$(call gb_HelpTarget_get_workdir
,$(1)),$(call gb_HelpTarget_get_packagename
,$(1)))
606 # gb_HelpTarget__HelpTarget_impl target module lang workdir package
607 define gb_HelpTarget__HelpTarget_impl
608 $(if
$(call gb_HelpTarget__test_default_lang
,$(3)),,$(call gb_HelpTarget__HelpTarget_impl_lang
,$(1),$(2),$(3),$(4)))
610 ifeq ($(ENABLE_HTMLHELP
),)
611 $(call gb_HelpLinkTarget_HelpLinkTarget
,$(1),$(2),$(3),$(4))
612 $(call gb_HelpIndexTarget_HelpIndexTarget
,$(1),$(2),$(3),$(4))
613 $(call gb_HelpJarTarget_HelpJarTarget
,$(1),$(2),$(4))
614 $(call gb_Package_Package_internal
,$(5),$(4))
617 $(call gb_HelpTarget_get_linked_target
,$(1)) : $(call gb_HelpTarget_get_translation_target
,$(1))
618 ifeq ($(ENABLE_HTMLHELP
),)
619 $(call gb_HelpLinkTarget_get_target
,$(1)) : $(call gb_HelpTarget_get_linked_target
,$(1))
620 $(call gb_HelpLinkTarget_get_target
,$(1)) :|
$(call gb_HelpTarget_get_workdir
,$(1))/.
dir
621 $(call gb_HelpTarget_get_target
,$(1)) : $(call gb_HelpLinkTarget_get_target
,$(1))
622 $(call gb_Package_get_preparation_target
,$(5)) : $(call gb_HelpTarget_get_target
,$(1))
625 $(call gb_HelpTarget_get_linked_target
,$(1)) :|
$(dir $(call gb_HelpTarget_get_linked_target
,$(1))).
dir
626 $(call gb_HelpTarget_get_target
,$(1)) :|
$(dir $(call gb_HelpTarget_get_target
,$(1))).
dir
627 $(call gb_HelpTarget_get_translation_target
,$(1)) :|
$(dir $(call gb_HelpTarget_get_translation_target
,$(1))).
dir
629 ifeq ($(ENABLE_HTMLHELP
),)
630 $(call gb_HelpTarget_get_clean_target
,$(1)) : $(call gb_HelpLinkTarget_get_clean_target
,$(1))
635 # gb_HelpTarget__HelpTarget_impl_lang target module lang workdir
636 define gb_HelpTarget__HelpTarget_impl_lang
637 $(call gb_HelpTranslateTarget_HelpTranslateTarget
,$(1),$(3))
638 $(call gb_HelpTreeTarget_HelpTreeTarget
,$(1),$(3))
640 $(call gb_HelpTarget_get_translation_target
,$(1)) : $(call gb_HelpTranslateTarget_get_target
,$(1))
641 $(call gb_HelpTreeTarget_get_target
,$(1)) : $(call gb_HelpTarget_get_linked_target
,$(1))
643 $(call gb_HelpTarget_get_clean_target
,$(1)) : $(call gb_HelpTranslateTarget_get_clean_target
,$(1))
644 $(call gb_HelpTarget_get_clean_target
,$(1)) : $(call gb_HelpTreeTarget_get_clean_target
,$(1))
648 # need a rule for these because these are targets for the Package
649 $(WORKDIR
)/HelpTarget
/%.tree
:
651 $(WORKDIR
)/HelpTarget
/%.jar
:
653 $(WORKDIR
)/HelpTarget
/%.db
:
655 $(WORKDIR
)/HelpTarget
/%.ht
:
657 $(WORKDIR
)/HelpTarget
/%.key
:
659 $(WORKDIR
)/HelpTarget
/%.idxl
/_0.cfs
:
661 $(WORKDIR
)/HelpTarget
/%.idxl
/segments_3
:
663 $(WORKDIR
)/HelpTarget
/%.idxl
/segments.gen
:
666 # Get list of the various index files.
668 # gb_HelpTarget__add_index_files target module
669 define gb_HelpTarget__get_index_files
670 $(foreach suffix,.db .ht .idxl
/_0.cfs .idxl
/segments_3 .idxl
/segments.gen .key
,$(addsuffix $(suffix),$(call gb_HelpTarget__get_module
,$(1))))
673 # gb_HelpTarget__add_file target file
674 define gb_HelpTarget__add_file
675 ifeq ($(ENABLE_HTMLHELP
),)
676 $(call gb_Package_add_file
,$(call gb_HelpTarget_get_packagename
,$(1)),$(LIBO_SHARE_HELP_FOLDER
)/$(call gb_HelpTarget__get_lang
,$(1))/$(2),$(2))
681 # Set config. file used for the help module.
683 # The configfile is relative to $(SRCDIR) and without extension.
685 # gb_HelpTarget_set_configfile target configfile
686 define gb_HelpTarget_set_configfile
687 ifeq ($(ENABLE_HTMLHELP
),)
688 $(call gb_HelpLinkTarget_set_configfile
,$(1),$(SRCDIR
)/$(2).cfg
)
689 $(call gb_HelpTarget__add_file
,$(1),$(call gb_HelpTarget__get_module
,$(1)).cfg
)
694 # gb_HelpTarget_set_helpdir target helpdir
695 define gb_HelpTarget_set_helpdir
696 ifeq ($(ENABLE_HTMLHELP
),)
697 $(call gb_HelpLinkTarget_set_sourcedir
,$(1),$(call gb_HelpTarget__get_helpdir
,$(1),$(2)))
702 # gb_HelpTarget_set_treefile target treefile textdir
703 define gb_HelpTarget_set_treefile
704 $(if
$(call gb_HelpTarget__is_default_lang
,$(1)),,\
705 $(call gb_HelpTreeTarget_set_treefile
,$(1),$(2)) \
706 $(call gb_HelpTreeTarget_set_helptextdir
,$(1),$(call gb_HelpTarget__get_helpdir
,$(1),$(3))) \
708 ifeq ($(ENABLE_HTMLHELP
),)
709 $(call gb_HelpLinkTarget_set_treefile
,$(1),$(call gb_HelpTarget__get_treefile
,$(1),$(2)))
710 $(call gb_HelpTarget__add_file
,$(1),$(call gb_HelpTarget__get_module
,$(1)).tree
)
715 # Produce full text search index, bookmark list, etc.
717 # gb_HelpTarget_set_indexed target
718 define gb_HelpTarget_set_indexed
719 ifeq ($(ENABLE_HTMLHELP
),)
720 $(call gb_HelpLinkTarget_set_indexed
,$(1),$(call gb_HelpTarget__get_index_files
,$(1)))
721 $(foreach file
,$(call gb_HelpTarget__get_index_files
,$(1)),$(call gb_HelpTarget__add_file
,$(1),$(file
)))
723 $(call gb_HelpIndexTarget_get_target
,$(1)) : $(call gb_HelpLinkTarget_get_target
,$(1))
724 $(call gb_HelpTarget_get_target
,$(1)) : $(call gb_HelpIndexTarget_get_target
,$(1))
725 $(call gb_HelpTarget_get_clean_target
,$(1)) : $(call gb_HelpIndexTarget_get_clean_target
,$(1))
730 # gb_HelpTarget__add_jar target
731 define gb_HelpTarget__add_jar
732 ifeq ($(ENABLE_HTMLHELP
),)
733 $(call gb_HelpTarget__add_file
,$(1),$(call gb_HelpTarget__get_module
,$(1)).jar
)
734 $(call gb_HelpJarTarget_get_target
,$(1)) : $(call gb_HelpLinkTarget_get_target
,$(1))
735 $(call gb_HelpTarget_get_target
,$(1)) : $(call gb_HelpJarTarget_get_target
,$(1))
736 $(call gb_HelpTarget_get_clean_target
,$(1)) : $(call gb_HelpJarTarget_get_clean_target
,$(1))
741 define gb_HelpTarget__add_helpfile_impl
742 ifeq ($(ENABLE_HTMLHELP
),)
743 $(call gb_HelpLinkTarget_add_helpfile
,$(1),$(2))
746 $(call gb_HelpTarget_get_translation_target
,$(1)) : HELP_FILES
+= $(2)
750 # gb_HelpTarget__add_helpfile target helpfile
751 define gb_HelpTarget__add_helpfile
752 $(call gb_HelpTarget__add_helpfile_impl
,$(1),$(call gb_HelpTarget__get_helpfile
,$(1),$(2)))
756 # gb_HelpTarget_add_helpfile target helpfile
757 define gb_HelpTarget_add_helpfile
758 $(call gb_HelpTranslateTarget_add_file
,$(1),$(2))
759 $(call gb_HelpTarget__add_helpfile
,$(1),$(2))
760 ifeq ($(ENABLE_HTMLHELP
),)
761 $(call gb_HelpTarget__add_jar
,$(1))
766 # gb_HelpTarget_add_helpfiles target helpfile(s)
767 define gb_HelpTarget_add_helpfiles
768 $(call gb_HelpTranslateTarget_add_files
,$(1),$(2))
769 $(foreach helpfile
,$(2),$(call gb_HelpTarget__add_helpfile
,$(1),$(helpfile
)))
770 ifeq ($(ENABLE_HTMLHELP
),)
771 $(call gb_HelpTarget__add_jar
,$(1))
776 # gb_HelpTarget_add_file target file
777 define gb_HelpTarget_add_file
778 ifeq ($(ENABLE_HTMLHELP
),)
779 $(call gb_HelpLinkTarget_add_file
,$(1),$(SRCDIR
)/$(2))
780 $(call gb_HelpTarget__add_file
,$(1),$(notdir $(2)))
785 # gb_HelpTarget_add_files target file(s)
786 define gb_HelpTarget_add_files
787 $(foreach file
,$(2),$(call gb_HelpTarget_add_file
,$(1),$(file
)))
791 # Add a localized file from helpdir under a new name.
793 # This is a hack needed for err.html in shared help module.
795 # gb_HelpTarget_add_helpdir_file target filename file
796 define gb_HelpTarget_add_helpdir_file
797 ifeq ($(ENABLE_HTMLHELP
),)
798 $(call gb_HelpLinkTarget_add_renamed_file
,$(1),$(2),$(call gb_HelpTarget__get_helpfile
,$(1),$(3)))
799 $(call gb_HelpTarget__add_file
,$(1),$(2))
804 # gb_HelpTarget_use_module target module
805 define gb_HelpTarget_use_module
806 $(call gb_HelpTarget_get_translation_target
,$(1)) : $(call gb_HelpTarget_get_translation_target
,$(2))
810 # gb_HelpTarget_use_modules target module(s)
811 define gb_HelpTarget_use_modules
812 $(foreach module
,$(2),$(call gb_HelpTarget_use_module
,$(1),$(module
)))
816 # gb_HelpTarget_use_linked_module target module
817 define gb_HelpTarget_use_linked_module
818 ifeq ($(ENABLE_HTMLHELP
),)
819 $(call gb_HelpLinkTarget_use_linked_module
,$(1),$(2))
820 $(call gb_HelpTarget_get_linked_target
,$(1)) : $(call gb_HelpTarget_get_translation_target
,$(2))
825 # gb_HelpTarget_use_linked_modules target module(s)
826 define gb_HelpTarget_use_linked_modules
827 $(foreach module
,$(2),$(call gb_HelpTarget_use_linked_module
,$(1),$(module
)))
831 # vim: set noet sw=4 ts=4: