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 # class UIMenubarTarget
12 # Handles platform-specific processing of menubar config files.
14 # defined by platform:
15 # gb_UIMenubarTarget_UIMenubarTarget_platform
16 # gb_UIMenubarTarget__command
18 $(dir $(call gb_UIMenubarTarget_get_target
,%)).
dir :
19 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
21 $(dir $(call gb_UIMenubarTarget_get_target
,%))%/.
dir :
22 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
24 $(call gb_UIMenubarTarget_get_target
,%) :
25 $(call gb_UIMenubarTarget__command
,$@
,$*,$<)
27 .PHONY
: $(call gb_UIMenubarTarget_get_clean_target
,%)
28 $(call gb_UIMenubarTarget_get_clean_target
,%) :
29 $(call gb_Output_announce
,$(2),$(false
),UIM
,1)
30 rm -f
$(call gb_UIMenubarTarget_get_target
,$*)
32 # Process a menubar configuration file.
34 # gb_UIMenubarTarget_UIMenubarTarget target source
35 define gb_UIMenubarTarget_UIMenubarTarget
36 $(call gb_UIMenubarTarget_get_target
,$(1)) : $(2)
37 $(call gb_UIMenubarTarget_get_target
,$(1)) :|
$(dir $(call gb_UIMenubarTarget_get_target
,$(1))).
dir
39 $(call gb_UIMenubarTarget_UIMenubarTarget_platform
,$(1),$(2))
43 # class UIImageListTarget
45 # Handles creation of image lists for .ui files.
47 gb_UIImageListTarget_COMMAND
= $(call gb_ExternalExecutable_get_command
,xsltproc
)
48 gb_UIImageListTarget_DEPS
= $(call gb_ExternalExecutable_get_dependencies
,xsltproc
)
49 gb_UIImageListTarget_XSLTFILE
:= $(SRCDIR
)/solenv
/bin
/uiimagelist.xsl
51 # NOTE: for some reason xsltproc does not produce any file if there is
52 # no output, so we touch the target to make sure it exists.
53 define gb_UIImageListTarget__command
54 $(call gb_Helper_abbreviate_dirs
,\
55 $(gb_UIImageListTarget_COMMAND
) --nonet
-o
$@
$(gb_UIImageListTarget_XSLTFILE
) $(UIFILE
) && \
60 $(dir $(call gb_UIImageListTarget_get_target
,%)).
dir :
61 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
63 $(dir $(call gb_UIImageListTarget_get_target
,%))%/.
dir :
64 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
66 $(call gb_UIImageListTarget_get_target
,%) : $(gb_UIImageListTarget_DEPS
) $(gb_UIImageListTarget_XSLTFILE
)
67 $(call gb_Output_announce
,$*,$(true
),UIL
,1)
68 $(call gb_Trace_StartRange
,$*,UIL
)
69 $(call gb_UIImageListTarget__command
,$@
,$*)
70 $(call gb_Trace_EndRange
,$*,UIL
)
72 .PHONY
: $(call gb_UIImageListTarget_get_clean_target
,%)
73 $(call gb_UIImageListTarget_get_clean_target
,%) :
74 $(call gb_Output_announce
,$*,$(false
),UIL
,1)
75 rm -f
$(call gb_UIImageListTarget_get_target
,$*)
77 # Extract list of images referenced in a .ui file.
79 # gb_UIImageListTarget_UIImageListTarget uifile
80 define gb_UIImageListTarget_UIImageListTarget
81 $(call gb_UIImageListTarget_get_target
,$(1)) : UIFILE
:= $(SRCDIR
)/$(1).ui
83 $(call gb_UIImageListTarget_get_target
,$(1)) : $(SRCDIR
)/$(1).ui
84 $(call gb_UIImageListTarget_get_target
,$(1)) :|
$(dir $(call gb_UIImageListTarget_get_target
,$(1))).
dir
90 # Handles UI configuration files.
92 # This mostly means UI description files (suffix .ui) for the new layouting
95 # This class provides the following filelists:
96 # * UIConfig/<name> containing all nontranslatable files
98 gb_UIConfig_INSTDIR
:= $(LIBO_SHARE_FOLDER
)/config
/soffice.cfg
100 ifneq ($(filter LXML
,$(BUILD_TYPE
)),)
101 gb_UIConfig_LXML_PATH
:= PYTHONPATH
=$${PYTHONPATH
:+$$PYTHONPATH:}$(call gb_UnpackedTarball_get_dir
,lxml
)/install ;
102 gb_UIConfig_LXML_TARGET
:= $(call gb_ExternalProject_get_target
,lxml
)
104 gb_UIConfig_gla11y_SCRIPT
:= $(SRCDIR
)/bin
/gla11y
106 $(dir $(call gb_UIConfig_get_target
,%)).
dir :
107 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
109 $(dir $(call gb_UIConfig_get_target
,%))%/.
dir :
110 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
112 $(call gb_UIConfig_get_target
,%) : $(call gb_UIConfig_get_imagelist_target
,%) $(call gb_UIConfig_get_a11yerrors_target
,%)
113 $(call gb_Output_announce
,$*,$(true
),UIC
,2)
114 $(call gb_Trace_StartRange
,$*,UIC
)
115 $(call gb_Helper_abbreviate_dirs
,\
118 $(call gb_Trace_EndRange
,$*,UIC
)
120 $(call gb_UIConfig_get_imagelist_target
,%) :
121 $(call gb_UIConfig__command
)
123 .PHONY
: $(call gb_UIConfig_get_clean_target
,%)
124 $(call gb_UIConfig_get_clean_target
,%) :
125 $(call gb_Output_announce
,$*,$(false
),UIC
,2)
126 $(call gb_Helper_abbreviate_dirs
,\
127 rm -f
$(call gb_UIConfig_get_target
,$*) $(call gb_UIConfig_get_imagelist_target
,$*) \
129 $(call gb_Output_announce
,$*,$(false
),UIA
,2)
130 rm -f
$(call gb_UIConfig_get_a11yerrors_target
,$*)
132 gb_UIConfig_gla11y_PARAMETERS
= -P
$(SRCDIR
)/ -f
$(UI_A11YFALSE
)
134 # Disable this to see suppressed warnings
136 gb_UIConfig_gla11y_PARAMETERS
+= -s
$(UI_A11YSUPPRS
)
138 # Enable this to regenerate suppression files
140 gb_UIConfig_gla11y_PARAMETERS
+= -g
$(UI_A11YSUPPRS
)
143 # Tell gla11y about LO-specific widgets
144 # These are storage, containers, or preview
145 gb_UIConfig_gla11y_PARAMETERS
+= --widgets-suffixignored
+ValueSet
,HBox
,VBox
,ToolBox
,Preview
,PreviewWin
,PreviewWindow
,PrevWindow
146 # These are buttons, thus already contain their label (but an image is not enough)
147 gb_UIConfig_gla11y_PARAMETERS
+= --widgets-button
+svtlo-ManagedMenuButton
149 # All new warnings should be fatal except a few kinds which could be only doubtful
150 gb_UIConfig_gla11y_PARAMETERS
+= --fatal-all
--not-fatal-type duplicate-mnemonic
--not-fatal-type labelled-by-and-mnemonic
--not-fatal-type orphan-label
152 define gb_UIConfig_a11yerrors__command
153 $(call gb_UIConfig__gla11y_command
)
156 $(call gb_UIConfig_get_a11yerrors_target
,%) : $(gb_UIConfig_LXML_TARGET
) $(call gb_ExternalExecutable_get_dependencies
,python
) $(gb_UIConfig_gla11y_SCRIPT
)
157 $(call gb_Output_announce
,$*,$(true
),UIA
,1)
158 $(call gb_Trace_StartRange
,$*,UIA
)
159 $(call gb_UIConfig_a11yerrors__command
,$@
,$*)
160 $(call gb_Trace_EndRange
,$*,UIA
)
162 gb_UIConfig_get_packagename
= UIConfig
/$(1)
163 gb_UIConfig_get_packagesetname
= UIConfig
/$(1)
165 # Processes and delivers a set of UI configuration files.
167 # gb_UIConfig_UIConfig modulename
168 define gb_UIConfig_UIConfig
169 ifeq (,$$(filter $(1),$$(gb_UIConfig_REGISTERED
)))
170 $$(eval
$$(call gb_Output_info
,Currently known UI configs are
: $(sort $(gb_UIConfig_REGISTERED
)),ALL
))
171 $$(eval
$$(call gb_Output_error
,UIConfig
$(1) must be registered in Repository.mk
))
173 $(call gb_UIConfig_get_imagelist_target
,$(1)) : UI_IMAGELISTS
:=
175 $(call gb_PackageSet_PackageSet_internal
,$(call gb_UIConfig_get_packagesetname
,$(1)))
176 $(call gb_Package_Package_internal
,$(call gb_UIConfig_get_packagename
,$(1)),$(SRCDIR
))
177 $(call gb_Package_Package_internal
,$(call gb_UIConfig_get_packagename
,$(1)_generated
),$(WORKDIR
))
179 $(call gb_PackageSet_add_package
,$(call gb_UIConfig_get_packagesetname
,$(1)),$(call gb_UIConfig_get_packagename
,$(1)))
181 $(call gb_UIConfig_get_target
,$(1)) :|
$(dir $(call gb_UIConfig_get_target
,$(1))).
dir
182 $(call gb_UIConfig_get_imagelist_target
,$(1)) :|
$(dir $(call gb_UIConfig_get_imagelist_target
,$(1))).
dir
183 $(call gb_UIConfig_get_a11yerrors_target
,$(1)) :|
$(dir $(call gb_UIConfig_get_a11yerrors_target
,$(1))).
dir
184 $(call gb_UIConfig_get_a11yerrors_target
,$(1)) : UI_A11YSUPPRS
:= $(SRCDIR
)/solenv
/sanitizers
/ui
/$(1).suppr
185 $(call gb_UIConfig_get_a11yerrors_target
,$(1)) : UI_A11YFALSE
:= $(SRCDIR
)/solenv
/sanitizers
/ui
/$(1).false
186 $(call gb_UIConfig_get_target
,$(1)) : $(call gb_PackageSet_get_target
,$(call gb_UIConfig_get_packagesetname
,$(1)))
187 $(call gb_UIConfig_get_clean_target
,$(1)) : $(call gb_PackageSet_get_clean_target
,$(call gb_UIConfig_get_packagesetname
,$(1)))
189 $$(eval
$$(call gb_Module_register_target
,$(call gb_UIConfig_get_target
,$(1)),$(call gb_UIConfig_get_clean_target
,$(1))))
190 $(call gb_Helper_make_userfriendly_targets
,$(1),UIConfig
)
191 $(call gb_Postprocess_register_target
,AllUIConfigs
,UIConfig
,$(1))
195 # gb_UIConfig__package_file target package type destfile srcfile
196 define gb_UIConfig__package_file
197 $(call gb_Package_add_file
,$(2),$(gb_UIConfig_INSTDIR
)/$(1)/$(3)/$(4),$(5))
201 # gb_UIConfig__package_uifile target package destfile srcfile
202 define gb_UIConfig__package_uifile
203 $(call gb_UIConfig__package_file
,$(1),$(2),ui
,$(3),$(4))
207 define gb_UIConfig_add_a11yerrors_uifile
208 $(call gb_UIConfig_get_a11yerrors_target
,$(1)) : UIFILES
+= $(SRCDIR
)/$(2).ui
209 $(call gb_UIConfig_get_a11yerrors_target
,$(1)) : $(SRCDIR
)/$(2).ui
213 # gb_UIConfig__add_uifile target file
214 define gb_UIConfig__add_uifile
215 $(call gb_UIConfig__package_uifile
,$(1),$(call gb_UIConfig_get_packagename
,$(1)),$(notdir $(2)).ui
,$(2).ui
)
216 $(call gb_UIImageListTarget_UIImageListTarget
,$(2))
218 $(call gb_UIConfig_get_imagelist_target
,$(1)) : UI_IMAGELISTS
+= $(call gb_UIImageListTarget_get_target
,$(2))
219 $(call gb_UIConfig_get_imagelist_target
,$(1)) : $(call gb_UIImageListTarget_get_target
,$(2))
220 $(call gb_UIConfig_get_clean_target
,$(1)) : $(call gb_UIImageListTarget_get_clean_target
,$(2))
222 $(call gb_UIConfig_add_a11yerrors_uifile
,$(1),$(2))
226 gb_UIConfig_ALLFILES
:=
227 # Adds .ui file to the package
229 # The file is relative to $(SRCDIR) and without extension.
231 # gb_UIConfig_add_uifile target uifile
232 define gb_UIConfig_add_uifile
233 gb_UIConfig_ALLFILES
+=$(1):$(notdir $(2))
234 $(call gb_UIConfig__add_uifile
,$(1),$(2))
238 # Adds multiple .ui files to the package
240 # gb_UIConfig_add_uifiles target uifile(s)
241 define gb_UIConfig_add_uifiles
242 $(foreach uifile
,$(2),$(call gb_UIConfig_add_uifile
,$(1),$(uifile
)))
246 # gb_UIConfig_add_uifiles target uifile(s) but only for running gla11y
247 define gb_UIConfig_add_a11yerrors_uifiles
248 $(foreach uifile
,$(2),$(call gb_UIConfig_add_a11yerrors_uifile
,$(1),$(uifile
)))
252 # gb_UIConfig__add_xmlfile target package-target type xmlfile
253 define gb_UIConfig__add_xmlfile
254 $(call gb_UIConfig__package_file
,$(1),$(call gb_UIConfig_get_packagename
,$(2)),$(3),$(notdir $(4)).xml
,$(4).xml
)
258 define gb_UIConfig__add_menubarfile
259 $(call gb_UIMenubarTarget_UIMenubarTarget
,$(2),$(3))
260 $(call gb_Package_add_file
,$(call gb_UIConfig_get_packagename
,$(1)_generated
),$(gb_UIConfig_INSTDIR
)/$(1)/menubar
/$(notdir $(2)).xml
,$(subst $(WORKDIR
)/,,$(call gb_UIMenubarTarget_get_target
,$(2))))
261 $(call gb_PackageSet_add_package
,$(call gb_UIConfig_get_packagesetname
,$(1)),$(call gb_UIConfig_get_packagename
,$(1)_generated
))
263 $(call gb_Package_get_target
,$(call gb_UIConfig_get_packagename
,$(1)_generated
)) : $(call gb_UIMenubarTarget_get_target
,$(2))
264 $(call gb_Package_get_clean_target
,$(call gb_UIConfig_get_packagename
,$(1)_generated
)) : $(call gb_UIMenubarTarget_get_clean_target
,$(2))
268 # Add menubar config file to the package.
270 # The file is relative to $(SRCDIR) and without extension.
272 # gb_UIConfig_add_menubarfile target file
273 define gb_UIConfig_add_menubarfile
274 $(call gb_UIConfig__add_menubarfile
,$(1),$(gb_UIConfig_INSTDIR
)/$(1)/menubar
/$(notdir $(2)),$(SRCDIR
)/$(2).xml
)
278 # Adds multiple menubar config files to the package.
280 # gb_UIConfig_add_menubarfiles target file(s)
281 define gb_UIConfig_add_menubarfiles
282 $(foreach menubarfile
,$(2),$(call gb_UIConfig_add_menubarfile
,$(1),$(menubarfile
)))
286 # Add a generated menubar config file to the package.
288 # The file is relative to $(WORKDIR) and without extension.
290 # gb_UIConfig_add_generated_menubarfile target file
291 define gb_UIConfig_add_generated_menubarfile
292 $(call gb_UIConfig__add_menubarfile
,$(1),$(gb_UIConfig_INSTDIR
)/$(1)/menubar
/$(notdir $(2)),$(WORKDIR
)/$(2).xml
)
296 # Adds multiple menubar config files to the package.
298 # gb_UIConfig_add_generated_menubarfiles target file(s)
299 define gb_UIConfig_add_generated_menubarfiles
300 $(foreach menubarfile
,$(2),$(call gb_UIConfig_add_generated_menubarfile
,$(1),$(menubarfile
)))
304 # Add statusbar config file to the package.
306 # The file is relative to $(SRCDIR) and without extension.
308 # gb_UIConfig_add_statusbarfile target file
309 define gb_UIConfig_add_statusbarfile
310 $(call gb_UIConfig__add_xmlfile
,$(1),$(1),statusbar
,$(2))
314 # Adds multiple statusbar config files to the package.
316 # gb_UIConfig_add_statusbarfiles target file(s)
317 define gb_UIConfig_add_statusbarfiles
318 $(foreach statusbarfile
,$(2),$(call gb_UIConfig_add_statusbarfile
,$(1),$(statusbarfile
)))
322 # Add toolbar config file to the package.
324 # The file is relative to $(SRCDIR) and without extension.
326 # gb_UIConfig_add_toolbarfile target file
327 define gb_UIConfig_add_toolbarfile
328 $(call gb_UIConfig__add_xmlfile
,$(1),$(1),toolbar
,$(2))
332 # Adds multiple toolbar config files to the package.
334 # gb_UIConfig_add_toolbarfiles target file(s)
335 define gb_UIConfig_add_toolbarfiles
336 $(foreach toolbarfile
,$(2),$(call gb_UIConfig_add_toolbarfile
,$(1),$(toolbarfile
)))
340 # Add popupmenu config file to the package.
342 # The file is relative to $(SRCDIR) and without extension.
344 # gb_UIConfig_add_popupmenufile target file
345 define gb_UIConfig_add_popupmenufile
346 $(call gb_UIConfig__add_xmlfile
,$(1),$(1),popupmenu
,$(2))
350 # Adds multiple popupmenu config files to the package.
352 # gb_UIConfig_add_popupmenufiles target file(s)
353 define gb_UIConfig_add_popupmenufiles
354 $(foreach popupmenufile
,$(2),$(call gb_UIConfig_add_popupmenufile
,$(1),$(popupmenufile
)))
358 # vim: set noet sw=4 ts=4: