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_Output_announce
,$(2),$(true
),UIL
,1)
55 $(call gb_Helper_abbreviate_dirs
,\
56 $(gb_UIImageListTarget_COMMAND
) --nonet
-o
$@
$(gb_UIImageListTarget_XSLTFILE
) $(UIFILE
) && \
61 $(dir $(call gb_UIImageListTarget_get_target
,%)).
dir :
62 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
64 $(dir $(call gb_UIImageListTarget_get_target
,%))%/.
dir :
65 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
67 $(call gb_UIImageListTarget_get_target
,%) : $(gb_UIImageListTarget_DEPS
) $(gb_UIImageListTarget_XSLTFILE
)
68 $(call gb_UIImageListTarget__command
,$@
,$*)
70 .PHONY
: $(call gb_UIImageListTarget_get_clean_target
,%)
71 $(call gb_UIImageListTarget_get_clean_target
,%) :
72 $(call gb_Output_announce
,$*,$(false
),UIL
,1)
73 rm -f
$(call gb_UIImageListTarget_get_target
,$*)
75 # Extract list of images referenced in a .ui file.
77 # gb_UIImageListTarget_UIImageListTarget uifile
78 define gb_UIImageListTarget_UIImageListTarget
79 $(call gb_UIImageListTarget_get_target
,$(1)) : UIFILE
:= $(SRCDIR
)/$(1).ui
81 $(call gb_UIImageListTarget_get_target
,$(1)) : $(SRCDIR
)/$(1).ui
82 $(call gb_UIImageListTarget_get_target
,$(1)) :|
$(dir $(call gb_UIImageListTarget_get_target
,$(1))).
dir
88 # Handles UI configuration files.
90 # This mostly means UI description files (suffix .ui) for the new layouting
93 # This class provides the following filelists:
94 # * UIConfig/<name> containing all nontranslatable files
96 gb_UIConfig_INSTDIR
:= $(LIBO_SHARE_FOLDER
)/config
/soffice.cfg
98 ifneq ($(filter LXML
,$(BUILD_TYPE
)),)
99 gb_UIConfig_LXML_PATH
:= PYPATH
=$${PYPATH
:+$$PYPATH:}$(call gb_UnpackedTarball_get_dir
,lxml
)/install ;
100 gb_UIConfig_LXML_TARGET
:= $(call gb_ExternalProject_get_target
,lxml
)
102 gb_UIConfig_gla11y_SCRIPT
:= $(SRCDIR
)/bin
/gla11y
104 $(dir $(call gb_UIConfig_get_target
,%)).
dir :
105 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
107 $(dir $(call gb_UIConfig_get_target
,%))%/.
dir :
108 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
110 $(call gb_UIConfig_get_target
,%) : $(call gb_UIConfig_get_imagelist_target
,%) $(call gb_UIConfig_get_a11yerrors_target
,%)
111 $(call gb_Output_announce
,$*,$(true
),UIC
,2)
112 $(call gb_Helper_abbreviate_dirs
,\
116 $(call gb_UIConfig_get_imagelist_target
,%) :
117 $(call gb_UIConfig__command
)
119 .PHONY
: $(call gb_UIConfig_get_clean_target
,%)
120 $(call gb_UIConfig_get_clean_target
,%) :
121 $(call gb_Output_announce
,$*,$(false
),UIC
,2)
122 $(call gb_Helper_abbreviate_dirs
,\
123 rm -f
$(call gb_UIConfig_get_target
,$*) $(call gb_UIConfig_get_imagelist_target
,$*) \
125 $(call gb_Output_announce
,$*,$(false
),UIA
,2)
126 rm -f
$(call gb_UIConfig_get_a11yerrors_target
,$*)
128 gb_UIConfig_gla11y_PARAMETERS
= -P
$(SRCDIR
)/ -f
$(UI_A11YFALSE
)
130 # Disable this to see suppressed warnings
132 gb_UIConfig_gla11y_PARAMETERS
+= -s
$(UI_A11YSUPPRS
)
134 # Enable this to regenerate suppression files
136 gb_UIConfig_gla11y_PARAMETERS
+= -g
$(UI_A11YSUPPRS
)
139 # Tell gla11y about LO-specific widgets
140 # These are storage, containers, or preview
141 gb_UIConfig_gla11y_PARAMETERS
+= --widgets-suffixignored
+ValueSet
,HBox
,VBox
,ToolBox
,Preview
,PreviewWin
,PreviewWindow
,PrevWindow
142 # These are buttons, thus already contain their label (but an image is not enough)
143 gb_UIConfig_gla11y_PARAMETERS
+= --widgets-button
+chartcontrollerlo-LightButton
,svtlo-ManagedMenuButton
145 # All new warnings should be fatal except a few kinds which could be only doubtful
146 gb_UIConfig_gla11y_PARAMETERS
+= --fatal-all
--not-fatal-type duplicate-mnemonic
--not-fatal-type labelled-by-and-mnemonic
--not-fatal-type orphan-label
148 define gb_UIConfig_a11yerrors__command
149 $(call gb_Output_announce
,$(2),$(true
),UIA
,1)
150 $(call gb_UIConfig__gla11y_command
)
153 $(call gb_UIConfig_get_a11yerrors_target
,%) : $(gb_UIConfig_LXML_TARGET
) $(call gb_ExternalExecutable_get_dependencies
,python
) $(gb_UIConfig_gla11y_SCRIPT
)
154 $(call gb_UIConfig_a11yerrors__command
,$@
,$*)
156 gb_UIConfig_get_packagename
= UIConfig
/$(1)
157 gb_UIConfig_get_packagesetname
= UIConfig
/$(1)
159 # Processes and delivers a set of UI configuration files.
161 # gb_UIConfig_UIConfig modulename
162 define gb_UIConfig_UIConfig
163 ifeq (,$$(filter $(1),$$(gb_UIConfig_REGISTERED
)))
164 $$(eval
$$(call gb_Output_info
,Currently known UI configs are
: $(sort $(gb_UIConfig_REGISTERED
)),ALL
))
165 $$(eval
$$(call gb_Output_error
,UIConfig
$(1) must be registered in Repository.mk
))
167 $(call gb_UIConfig_get_imagelist_target
,$(1)) : UI_IMAGELISTS
:=
169 $(call gb_PackageSet_PackageSet_internal
,$(call gb_UIConfig_get_packagesetname
,$(1)))
170 $(call gb_Package_Package_internal
,$(call gb_UIConfig_get_packagename
,$(1)),$(SRCDIR
))
171 $(call gb_Package_Package_internal
,$(call gb_UIConfig_get_packagename
,$(1)_generated
),$(WORKDIR
))
173 $(call gb_PackageSet_add_package
,$(call gb_UIConfig_get_packagesetname
,$(1)),$(call gb_UIConfig_get_packagename
,$(1)))
175 $(call gb_UIConfig_get_target
,$(1)) :|
$(dir $(call gb_UIConfig_get_target
,$(1))).
dir
176 $(call gb_UIConfig_get_imagelist_target
,$(1)) :|
$(dir $(call gb_UIConfig_get_imagelist_target
,$(1))).
dir
177 $(call gb_UIConfig_get_a11yerrors_target
,$(1)) :|
$(dir $(call gb_UIConfig_get_a11yerrors_target
,$(1))).
dir
178 $(call gb_UIConfig_get_a11yerrors_target
,$(1)) : UI_A11YSUPPRS
:= $(SRCDIR
)/solenv
/sanitizers
/ui
/$(1).suppr
179 $(call gb_UIConfig_get_a11yerrors_target
,$(1)) : UI_A11YFALSE
:= $(SRCDIR
)/solenv
/sanitizers
/ui
/$(1).false
180 $(call gb_UIConfig_get_target
,$(1)) : $(call gb_PackageSet_get_target
,$(call gb_UIConfig_get_packagesetname
,$(1)))
181 $(call gb_UIConfig_get_clean_target
,$(1)) : $(call gb_PackageSet_get_clean_target
,$(call gb_UIConfig_get_packagesetname
,$(1)))
183 $$(eval
$$(call gb_Module_register_target
,$(call gb_UIConfig_get_target
,$(1)),$(call gb_UIConfig_get_clean_target
,$(1))))
184 $(call gb_Helper_make_userfriendly_targets
,$(1),UIConfig
)
185 $(call gb_Postprocess_register_target
,AllUIConfigs
,UIConfig
,$(1))
189 # gb_UIConfig__package_file target package type destfile srcfile
190 define gb_UIConfig__package_file
191 $(call gb_Package_add_file
,$(2),$(gb_UIConfig_INSTDIR
)/$(1)/$(3)/$(4),$(5))
195 # gb_UIConfig__package_uifile target package destfile srcfile
196 define gb_UIConfig__package_uifile
197 $(call gb_UIConfig__package_file
,$(1),$(2),ui
,$(3),$(4))
201 define gb_UIConfig_add_a11yerrors_uifile
202 $(call gb_UIConfig_get_a11yerrors_target
,$(1)) : UIFILES
+= $(SRCDIR
)/$(2).ui
203 $(call gb_UIConfig_get_a11yerrors_target
,$(1)) : $(SRCDIR
)/$(2).ui
207 # gb_UIConfig__add_uifile target file
208 define gb_UIConfig__add_uifile
209 $(call gb_UIConfig__package_uifile
,$(1),$(call gb_UIConfig_get_packagename
,$(1)),$(notdir $(2)).ui
,$(2).ui
)
210 $(call gb_UIImageListTarget_UIImageListTarget
,$(2))
212 $(call gb_UIConfig_get_imagelist_target
,$(1)) : UI_IMAGELISTS
+= $(call gb_UIImageListTarget_get_target
,$(2))
213 $(call gb_UIConfig_get_imagelist_target
,$(1)) : $(call gb_UIImageListTarget_get_target
,$(2))
214 $(call gb_UIConfig_get_clean_target
,$(1)) : $(call gb_UIImageListTarget_get_clean_target
,$(2))
216 $(call gb_UIConfig_add_a11yerrors_uifile
,$(1),$(2))
220 gb_UIConfig_ALLFILES
:=
221 # Adds .ui file to the package
223 # The file is relative to $(SRCDIR) and without extension.
225 # gb_UIConfig_add_uifile target uifile
226 define gb_UIConfig_add_uifile
227 gb_UIConfig_ALLFILES
+=$(1):$(notdir $(2))
228 $(call gb_UIConfig__add_uifile
,$(1),$(2))
232 # Adds multiple .ui files to the package
234 # gb_UIConfig_add_uifiles target uifile(s)
235 define gb_UIConfig_add_uifiles
236 $(foreach uifile
,$(2),$(call gb_UIConfig_add_uifile
,$(1),$(uifile
)))
240 # gb_UIConfig_add_uifiles target uifile(s) but only for running gla11y
241 define gb_UIConfig_add_a11yerrors_uifiles
242 $(foreach uifile
,$(2),$(call gb_UIConfig_add_a11yerrors_uifile
,$(1),$(uifile
)))
246 # gb_UIConfig__add_xmlfile target package-target type xmlfile
247 define gb_UIConfig__add_xmlfile
248 $(call gb_UIConfig__package_file
,$(1),$(call gb_UIConfig_get_packagename
,$(2)),$(3),$(notdir $(4)).xml
,$(4).xml
)
252 define gb_UIConfig__add_menubarfile
253 $(call gb_UIMenubarTarget_UIMenubarTarget
,$(2),$(3))
254 $(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))))
255 $(call gb_PackageSet_add_package
,$(call gb_UIConfig_get_packagesetname
,$(1)),$(call gb_UIConfig_get_packagename
,$(1)_generated
))
257 $(call gb_Package_get_target
,$(call gb_UIConfig_get_packagename
,$(1)_generated
)) : $(call gb_UIMenubarTarget_get_target
,$(2))
258 $(call gb_Package_get_clean_target
,$(call gb_UIConfig_get_packagename
,$(1)_generated
)) : $(call gb_UIMenubarTarget_get_clean_target
,$(2))
262 # Add menubar config file to the package.
264 # The file is relative to $(SRCDIR) and without extension.
266 # gb_UIConfig_add_menubarfile target file
267 define gb_UIConfig_add_menubarfile
268 $(call gb_UIConfig__add_menubarfile
,$(1),$(gb_UIConfig_INSTDIR
)/$(1)/menubar
/$(notdir $(2)),$(SRCDIR
)/$(2).xml
)
272 # Adds multiple menubar config files to the package.
274 # gb_UIConfig_add_menubarfiles target file(s)
275 define gb_UIConfig_add_menubarfiles
276 $(foreach menubarfile
,$(2),$(call gb_UIConfig_add_menubarfile
,$(1),$(menubarfile
)))
280 # Add a generated menubar config file to the package.
282 # The file is relative to $(WORKDIR) and without extension.
284 # gb_UIConfig_add_generated_menubarfile target file
285 define gb_UIConfig_add_generated_menubarfile
286 $(call gb_UIConfig__add_menubarfile
,$(1),$(gb_UIConfig_INSTDIR
)/$(1)/menubar
/$(notdir $(2)),$(WORKDIR
)/$(2).xml
)
290 # Adds multiple menubar config files to the package.
292 # gb_UIConfig_add_generated_menubarfiles target file(s)
293 define gb_UIConfig_add_generated_menubarfiles
294 $(foreach menubarfile
,$(2),$(call gb_UIConfig_add_generated_menubarfile
,$(1),$(menubarfile
)))
298 # Add statusbar config file to the package.
300 # The file is relative to $(SRCDIR) and without extension.
302 # gb_UIConfig_add_statusbarfile target file
303 define gb_UIConfig_add_statusbarfile
304 $(call gb_UIConfig__add_xmlfile
,$(1),$(1),statusbar
,$(2))
308 # Adds multiple statusbar config files to the package.
310 # gb_UIConfig_add_statusbarfiles target file(s)
311 define gb_UIConfig_add_statusbarfiles
312 $(foreach statusbarfile
,$(2),$(call gb_UIConfig_add_statusbarfile
,$(1),$(statusbarfile
)))
316 # Add toolbar config file to the package.
318 # The file is relative to $(SRCDIR) and without extension.
320 # gb_UIConfig_add_toolbarfile target file
321 define gb_UIConfig_add_toolbarfile
322 $(call gb_UIConfig__add_xmlfile
,$(1),$(1),toolbar
,$(2))
326 # Adds multiple toolbar config files to the package.
328 # gb_UIConfig_add_toolbarfiles target file(s)
329 define gb_UIConfig_add_toolbarfiles
330 $(foreach toolbarfile
,$(2),$(call gb_UIConfig_add_toolbarfile
,$(1),$(toolbarfile
)))
334 # Add popupmenu config file to the package.
336 # The file is relative to $(SRCDIR) and without extension.
338 # gb_UIConfig_add_popupmenufile target file
339 define gb_UIConfig_add_popupmenufile
340 $(call gb_UIConfig__add_xmlfile
,$(1),$(1),popupmenu
,$(2))
344 # Adds multiple popupmenu config files to the package.
346 # gb_UIConfig_add_popupmenufiles target file(s)
347 define gb_UIConfig_add_popupmenufiles
348 $(foreach popupmenufile
,$(2),$(call gb_UIConfig_add_popupmenufile
,$(1),$(popupmenufile
)))
352 # vim: set noet sw=4 ts=4: