lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / solenv / gbuild / UIConfig.mk
blob08922c5c955a01b43da9865478a3f313b6e5a635
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))
41 endef
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) && \
57 touch $@ \
59 endef
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
84 endef
86 # class UIConfig
88 # Handles UI configuration files.
90 # This mostly means UI description files (suffix .ui) for the new layouting
91 # mechanism.
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)
101 endif
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,\
113 touch $@ \
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
131 ifeq (1,1)
132 gb_UIConfig_gla11y_PARAMETERS += -s $(UI_A11YSUPPRS)
133 endif
134 # Enable this to regenerate suppression files
135 ifeq (1,0)
136 gb_UIConfig_gla11y_PARAMETERS += -g $(UI_A11YSUPPRS)
137 endif
139 # Tell gla11y about LO-specific widgets
140 # These are already automatically labelled Shrink/Expand
141 gb_UIConfig_gla11y_PARAMETERS += --widgets-ignored +foruilo-RefButton
142 # These, however, do need a label like a GtkEntry
143 gb_UIConfig_gla11y_PARAMETERS += --widgets-needlabel +foruilo-RefEdit
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 +vcllo-SmallButton,cuilo-RubyRadioButton,chartcontrollerlo-LightButton,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_Output_announce,$(2),$(true),UIA,1)
154 $(call gb_UIConfig__gla11y_command)
155 endef
157 $(call gb_UIConfig_get_a11yerrors_target,%) : $(gb_UIConfig_LXML_TARGET) $(call gb_ExternalExecutable_get_dependencies,python) $(gb_UIConfig_gla11y_SCRIPT)
158 $(call gb_UIConfig_a11yerrors__command,$@,$*)
160 gb_UIConfig_get_packagename = UIConfig/$(1)
161 gb_UIConfig_get_packagesetname = UIConfig/$(1)
163 # Processes and delivers a set of UI configuration files.
165 # gb_UIConfig_UIConfig modulename
166 define gb_UIConfig_UIConfig
167 ifeq (,$$(filter $(1),$$(gb_UIConfig_REGISTERED)))
168 $$(eval $$(call gb_Output_info,Currently known UI configs are: $(sort $(gb_UIConfig_REGISTERED)),ALL))
169 $$(eval $$(call gb_Output_error,UIConfig $(1) must be registered in Repository.mk))
170 endif
171 $(call gb_UIConfig_get_imagelist_target,$(1)) : UI_IMAGELISTS :=
173 $(call gb_PackageSet_PackageSet_internal,$(call gb_UIConfig_get_packagesetname,$(1)))
174 $(call gb_Package_Package_internal,$(call gb_UIConfig_get_packagename,$(1)),$(SRCDIR))
175 $(call gb_Package_Package_internal,$(call gb_UIConfig_get_packagename,$(1)_generated),$(WORKDIR))
177 $(call gb_PackageSet_add_package,$(call gb_UIConfig_get_packagesetname,$(1)),$(call gb_UIConfig_get_packagename,$(1)))
179 $(call gb_UIConfig_get_target,$(1)) :| $(dir $(call gb_UIConfig_get_target,$(1))).dir
180 $(call gb_UIConfig_get_imagelist_target,$(1)) :| $(dir $(call gb_UIConfig_get_imagelist_target,$(1))).dir
181 $(call gb_UIConfig_get_a11yerrors_target,$(1)) :| $(dir $(call gb_UIConfig_get_a11yerrors_target,$(1))).dir
182 $(call gb_UIConfig_get_a11yerrors_target,$(1)) : UI_A11YSUPPRS := $(SRCDIR)/solenv/sanitizers/ui/$(1).suppr
183 $(call gb_UIConfig_get_a11yerrors_target,$(1)) : UI_A11YFALSE := $(SRCDIR)/solenv/sanitizers/ui/$(1).false
184 $(call gb_UIConfig_get_target,$(1)) : $(call gb_PackageSet_get_target,$(call gb_UIConfig_get_packagesetname,$(1)))
185 $(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_PackageSet_get_clean_target,$(call gb_UIConfig_get_packagesetname,$(1)))
187 $$(eval $$(call gb_Module_register_target,$(call gb_UIConfig_get_target,$(1)),$(call gb_UIConfig_get_clean_target,$(1))))
188 $(call gb_Helper_make_userfriendly_targets,$(1),UIConfig)
189 $(call gb_Postprocess_register_target,AllUIConfigs,UIConfig,$(1))
191 endef
193 # gb_UIConfig__package_file target package type destfile srcfile
194 define gb_UIConfig__package_file
195 $(call gb_Package_add_file,$(2),$(gb_UIConfig_INSTDIR)/$(1)/$(3)/$(4),$(5))
197 endef
199 # gb_UIConfig__package_uifile target package destfile srcfile
200 define gb_UIConfig__package_uifile
201 $(call gb_UIConfig__package_file,$(1),$(2),ui,$(3),$(4))
203 endef
205 define gb_UIConfig_add_a11yerrors_uifile
206 $(call gb_UIConfig_get_a11yerrors_target,$(1)) : UIFILES += $(SRCDIR)/$(2).ui
207 $(call gb_UIConfig_get_a11yerrors_target,$(1)) : $(SRCDIR)/$(2).ui
209 endef
211 # gb_UIConfig__add_uifile target file
212 define gb_UIConfig__add_uifile
213 $(call gb_UIConfig__package_uifile,$(1),$(call gb_UIConfig_get_packagename,$(1)),$(notdir $(2)).ui,$(2).ui)
214 $(call gb_UIImageListTarget_UIImageListTarget,$(2))
216 $(call gb_UIConfig_get_imagelist_target,$(1)) : UI_IMAGELISTS += $(call gb_UIImageListTarget_get_target,$(2))
217 $(call gb_UIConfig_get_imagelist_target,$(1)) : $(call gb_UIImageListTarget_get_target,$(2))
218 $(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_UIImageListTarget_get_clean_target,$(2))
220 $(call gb_UIConfig_add_a11yerrors_uifile,$(1),$(2))
222 endef
224 gb_UIConfig_ALLFILES:=
225 # Adds .ui file to the package
227 # The file is relative to $(SRCDIR) and without extension.
229 # gb_UIConfig_add_uifile target uifile
230 define gb_UIConfig_add_uifile
231 gb_UIConfig_ALLFILES+=$(1):$(notdir $(2))
232 $(call gb_UIConfig__add_uifile,$(1),$(2))
234 endef
236 # Adds multiple .ui files to the package
238 # gb_UIConfig_add_uifiles target uifile(s)
239 define gb_UIConfig_add_uifiles
240 $(foreach uifile,$(2),$(call gb_UIConfig_add_uifile,$(1),$(uifile)))
242 endef
244 # gb_UIConfig_add_uifiles target uifile(s) but only for running gla11y
245 define gb_UIConfig_add_a11yerrors_uifiles
246 $(foreach uifile,$(2),$(call gb_UIConfig_add_a11yerrors_uifile,$(1),$(uifile)))
248 endef
250 # gb_UIConfig__add_xmlfile target package-target type xmlfile
251 define gb_UIConfig__add_xmlfile
252 $(call gb_UIConfig__package_file,$(1),$(call gb_UIConfig_get_packagename,$(2)),$(3),$(notdir $(4)).xml,$(4).xml)
254 endef
256 define gb_UIConfig__add_menubarfile
257 $(call gb_UIMenubarTarget_UIMenubarTarget,$(2),$(3))
258 $(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))))
259 $(call gb_PackageSet_add_package,$(call gb_UIConfig_get_packagesetname,$(1)),$(call gb_UIConfig_get_packagename,$(1)_generated))
261 $(call gb_Package_get_target,$(call gb_UIConfig_get_packagename,$(1)_generated)) : $(call gb_UIMenubarTarget_get_target,$(2))
262 $(call gb_Package_get_clean_target,$(call gb_UIConfig_get_packagename,$(1)_generated)) : $(call gb_UIMenubarTarget_get_clean_target,$(2))
264 endef
266 # Add menubar config file to the package.
268 # The file is relative to $(SRCDIR) and without extension.
270 # gb_UIConfig_add_menubarfile target file
271 define gb_UIConfig_add_menubarfile
272 $(call gb_UIConfig__add_menubarfile,$(1),$(gb_UIConfig_INSTDIR)/$(1)/menubar/$(notdir $(2)),$(SRCDIR)/$(2).xml)
274 endef
276 # Adds multiple menubar config files to the package.
278 # gb_UIConfig_add_menubarfiles target file(s)
279 define gb_UIConfig_add_menubarfiles
280 $(foreach menubarfile,$(2),$(call gb_UIConfig_add_menubarfile,$(1),$(menubarfile)))
282 endef
284 # Add a generated menubar config file to the package.
286 # The file is relative to $(WORKDIR) and without extension.
288 # gb_UIConfig_add_generated_menubarfile target file
289 define gb_UIConfig_add_generated_menubarfile
290 $(call gb_UIConfig__add_menubarfile,$(1),$(gb_UIConfig_INSTDIR)/$(1)/menubar/$(notdir $(2)),$(WORKDIR)/$(2).xml)
292 endef
294 # Adds multiple menubar config files to the package.
296 # gb_UIConfig_add_generated_menubarfiles target file(s)
297 define gb_UIConfig_add_generated_menubarfiles
298 $(foreach menubarfile,$(2),$(call gb_UIConfig_add_generated_menubarfile,$(1),$(menubarfile)))
300 endef
302 # Add statusbar config file to the package.
304 # The file is relative to $(SRCDIR) and without extension.
306 # gb_UIConfig_add_statusbarfile target file
307 define gb_UIConfig_add_statusbarfile
308 $(call gb_UIConfig__add_xmlfile,$(1),$(1),statusbar,$(2))
310 endef
312 # Adds multiple statusbar config files to the package.
314 # gb_UIConfig_add_statusbarfiles target file(s)
315 define gb_UIConfig_add_statusbarfiles
316 $(foreach statusbarfile,$(2),$(call gb_UIConfig_add_statusbarfile,$(1),$(statusbarfile)))
318 endef
320 # Add toolbar config file to the package.
322 # The file is relative to $(SRCDIR) and without extension.
324 # gb_UIConfig_add_toolbarfile target file
325 define gb_UIConfig_add_toolbarfile
326 $(call gb_UIConfig__add_xmlfile,$(1),$(1),toolbar,$(2))
328 endef
330 # Adds multiple toolbar config files to the package.
332 # gb_UIConfig_add_toolbarfiles target file(s)
333 define gb_UIConfig_add_toolbarfiles
334 $(foreach toolbarfile,$(2),$(call gb_UIConfig_add_toolbarfile,$(1),$(toolbarfile)))
336 endef
338 # Add popupmenu config file to the package.
340 # The file is relative to $(SRCDIR) and without extension.
342 # gb_UIConfig_add_popupmenufile target file
343 define gb_UIConfig_add_popupmenufile
344 $(call gb_UIConfig__add_xmlfile,$(1),$(1),popupmenu,$(2))
346 endef
348 # Adds multiple popupmenu config files to the package.
350 # gb_UIConfig_add_popupmenufiles target file(s)
351 define gb_UIConfig_add_popupmenufiles
352 $(foreach popupmenufile,$(2),$(call gb_UIConfig_add_popupmenufile,$(1),$(popupmenufile)))
354 endef
356 # vim: set noet sw=4 ts=4: