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 .
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 $(call gb_Output_announce
,$(2),$(true
),UNO
,4)
30 mkdir
-p
$(dir $(1)) \
31 $(if
$(UNOAPI_ENTITIES
), \
32 && RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),500,$(UNOAPI_ENTITIES
))) \
33 && $(gb_UnoApiTarget_UNOIDLWRITECOMMAND
) \
34 $(foreach rdb
,$(UNOAPI_DEPRDBS
),$(call gb_UnoApiTarget_get_target
,$(rdb
))) \
35 $(SRCDIR
)/$(gb_UnoApiTarget_REG_
$(2)) $(if
$(UNOAPI_ENTITIES
),@
$${RESPONSEFILE}) $(1) \
36 $(if
$(UNOAPI_ENTITIES
),&& rm -f
$${RESPONSEFILE}) \
37 $(if
$(UNOAPI_REFERENCE
), \
38 $(call gb_Output_announce
,$(2),$(true
),DBc
,3) \
39 && $(gb_UnoApiTarget_UNOIDLCHECKCOMMAND
) $(UNOAPI_REFERENCE
) -- \
40 $(foreach rdb
,$(UNOAPI_DEPRDBS
),$(call gb_UnoApiTarget_get_target
,$(rdb
))) \
44 $(call gb_UnoApiTarget_get_target
,%) :
45 $(call gb_UnoApiTarget__command
,$@
,$*)
47 .PHONY
: $(call gb_UnoApiTarget_get_clean_target
,%)
48 $(call gb_UnoApiTarget_get_clean_target
,%) :
49 $(call gb_Output_announce
,$*,$(false
),UNO
,4)
50 -$(call gb_Helper_abbreviate_dirs
,\
51 rm -rf
$(call gb_UnoApiTarget_get_target
,$*))
53 define gb_UnoApiTarget_UnoApiTarget
54 gb_UnoApiTarget_REG_
$(1) := $(2)
55 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_ENTITIES
:=
56 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_REFERENCE
:=
57 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_DEPRDBS
:=
58 $(call gb_UnoApiTarget_get_target
,$(1)) : $(gb_UnoApiTarget_UNOIDLWRITEDEPS
)
59 $(call gb_UnoApiTarget_get_target
,$(1)) : $(SRCDIR
)/$(2) # may be dir, though
63 define gb_UnoApiTarget_add_idlfile
64 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_ENTITIES
+= $(subst /,.
,$(2))$(if
$(2),.
)$(3)
65 $(call gb_UnoApiTarget_get_target
,$(1)) : $(SRCDIR
)/$(gb_UnoApiTarget_REG_
$(1))/$(2)/$(3).idl
69 define gb_UnoApiTarget_add_idlfiles
70 $(foreach idl
,$(3),$(call gb_UnoApiTarget_add_idlfile
,$(1),$(2),$(idl
)))
74 define gb_UnoApiTarget_set_reference_rdbfile
75 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_REFERENCE
:= $(2)
76 $(call gb_UnoApiTarget_get_target
,$(1)) : $(2)
77 $(call gb_UnoApiTarget_get_target
,$(1)) : $(gb_UnoApiTarget_UNOIDLCHECKDEPS
)
81 define gb_UnoApiTarget_use_api
82 $(call gb_UnoApiTarget_get_target
,$(1)) : UNOAPI_DEPRDBS
+= $(2)
83 $(call gb_UnoApiTarget_get_target
,$(1)) : $(call gb_UnoApiTarget_get_target
,$(2))
90 # gb_UnoApiHeadersTarget_select_variant
92 # Allow to redefine header variant.
94 # On iOS we use static linking because dynamic loading of own code
95 # isn't allowed by the iOS App Store rules, and we want our code to be
96 # eventually distributable there as part of apps.
98 # To avoid problems that this causes together with the lovely
99 # intentional breaking of the One Definition Rule, for iOS we always
100 # generate comprehensive headers for certain type RDBS. (The ODR
101 # breakage doesn't harm, by accident or careful design, on platforms
102 # where shared libraries are used.) To avoid generating the same headers
103 # more than once, we are silently "redirecting" the target to point to
104 # comprehensive headers instead.
107 # If gb_UnoApiHeadersTarget_select_variant is defined as
109 # ifeq ($(DISABLE_DYNLOADING),TRUE)
110 # gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2))
112 # gb_UnoApiHeadersTarget_select_variant = $(2)
115 # then, for the DISABLE_DYNLOADING case, whenever a makefile uses
116 # $(call gb_UnoApiHeadersTarget_get_target,udkapi) or $(call
117 # gb_UnoApiHeadersTarget_get_dir,udkapi), it will get target or dir for
118 # comprehensive headers instead.
120 # We are experimenting with static linking on Android, too. There for
121 # technical reasons to get around silly limitations in the OS, sigh.
123 # gb_UnoApiHeadersTarget_select_variant api default-variant
124 ifeq ($(origin gb_UnoApiHeadersTarget_select_variant
),undefined
)
125 $(eval
$(call gb_Output_error
,gb_UnoApiHeadersTarget_select_variant must be defined by platform
))
128 gb_UnoApiHeadersTarget_CPPUMAKERDEPS
:= $(call gb_Executable_get_runtime_dependencies
,cppumaker
)
129 gb_UnoApiHeadersTarget_CPPUMAKERCOMMAND
:= $(call gb_Executable_get_command
,cppumaker
)
131 define gb_UnoApiHeadersTarget__command
132 $(gb_UnoApiHeadersTarget_CPPUMAKERCOMMAND
) \
133 -Gc
$(4) -O
$(3) $(call gb_UnoApiTarget_get_target
,$(2)) \
139 $(call gb_UnoApiHeadersTarget_get_real_bootstrap_target
,%) : \
140 $(gb_UnoApiHeadersTarget_CPPUMAKERDEPS
)
141 $(call gb_Output_announce
,$*,$(true
),HPB
,3) \
142 $(call gb_UnoApiHeadersTarget__command
,$@
,$*,$(call gb_UnoApiHeadersTarget_get_bootstrap_dir
,$*))
144 $(call gb_UnoApiHeadersTarget_get_real_comprehensive_target
,%) : \
145 $(gb_UnoApiHeadersTarget_CPPUMAKERDEPS
)
146 $(call gb_Output_announce
,$*,$(true
),HPC
,3)
147 $(call gb_UnoApiHeadersTarget__command
,$@
,$*,$(call gb_UnoApiHeadersTarget_get_comprehensive_dir
,$*),-C
)
149 $(call gb_UnoApiHeadersTarget_get_real_target
,%) : \
150 $(gb_UnoApiHeadersTarget_CPPUMAKERDEPS
)
151 $(call gb_Output_announce
,$*,$(true
),HPP
,3) \
152 $(call gb_UnoApiHeadersTarget__command
,$@
,$*,$(call gb_UnoApiHeadersTarget_get_dir
,$*),-L
)
154 .PHONY
: $(call gb_UnoApiHeadersTarget_get_clean_target
,%)
155 $(call gb_UnoApiHeadersTarget_get_clean_target
,%) :
156 $(call gb_Output_announce
,$*,$(false
),HPP
,3)
157 $(call gb_Helper_abbreviate_dirs
,\
159 $(call gb_UnoApiHeadersTarget_get_real_dir
,$*) \
160 $(call gb_UnoApiHeadersTarget_get_real_bootstrap_dir
,$*) \
161 $(call gb_UnoApiHeadersTarget_get_real_comprehensive_dir
,$*) \
162 $(call gb_UnoApiHeadersTarget_get_real_target
,$*) \
163 $(call gb_UnoApiHeadersTarget_get_real_bootstrap_target
,$*)) \
164 $(call gb_UnoApiHeadersTarget_get_real_comprehensive_target
,$*)
166 define gb_UnoApiHeadersTarget_UnoApiHeadersTarget
167 $(call gb_UnoApiHeadersTarget_get_target
,$(1)) : $(call gb_UnoApiTarget_get_target
,$(1))
168 $(call gb_UnoApiHeadersTarget_get_bootstrap_target
,$(1)) : $(call gb_UnoApiTarget_get_target
,$(1))
169 $(call gb_UnoApiHeadersTarget_get_comprehensive_target
,$(1)) : $(call gb_UnoApiTarget_get_target
,$(1))
170 $(call gb_UnoApiHeadersTarget_get_clean_target
,$(1)) : $(call gb_UnoApiTarget_get_clean_target
,$(1))
172 $(call gb_UnoApiHeadersTarget_get_target
,$(1)) : UNOAPI_DEPS
:=
173 $(call gb_UnoApiHeadersTarget_get_bootstrap_target
,$(1)) : UNOAPI_DEPS
:=
174 $(call gb_UnoApiHeadersTarget_get_comprehensive_target
,$(1)) : UNOAPI_DEPS
:=
176 # need dummy recipes so that header files are delivered in Package_inc;
177 # otherwise make will consider the header to be up-to-date because it was
178 # actually built by the recipe for gb_UnoApiHeadersTarget_get_target
179 $(call gb_UnoApiHeadersTarget_get_real_dir
,$(1))/%.hdl
: \
180 $(call gb_Executable_get_target_for_build
,cppumaker
) \
181 |
$(call gb_UnoApiHeadersTarget_get_real_target
,$(1))
184 $(call gb_UnoApiHeadersTarget_get_real_dir
,$(1))/%.hpp
: \
185 $(call gb_Executable_get_target_for_build
,cppumaker
) \
186 |
$(call gb_UnoApiHeadersTarget_get_real_target
,$(1))
189 $(call gb_UnoApiHeadersTarget_get_real_bootstrap_dir
,$(1))/%.hdl
: \
190 $(call gb_Executable_get_target_for_build
,cppumaker
) \
191 |
$(call gb_UnoApiHeadersTarget_get_real_bootstrap_target
,$(1))
194 $(call gb_UnoApiHeadersTarget_get_real_bootstrap_dir
,$(1))/%.hpp
: \
195 $(call gb_Executable_get_target_for_build
,cppumaker
) \
196 |
$(call gb_UnoApiHeadersTarget_get_real_bootstrap_target
,$(1))
199 $(call gb_UnoApiHeadersTarget_get_real_comprehensive_dir
,$(1))/%.hdl
: \
200 $(call gb_Executable_get_target_for_build
,cppumaker
) \
201 |
$(call gb_UnoApiHeadersTarget_get_real_comprehensive_target
,$(1))
204 $(call gb_UnoApiHeadersTarget_get_real_comprehensive_dir
,$(1))/%.hpp
: \
205 $(call gb_Executable_get_target_for_build
,cppumaker
) \
206 |
$(call gb_UnoApiHeadersTarget_get_real_comprehensive_target
,$(1))
211 # ensure that idl change triggers the dummy rule to rebuild the headers
212 # call gb_UnoApiHeadersTarget_add_headerfile,unoapi,headerfile
213 define gb_UnoApiHeadersTarget_add_headerfile
214 $(call gb_UnoApiHeadersTarget_get_dir
,$(1))/$(2) : \
215 $(SRCDIR
)/$(basename $(gb_UnoApiTarget_REG_
$(1))/$(2)).idl
219 # call gb_UnoApiHeadersTarget_add_headerfiles,unoapi,directory,headerfilenames
220 define gb_UnoApiHeadersTarget_add_headerfiles
221 $(foreach hdr
,$(3),$(call gb_UnoApiHeadersTarget_add_headerfile
,$(1),$(2)/$(hdr
)))
224 define gb_UnoApiHeadersTarget__use_api_for_target
225 $(call gb_UnoApiHeadersTarget_get_
$(3),$(1)) : $(call gb_UnoApiTarget_get_target
,$(2))
226 $(call gb_UnoApiHeadersTarget_get_
$(3),$(1)) : UNOAPI_DEPS
+= -X
$(call gb_UnoApiTarget_get_target
,$(2))
230 define gb_UnoApiHeadersTarget__use_api
231 $(call gb_UnoApiHeadersTarget__use_api_for_target
,$(1),$(2),target
)
232 $(call gb_UnoApiHeadersTarget__use_api_for_target
,$(1),$(2),bootstrap_target
)
233 $(call gb_UnoApiHeadersTarget__use_api_for_target
,$(1),$(2),comprehensive_target
)
237 define gb_UnoApiHeadersTarget_use_api
238 $(foreach rdb
,$(2),$(call gb_UnoApiHeadersTarget__use_api
,$(1),$(rdb
)))
242 # vim: set noet sw=4 ts=4: