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 .
23 # defined globally in TargetLocations.mk
24 # gb_Library_OUTDIRLOCATION := $(OUTDIR)/lib
25 # gb_Library_DLLDIR := $(WORKDIR)/LinkTarget/Library
28 # gb_Library_DLLFILENAMES
29 # gb_Library_FILENAMES
30 # gb_Library_Library_platform
32 gb_Library_LAYER_DIRS
:= \
34 URELIB
:ure
/$(notdir $(gb_Helper_OUTDIRLIBDIR
))
36 # doesn't do anything, just used for hooking up component target
37 .PHONY
: $(call gb_Library__get_final_target
,%)
39 # EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
40 .PHONY
: $(WORKDIR
)/Clean
/OutDir
/lib
/%$(gb_Library_PLAINEXT
)
41 $(WORKDIR
)/Clean
/OutDir
/lib
/%$(gb_Library_PLAINEXT
) :
42 $(call gb_Helper_abbreviate_dirs
,\
43 rm -f
$(OUTDIR
)/lib
/$*$(gb_Library_PLAINEXT
) \
46 gb_Library_get_packagename
= Library
/$(1)
48 gb_Library__get_dir_for_layer
= $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_LAYER_DIRS
)))
49 gb_Library_get_instdir
= $(call gb_Library__get_dir_for_layer
,$(call gb_Library_get_layer
,$(1)))
51 define gb_Library_Library
52 $(call gb_Postprocess_get_target
,AllLibraries
) : $(call gb_Library_get_target
,$(1))
53 ifeq (,$$(findstring $(1),$$(gb_Library_KNOWNLIBS
)))
54 $$(eval
$$(call gb_Output_info
,Currently known libraries are
: $(sort $(gb_Library_KNOWNLIBS
)),ALL
))
55 $$(eval
$$(call gb_Output_error
,Library
$(1) must be registered in Repository.mk
))
57 $(call gb_Library_get_target
,$(1)) : SOVERSION
:=
58 $(call gb_Library__Library_impl
,$(1),$(call gb_Library_get_linktargetname
,$(1)))
62 define gb_Library__Library_impl
63 $(call gb_LinkTarget_LinkTarget
,$(2),Library_
$(1))
64 $(call gb_LinkTarget_set_targettype
,$(2),Library
)
65 $(call gb_LinkTarget_add_libs
,$(2),$(gb_STDLIBS
))
66 $(call gb_LinkTarget_add_defs
,$(2),\
69 $(call gb_Library__get_final_target
,$(1)) : $(call gb_Library_get_target
,$(1))
70 $(call gb_Library_get_target
,$(1)) : $(call gb_LinkTarget_get_target
,$(2)) \
71 |
$(dir $(call gb_Library_get_target
,$(1))).
dir
72 $(call gb_Library_get_clean_target
,$(1)) : $(call gb_LinkTarget_get_clean_target
,$(2))
73 $(call gb_Library_get_clean_target
,$(1)) : AUXTARGETS
:=
74 $(call gb_Library_Library_platform
,$(1),$(2),$(gb_Library_DLLDIR
)/$(call gb_Library_get_dllname
,$(1)))
76 ifneq ($(gb_RUNNABLE_INSTDIR
),)
77 $(if
$(filter $(call gb_Library_get_layer
,$(1)):%,$(gb_Library_LAYER_DIRS
)),\
78 $(call gb_Library__Library_package
,$(1),$(call gb_Library_get_packagename
,$(1)),$(call gb_Library_get_runtime_filename
,$(1))) \
82 $$(eval
$$(call gb_Module_register_target
,$(call gb_Library__get_final_target
,$(1)),$(call gb_Library_get_clean_target
,$(1))))
83 $(call gb_Helper_make_userfriendly_targets
,$(1),Library
,$(call gb_Library__get_final_target
,$(1)))
84 $(call gb_Deliver_add_deliverable
,$(call gb_Library_get_target
,$(1)),$(call gb_LinkTarget_get_target
,$(2)),$(1))
88 # gb_Library__Library_package library package filename
89 define gb_Library__Library_package
90 $(call gb_Package_Package_internal
,$(2),$(gb_Helper_OUTDIRLIBDIR
))
91 $(call gb_Package_set_outdir
,$(2),$(INSTDIR
))
92 $(call gb_Package_add_file
,$(2),$(call gb_Library_get_instdir
,$(1))/$(3),$(3))
94 $(call gb_Library__get_final_target
,$(1)) : $(call gb_Package_get_target
,$(2))
95 $(call gb_Package_get_target
,$(2)) : $(call gb_Library_get_target
,$(1))
96 $(call gb_Library_get_clean_target
,$(1)) : $(call gb_Package_get_clean_target
,$(2))
100 # Custom definition that does not simply forward to LinkTarget,
101 # because there are cases where the auxtargets are not delivered to solver...
102 # The auxtarget is delivered via the rule in Package.mk.
103 # gb_Library_add_auxtarget library outdirauxtarget
104 define gb_Library_add_auxtarget
105 $(call gb_LinkTarget_add_auxtarget
,$(call gb_Library_get_linktargetname
,$(1)),$(dir $(call gb_LinkTarget_get_target
,$(call gb_Library_get_linktargetname
,$(1))))/$(notdir $(2)))
106 $(call gb_Library_get_target
,$(1)) : $(2)
107 $(2) : $(dir $(call gb_LinkTarget_get_target
,$(call gb_Library_get_linktargetname
,$(1))))/$(notdir $(2))
108 $(2) :|
$(dir $(2)).
dir
109 $(call gb_Library_get_clean_target
,$(1)) : AUXTARGETS
+= $(2)
113 define gb_Library_add_auxtargets
114 $(foreach aux
,$(2),$(call gb_Library_add_auxtarget
,$(1),$(aux
)))
118 # gb_Library__add_soversion_link library package linkname
119 define gb_Library__add_soversion_link
120 $(call gb_Library_add_auxtarget
,$(1),$(3))
121 ifneq ($(gb_RUNNABLE_INSTDIR
),)
122 $(call gb_Package_add_file
,$(2),$(call gb_Library_get_instdir
,$(1))/$(notdir $(3)),$(notdir $(3)))
127 define gb_Library__set_soversion_script
128 $(call gb_LinkTarget_set_soversion_script
,$(call gb_Library_get_linktargetname
,$(1)),$(2),$(3))
129 $(call gb_Library_get_target
,$(1)) : SOVERSION
:= $(2)
130 $(call gb_Library__add_soversion_link
,$(1),$(call gb_Library_get_packagename
,$(1)),$(call gb_Library_get_target
,$(1)).
$(2))
134 # for libraries that maintain stable ABI: set SOVERSION and version script
135 # $(call gb_Library_set_soversion_script,soversion,versionscript)
136 define gb_Library_set_soversion_script
137 $(if
$(2),,$(call gb_Output_error
,gb_Library_set_soversion_script
: no version
))
138 $(if
$(3),,$(call gb_Output_error
,gb_Library_set_soversion_script
: no script
))
139 $(call gb_Library__set_soversion_script_platform
,$(1),$(2),$(3))
142 # The dependency from workdir component target to outdir library should ensure
143 # that gb_CppunitTest_use_component can transitively depend on the library.
144 # But the component target also must be delivered, so a new phony target
145 # gb_Library__get_final_target has been invented for that purpose...
146 define gb_Library_set_componentfile
147 $(call gb_Library_get_target
,$(gb_Library__get_name
)) : \
148 COMPONENT
:= $$(if
$$(and
$$(COMPONENT
),$(filter-out $(gb_MERGEDLIBS
) $(gb_URELIBS
),$(1))),\
149 $$(call gb_Output_error
,$(1) already has a component file
$$(COMPONENT
)))$(2)
150 $(call gb_ComponentTarget_ComponentTarget
,$(2),\
151 $(call gb_Library__get_componentprefix
,$(gb_Library__get_name
)),\
152 $(call gb_Library_get_runtime_filename
,$(gb_Library__get_name
)))
153 $(call gb_Library__get_final_target
,$(gb_Library__get_name
)) : \
154 $(call gb_ComponentTarget_get_outdir_target
,$(2))
155 $(call gb_ComponentTarget_get_target
,$(2)) :| \
156 $(call gb_Library_get_target
,$(gb_Library__get_name
))
157 $(call gb_Library_get_clean_target
,$(gb_Library__get_name
)) : \
158 $(call gb_ComponentTarget_get_clean_target
,$(2))
161 gb_Library__get_name
= $(if
$(filter $(1),$(gb_MERGEDLIBS
)),merged
,$(if
$(filter $(1),$(gb_URELIBS
)),urelibs
,$(1)))
163 gb_Library__get_componentprefix
= \
164 $(call gb_Library__get_layer_componentprefix
,$(call \
165 gb_Library_get_layer
,$(1)))
167 gb_Library__get_layer_componentprefix
= \
168 $(patsubst $(1):%,%,$(or \
169 $(filter $(1):%,$(gb_Library__COMPONENTPREFIXES
)), \
170 $(call gb_Output_error
,no ComponentTarget native
prefix for layer
'$(1)')))
172 # The \d gets turned into a dollar sign by a $(subst) call in
173 # gb_ComponentTarget__command in ComponentTarget.mk. As far as I
174 # understand, there is nothing magic to it, it is not some
175 # Make/awk/sed/whatever syntax.
177 gb_Library__COMPONENTPREFIXES
:= \
178 NONE
:vnd.sun.star.expand
:\dLO_LIB_DIR
/ \
179 OOO
:vnd.sun.star.expand
:\dLO_LIB_DIR
/ \
180 URELIB
:vnd.sun.star.expand
:\dURE_INTERNAL_LIB_DIR
/ \
183 define gb_Library__forward_to_Linktarget
184 gb_Library_
$(1) = $$(call gb_LinkTarget_
$(1),$$(call gb_Library_get_linktargetname
,$$(1)),$$(2),$$(3),Library_
$$(1))
188 gb_Library_get_runtime_filename
= \
189 $(or
$(call gb_Library_get_dllname
,$(1)),$(call gb_Library_get_filename
,$(1)))
191 $(eval
$(foreach method
,\
202 add_exception_objects \
203 add_x64_generated_exception_objects \
204 add_noexception_objects \
205 add_generated_cobjects \
206 add_generated_cxxobjects \
207 add_generated_exception_objects \
208 add_library_objects \
209 use_library_objects \
229 disable_standard_system_libs \
230 use_system_darwin_frameworks \
231 use_system_win32_libs \
232 set_library_path_flags \
238 add_internal_bootstrap_api \
239 use_internal_bootstrap_api \
240 add_internal_comprehensive_api \
241 use_internal_comprehensive_api \
244 add_linked_static_libs \
245 use_static_libraries \
250 add_external_headers \
255 add_package_headers \
257 set_precompiled_header \
258 add_precompiled_header \
259 export_objects_list \
262 set_visibility_default \
263 set_warnings_not_errors \
264 set_generated_cxx_suffix \
266 $(call gb_Library__forward_to_Linktarget
,$(method
))\
269 # vim: set noet sw=4: