Use MsLangId::getConfiguredSystemUILanguage()
[LibreOffice.git] / solenv / gbuild / UnoApiTarget.mk
blobbc364ad9ae3404a64174a2f257ac37d4b091d037
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/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 # UnoApiTarget
22 gb_UnoApiTarget_UNOIDLWRITEDEPS := $(call gb_Executable_get_runtime_dependencies,unoidl-write)
23 gb_UnoApiTarget_UNOIDLWRITECOMMAND := $(call gb_Executable_get_command,unoidl-write)
25 gb_UnoApiTarget_UNOIDLCHECKDEPS := $(call gb_Executable_get_runtime_dependencies,unoidl-check)
26 gb_UnoApiTarget_UNOIDLCHECKCOMMAND := $(call gb_Executable_get_command,unoidl-check)
28 define gb_UnoApiTarget__command
29 mkdir -p $(dir $(1)) \
30 $(if $(UNOAPI_ENTITIES), \
31 && RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),500,$(UNOAPI_ENTITIES))) \
32 && $(gb_UnoApiTarget_UNOIDLWRITECOMMAND) \
33 $(foreach rdb,$(UNOAPI_DEPRDBS),$(call gb_UnoApiTarget_get_target,$(rdb))) \
34 $(SRCDIR)/$(gb_UnoApiTarget_REG_$(2)) $(if $(UNOAPI_ENTITIES),@$${RESPONSEFILE}) $(1) \
35 $(if $(UNOAPI_ENTITIES),&& rm -f $${RESPONSEFILE}) \
36 $(if $(UNOAPI_REFERENCE), \
37 $(call gb_Output_announce,$(2),$(true),DBc,3) \
38 && $(gb_UnoApiTarget_UNOIDLCHECKCOMMAND) $(UNOAPI_REFERENCE) -- \
39 $(foreach rdb,$(UNOAPI_DEPRDBS),$(call gb_UnoApiTarget_get_target,$(rdb))) \
40 $(1))
41 endef
43 $(call gb_UnoApiTarget_get_target,%) :
44 $(call gb_Output_announce,$*,$(true),UNO,4)
45 $(call gb_Trace_StartRange,$*,UNO)
46 $(call gb_UnoApiTarget__command,$@,$*)
47 $(call gb_Trace_EndRange,$*,UNO)
49 .PHONY : $(call gb_UnoApiTarget_get_clean_target,%)
50 $(call gb_UnoApiTarget_get_clean_target,%) :
51 $(call gb_Output_announce,$*,$(false),UNO,4)
52 -$(call gb_Helper_abbreviate_dirs,\
53 rm -rf $(call gb_UnoApiTarget_get_target,$*))
55 define gb_UnoApiTarget_UnoApiTarget
56 gb_UnoApiTarget_REG_$(1) := $(2)
57 $(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_ENTITIES :=
58 $(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_REFERENCE :=
59 $(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_DEPRDBS :=
60 $(call gb_UnoApiTarget_get_target,$(1)) : $(gb_UnoApiTarget_UNOIDLWRITEDEPS)
61 $(call gb_UnoApiTarget_get_target,$(1)) : $(SRCDIR)/$(2) # may be dir, though
63 endef
65 define gb_UnoApiTarget_add_idlfile
66 $(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_ENTITIES += $(subst /,.,$(2))$(if $(2),.)$(3)
67 $(call gb_UnoApiTarget_get_target,$(1)) : $(SRCDIR)/$(gb_UnoApiTarget_REG_$(1))/$(2)/$(3).idl
69 endef
71 define gb_UnoApiTarget_add_idlfiles
72 $(foreach idl,$(3),$(call gb_UnoApiTarget_add_idlfile,$(1),$(2),$(idl)))
74 endef
76 define gb_UnoApiTarget_set_reference_rdbfile
77 $(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_REFERENCE := $(2)
78 $(call gb_UnoApiTarget_get_target,$(1)) : $(2)
79 $(call gb_UnoApiTarget_get_target,$(1)) : $(gb_UnoApiTarget_UNOIDLCHECKDEPS)
81 endef
83 define gb_UnoApiTarget_use_api
84 $(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_DEPRDBS += $(2)
85 $(call gb_UnoApiTarget_get_target,$(1)) : $(call gb_UnoApiTarget_get_target,$(2))
87 endef
89 # UnoApiHeadersTarget
91 # defined by platform
92 # gb_UnoApiHeadersTarget_select_variant
94 # Allow to redefine header variant.
96 # On iOS we use static linking because dynamic loading of own code
97 # isn't allowed by the iOS App Store rules, and we want our code to be
98 # eventually distributable there as part of apps.
100 # To avoid problems that this causes together with the lovely
101 # intentional breaking of the One Definition Rule, for iOS we always
102 # generate comprehensive headers for certain type RDBS. (The ODR
103 # breakage doesn't harm, by accident or careful design, on platforms
104 # where shared libraries are used.) To avoid generating the same headers
105 # more than once, we are silently "redirecting" the target to point to
106 # comprehensive headers instead.
108 # Example:
109 # If gb_UnoApiHeadersTarget_select_variant is defined as
111 # ifeq ($(DISABLE_DYNLOADING),TRUE)
112 # gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2))
113 # else
114 # gb_UnoApiHeadersTarget_select_variant = $(2)
115 # endif
117 # then, for the DISABLE_DYNLOADING case, whenever a makefile uses
118 # $(call gb_UnoApiHeadersTarget_get_target,udkapi) or $(call
119 # gb_UnoApiHeadersTarget_get_dir,udkapi), it will get target or dir for
120 # comprehensive headers instead.
122 # We are experimenting with static linking on Android, too. There for
123 # technical reasons to get around silly limitations in the OS, sigh.
125 # gb_UnoApiHeadersTarget_select_variant api default-variant
126 ifeq ($(origin gb_UnoApiHeadersTarget_select_variant),undefined)
127 $(eval $(call gb_Output_error,gb_UnoApiHeadersTarget_select_variant must be defined by platform))
128 endif
130 gb_UnoApiHeadersTarget_CPPUMAKERDEPS := $(call gb_Executable_get_runtime_dependencies,cppumaker)
131 gb_UnoApiHeadersTarget_CPPUMAKERCOMMAND := $(call gb_Executable_get_command,cppumaker)
133 define gb_UnoApiHeadersTarget__command
134 $(gb_UnoApiHeadersTarget_CPPUMAKERCOMMAND) \
135 -Gc $(4) -O$(3) $(call gb_UnoApiTarget_get_target,$(2)) \
136 $(UNOAPI_DEPS) && \
137 touch $(1)
139 endef
141 $(call gb_UnoApiHeadersTarget_get_real_bootstrap_target,%) : \
142 $(gb_UnoApiHeadersTarget_CPPUMAKERDEPS)
143 $(call gb_Output_announce,$*,$(true),HPB,3) \
144 $(call gb_Trace_StartRange,$*,HPB)
145 $(call gb_UnoApiHeadersTarget__command,$@,$*,$(call gb_UnoApiHeadersTarget_get_bootstrap_dir,$*))
146 $(call gb_Trace_EndRange,$*,HPB)
148 $(call gb_UnoApiHeadersTarget_get_real_comprehensive_target,%) : \
149 $(gb_UnoApiHeadersTarget_CPPUMAKERDEPS)
150 $(call gb_Output_announce,$*,$(true),HPC,3)
151 $(call gb_Trace_StartRange,$*,HPC)
152 $(call gb_UnoApiHeadersTarget__command,$@,$*,$(call gb_UnoApiHeadersTarget_get_comprehensive_dir,$*),-C)
153 $(call gb_Trace_EndRange,$*,HPC)
155 $(call gb_UnoApiHeadersTarget_get_real_target,%) : \
156 $(gb_UnoApiHeadersTarget_CPPUMAKERDEPS)
157 $(call gb_Output_announce,$*,$(true),HPP,3) \
158 $(call gb_Trace_StartRange,$*,HPP)
159 $(call gb_UnoApiHeadersTarget__command,$@,$*,$(call gb_UnoApiHeadersTarget_get_dir,$*),-L)
160 $(call gb_Trace_EndRange,$*,HPP)
162 .PHONY : $(call gb_UnoApiHeadersTarget_get_clean_target,%)
163 $(call gb_UnoApiHeadersTarget_get_clean_target,%) :
164 $(call gb_Output_announce,$*,$(false),HPP,3)
165 $(call gb_Helper_abbreviate_dirs,\
166 rm -rf \
167 $(call gb_UnoApiHeadersTarget_get_real_dir,$*) \
168 $(call gb_UnoApiHeadersTarget_get_real_bootstrap_dir,$*) \
169 $(call gb_UnoApiHeadersTarget_get_real_comprehensive_dir,$*) \
170 $(call gb_UnoApiHeadersTarget_get_real_target,$*) \
171 $(call gb_UnoApiHeadersTarget_get_real_bootstrap_target,$*)) \
172 $(call gb_UnoApiHeadersTarget_get_real_comprehensive_target,$*)
174 define gb_UnoApiHeadersTarget_UnoApiHeadersTarget
175 $(call gb_UnoApiHeadersTarget_get_target,$(1)) : $(call gb_UnoApiTarget_get_target,$(1))
176 $(call gb_UnoApiHeadersTarget_get_bootstrap_target,$(1)) : $(call gb_UnoApiTarget_get_target,$(1))
177 $(call gb_UnoApiHeadersTarget_get_comprehensive_target,$(1)) : $(call gb_UnoApiTarget_get_target,$(1))
178 $(call gb_UnoApiHeadersTarget_get_clean_target,$(1)) : $(call gb_UnoApiTarget_get_clean_target,$(1))
180 $(call gb_UnoApiHeadersTarget_get_target,$(1)) : UNOAPI_DEPS :=
181 $(call gb_UnoApiHeadersTarget_get_bootstrap_target,$(1)) : UNOAPI_DEPS :=
182 $(call gb_UnoApiHeadersTarget_get_comprehensive_target,$(1)) : UNOAPI_DEPS :=
184 # need dummy recipes so that header files are delivered in Package_inc;
185 # otherwise make will consider the header to be up-to-date because it was
186 # actually built by the recipe for gb_UnoApiHeadersTarget_get_target
187 $(call gb_UnoApiHeadersTarget_get_real_dir,$(1))/%.hdl : \
188 $(call gb_Executable_get_target_for_build,cppumaker) \
189 | $(call gb_UnoApiHeadersTarget_get_real_target,$(1))
190 touch $$@
192 $(call gb_UnoApiHeadersTarget_get_real_dir,$(1))/%.hpp : \
193 $(call gb_Executable_get_target_for_build,cppumaker) \
194 | $(call gb_UnoApiHeadersTarget_get_real_target,$(1))
195 touch $$@
197 $(call gb_UnoApiHeadersTarget_get_real_bootstrap_dir,$(1))/%.hdl : \
198 $(call gb_Executable_get_target_for_build,cppumaker) \
199 | $(call gb_UnoApiHeadersTarget_get_real_bootstrap_target,$(1))
200 touch $$@
202 $(call gb_UnoApiHeadersTarget_get_real_bootstrap_dir,$(1))/%.hpp : \
203 $(call gb_Executable_get_target_for_build,cppumaker) \
204 | $(call gb_UnoApiHeadersTarget_get_real_bootstrap_target,$(1))
205 touch $$@
207 $(call gb_UnoApiHeadersTarget_get_real_comprehensive_dir,$(1))/%.hdl : \
208 $(call gb_Executable_get_target_for_build,cppumaker) \
209 | $(call gb_UnoApiHeadersTarget_get_real_comprehensive_target,$(1))
210 touch $$@
212 $(call gb_UnoApiHeadersTarget_get_real_comprehensive_dir,$(1))/%.hpp : \
213 $(call gb_Executable_get_target_for_build,cppumaker) \
214 | $(call gb_UnoApiHeadersTarget_get_real_comprehensive_target,$(1))
215 touch $$@
217 endef
219 # ensure that idl change triggers the dummy rule to rebuild the headers
220 # call gb_UnoApiHeadersTarget_add_headerfile,unoapi,headerfile
221 define gb_UnoApiHeadersTarget_add_headerfile
222 $(call gb_UnoApiHeadersTarget_get_dir,$(1))/$(2) : \
223 $(SRCDIR)/$(basename $(gb_UnoApiTarget_REG_$(1))/$(2)).idl
225 endef
227 # call gb_UnoApiHeadersTarget_add_headerfiles,unoapi,directory,headerfilenames
228 define gb_UnoApiHeadersTarget_add_headerfiles
229 $(foreach hdr,$(3),$(call gb_UnoApiHeadersTarget_add_headerfile,$(1),$(2)/$(hdr)))
230 endef
232 define gb_UnoApiHeadersTarget__use_api_for_target
233 $(call gb_UnoApiHeadersTarget_get_$(3),$(1)) : $(call gb_UnoApiTarget_get_target,$(2))
234 $(call gb_UnoApiHeadersTarget_get_$(3),$(1)) : UNOAPI_DEPS += -X$(call gb_UnoApiTarget_get_target,$(2))
236 endef
238 define gb_UnoApiHeadersTarget__use_api
239 $(call gb_UnoApiHeadersTarget__use_api_for_target,$(1),$(2),target)
240 $(call gb_UnoApiHeadersTarget__use_api_for_target,$(1),$(2),bootstrap_target)
241 $(call gb_UnoApiHeadersTarget__use_api_for_target,$(1),$(2),comprehensive_target)
243 endef
245 define gb_UnoApiHeadersTarget_use_api
246 $(foreach rdb,$(2),$(call gb_UnoApiHeadersTarget__use_api,$(1),$(rdb)))
248 endef
250 # vim: set noet sw=4 ts=4: