summaryrefslogtreecommitdiff
path: root/solenv/gbuild/AllLangHelp.mk
blob: 32d38166d53f8567094d0ceb7cda689824e19127 (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
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#

# class AllLangHelp

# Creates and delivers all language versions of a module.

gb_AllLangHelp_HELPDIRNAME := helpcontent2
gb_AllLangHelp_AUXDIRNAME := auxiliary
gb_AllLangHelp_HELPDIR := $(gb_AllLangHelp_HELPDIRNAME)/source
gb_AllLangHelp_AUXDIR := $(gb_AllLangHelp_HELPDIR)/$(gb_AllLangHelp_AUXDIRNAME)

gb_AllLangHelp__get_helpname = $(1)/$(2)

ifneq ($(ENABLE_HTMLHELP),)
$(call gb_AllLangHelp_get_helpfiles_target,%): | \
        $(dir $(call gb_AllLangHelp_get_helpfiles_target,%)).dir
	touch $@
endif

$(dir $(call gb_AllLangHelp_get_target,%)).dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))

$(dir $(call gb_AllLangHelp_get_target,%))%/.dir :
	$(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))

$(call gb_AllLangHelp_get_target,%) :
ifeq ($(ENABLE_HTMLHELP),)
	$(call gb_Output_announce,$*,$(true),ALH,5)
	$(call gb_Trace_MakeMark,$*,ALH)
endif
	touch $@

$(call gb_AllLangHelp_get_clean_target,%) :
ifeq ($(ENABLE_HTMLHELP),)
	$(call gb_Output_announce,$*,$(false),ALH,5)
endif
	$(call gb_Helper_abbreviate_dirs,\
		rm -f $(call gb_AllLangHelp_get_target,$*) $(call gb_AllLangHelp_get_helpfiles_target,$*) \
	)

# gb_AllLangHelp_AllLangHelp__one_lang module lang helpname
define gb_AllLangHelp_AllLangHelp__one_lang
$(call gb_HelpTarget_HelpTarget,$(3),$(1),$(2))
$(call gb_HelpTarget_set_helpdir,$(3),$(gb_AllLangHelp_HELPDIR))

$(call gb_AllLangHelp_get_target,$(1)) : $(call gb_HelpTarget_get_target,$(3))
ifeq ($(ENABLE_HTMLHELP),)
$(call gb_AllLangHelp_get_target,$(1)) : $(call gb_Package_get_target,$(call gb_HelpTarget_get_packagename,$(3)))
endif
$(call gb_AllLangHelp_get_clean_target,$(1)) : $(call gb_HelpTarget_get_clean_target,$(3))
ifeq ($(ENABLE_HTMLHELP),)
$(call gb_AllLangHelp_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(call gb_HelpTarget_get_packagename,$(3)))
endif

endef

# Create and deliver help packs for a module for all languages.
#
# gb_AllLangHelp_AllLangHelp module
gb_AllLangHelp_ALLTARGETS :=

define gb_AllLangHelp_AllLangHelp
gb_AllLangHelp_ALLTARGETS += $(1)
$(foreach lang,$(gb_HELP_LANGS),\
	$(call gb_AllLangHelp_AllLangHelp__one_lang,$(1),$(lang),$(call gb_AllLangHelp__get_helpname,$(1),$(lang))))

$(call gb_AllLangHelp_get_target,$(1)) :| $(dir $(call gb_AllLangHelp_get_target,$(1))).dir

$$(eval $$(call gb_Module_register_target,$(call gb_AllLangHelp_get_target,$(1)),$(call gb_AllLangHelp_get_clean_target,$(1))))
$(call gb_Helper_make_userfriendly_targets,$(1),AllLangHelp)

endef

# gb_AllLangHelp_set_treefile module treefile
define gb_AllLangHelp_set_treefile
$(foreach lang,$(gb_HELP_LANGS),\
	$(call gb_HelpTarget_set_treefile,$(call gb_AllLangHelp__get_helpname,$(1),$(lang)),$(2),$(gb_AllLangHelp_HELPDIR)/text) \
)

endef

# Add one or more help files.
#
# gb_AllLangHelp_add_helpfiles module file(s) [optional bookmark token]
define gb_AllLangHelp_add_helpfiles
$(foreach lang,$(gb_HELP_LANGS),\
	$(call gb_HelpTarget_add_helpfiles,$(call gb_AllLangHelp__get_helpname,$(1),$(lang)),$(2)) \
)
ifneq ($(ENABLE_HTMLHELP),)
gb_AllLangHelp_$(1)_HELPFILES += $(addsuffix .xhp,$(2))
gb_AllLangHelp_$(or $(3),$(1))_BOOKMARK_HELPFILES += $(addsuffix .xhp,$(2))
$(call gb_AllLangHelp_get_helpfiles_target,$(1)): $(addprefix $(SRCDIR)/,$(addsuffix .xhp,$(2)))
endif

endef

# Add additional localized file(s) to the help pack.
#
# gb_AllLangHelp_add_localized_files module basedir file(s)
define gb_AllLangHelp_add_localized_files
$(foreach lang,$(gb_HELP_LANGS),\
	$(call gb_HelpTarget_add_files,$(call gb_AllLangHelp__get_helpname,$(1),$(lang)),$(addprefix $(2)/$(lang)/,$(3))) \
)

endef

# Add a localized file from helpdir under a new name.
#
# This is a hack needed for err.html in shared help module.
#
# gb_AllLangHelp_add_helpdir_file module filename file
define gb_AllLangHelp_add_helpdir_file
$(foreach lang,$(gb_HELP_LANGS),\
	$(call gb_HelpTarget_add_helpdir_file,$(call gb_AllLangHelp__get_helpname,$(1),$(lang)),$(2),$(3)) \
)

endef

# gb_AllLangHelp__use_module module other-module lang
define gb_AllLangHelp__use_module
$(call gb_HelpTarget_use_module,$(call gb_AllLangHelp__get_helpname,$(1),$(3)),$(call gb_AllLangHelp__get_helpname,$(2),$(3)))

endef

# Use references from another help module's files.
#
# gb_AllLangHelp_use_module module other-module
define gb_AllLangHelp_use_module
$(foreach lang,$(gb_HELP_LANGS),$(call gb_AllLangHelp__use_module,$(1),$(2),$(lang)))

endef

# Use references from other help modules' files.
#
# gb_AllLangHelp_use_module module other-module(s)
define gb_AllLangHelp_use_modules
$(foreach module,$(2),$(call gb_AllLangHelp_use_module,$(1),$(module)))

endef

# gb_AllLangHelp__use_linked_module module other-module lang
define gb_AllLangHelp__use_linked_module
$(call gb_HelpTarget_use_linked_module,$(call gb_AllLangHelp__get_helpname,$(1),$(3)),$(call gb_AllLangHelp__get_helpname,$(2),$(3)))
$(call gb_HelpTarget_set_indexed,$(call gb_AllLangHelp__get_helpname,$(1),$(3)))
$(call gb_HelpTarget_set_configfile,$(call gb_AllLangHelp__get_helpname,$(1),$(3)),$(gb_AllLangHelp_AUXDIR)/$(3)/$(1))

endef

# Link with another help module.
#
# gb_AllLangHelp_use_linked_module module other-module
define gb_AllLangHelp_use_linked_module
$(foreach lang,$(gb_HELP_LANGS),$(call gb_AllLangHelp__use_linked_module,$(1),$(2),$(lang)))

endef

# Link with other help module(s).
#
# gb_AllLangHelp_use_linked_module module other-module(s)
define gb_AllLangHelp_use_linked_modules
$(foreach module,$(2),$(call gb_AllLangHelp_use_linked_module,$(1),$(module)))

endef

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