1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2 #*************************************************************************
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 # Copyright 2000, 2011 Oracle and/or its affiliates.
8 # OpenOffice.org - a multi-platform office productivity suite
10 # This file is part of OpenOffice.org.
12 # OpenOffice.org is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU Lesser General Public License version 3
14 # only, as published by the Free Software Foundation.
16 # OpenOffice.org is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU Lesser General Public License version 3 for more details
20 # (a copy is included in the LICENSE file that accompanied this code).
22 # You should have received a copy of the GNU Lesser General Public License
23 # version 3 along with OpenOffice.org. If not, see
24 # <http://www.openoffice.org/license.html>
25 # for a copy of the LGPLv3 License.
27 #*************************************************************************
32 # defined globally in TargetLocations.mk
33 # gb_Library_OUTDIRLOCATION := $(OUTDIR)/lib
34 # gb_Library_DLLDIR := $(WORKDIR)/LinkTarget/Library
37 # gb_Library_DLLFILENAMES
38 # gb_Library_FILENAMES
39 # gb_Library_Library_platform
41 # doesn't do anything, just used for hooking up component target
42 .PHONY
: $(call gb_Library__get_final_target
,%)
44 # EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
45 .PHONY
: $(WORKDIR
)/Clean
/OutDir
/lib
/%$(gb_Library_PLAINEXT
)
46 $(WORKDIR
)/Clean
/OutDir
/lib
/%$(gb_Library_PLAINEXT
) :
47 $(call gb_Helper_abbreviate_dirs
,\
48 rm -f
$(OUTDIR
)/lib
/$*$(gb_Library_PLAINEXT
) \
51 define gb_Library_Library
52 ifeq (,$$(findstring $(1),$$(gb_Library_KNOWNLIBS
)))
53 $$(eval
$$(call gb_Output_info
,Currently known libraries are
: $(sort $(gb_Library_KNOWNLIBS
)),ALL
))
54 $$(eval
$$(call gb_Output_error
,Library
$(1) must be registered in Repository.mk
))
56 $(call gb_Library_get_target
,$(1)) : SOVERSION
:=
57 $(call gb_Library__Library_impl
,$(1),$(call gb_Library_get_linktargetname
,$(1)))
61 define gb_Library__Library_impl
62 $(call gb_LinkTarget_LinkTarget
,$(2),Library_
$(1))
63 $(call gb_LinkTarget_set_targettype
,$(2),Library
)
64 $(call gb_LinkTarget_add_libs
,$(2),$(gb_STDLIBS
))
65 $(call gb_LinkTarget_add_defs
,$(2),\
68 $(call gb_Library__get_final_target
,$(1)) : $(call gb_Library_get_target
,$(1))
69 $(call gb_Library_get_target
,$(1)) : $(call gb_LinkTarget_get_target
,$(2)) \
70 |
$(dir $(call gb_Library_get_target
,$(1))).
dir
71 $(call gb_Library_get_clean_target
,$(1)) : $(call gb_LinkTarget_get_clean_target
,$(2))
72 $(call gb_Library_get_clean_target
,$(1)) : AUXTARGETS
:=
73 $(call gb_Library_Library_platform
,$(1),$(2),$(gb_Library_DLLDIR
)/$(call gb_Library_get_dllname
,$(1)))
74 $$(eval
$$(call gb_Module_register_target
,$(call gb_Library__get_final_target
,$(1)),$(call gb_Library_get_clean_target
,$(1))))
75 $(call gb_Deliver_add_deliverable
,$(call gb_Library_get_target
,$(1)),$(call gb_LinkTarget_get_target
,$(2)),$(1))
79 # Custom definition that does not simply forward to LinkTarget,
80 # because there are cases where the auxtargets are not delivered to solver...
81 # The auxtarget is delivered via the rule in Package.mk.
82 # gb_Library_add_auxtarget library outdirauxtarget
83 define gb_Library_add_auxtarget
84 $(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)))
85 $(call gb_Library_get_target
,$(1)) : $(2)
86 $(2) : $(dir $(call gb_LinkTarget_get_target
,$(call gb_Library_get_linktargetname
,$(1))))/$(notdir $(2))
87 $(call gb_Library_get_clean_target
,$(1)) : AUXTARGETS
+= $(2)
91 define gb_Library_add_auxtargets
92 $(foreach aux
,$(2),$(call gb_Library_add_auxtarget
,$(1),$(aux
)))
96 define gb_Library__set_soversion_script
97 $(call gb_LinkTarget_set_soversion_script
,$(call gb_Library_get_linktargetname
,$(1)),$(2),$(3))
98 $(call gb_Library_get_target
,$(1)) : SOVERSION
:= $(2)
99 $(call gb_Library_add_auxtarget
,$(1),$(call gb_Library_get_target
,$(1)).
$(2))
103 # for libraries that maintain stable ABI: set SOVERSION and version script
104 # $(call gb_Library_set_soversion_script,soversion,versionscript)
105 define gb_Library_set_soversion_script
106 $(if
$(2),,$(call gb_Output_error
,gb_Library_set_soversion_script
: no version
))
107 $(if
$(3),,$(call gb_Output_error
,gb_Library_set_soversion_script
: no script
))
108 $(call gb_Library__set_soversion_script_platform
,$(1),$(2),$(3))
111 # The dependency from workdir component target to outdir library should ensure
112 # that gb_CppunitTest_use_component can transitively depend on the library.
113 # But the component target also must be delivered, so a new phony target
114 # gb_Library__get_final_target has been invented for that purpose...
115 define gb_Library_set_componentfile
116 $(call gb_Library_get_target
,$(gb_Library__get_name
)) : \
117 COMPONENT
:= $$(if
$$(and
$$(COMPONENT
),$(filter-out $(gb_MERGEDLIBS
),$(1))),\
118 $$(call gb_Output_error
,$(1) already has a component file
$$(COMPONENT
)))$(2)
119 $(call gb_ComponentTarget_ComponentTarget
,$(2),\
120 $(call gb_Library__get_componentprefix
,$(gb_Library__get_name
)),\
121 $(call gb_Library_get_runtime_filename
,$(gb_Library__get_name
)))
122 $(call gb_Library__get_final_target
,$(gb_Library__get_name
)) : \
123 $(call gb_ComponentTarget_get_outdir_target
,$(2))
124 $(call gb_ComponentTarget_get_target
,$(2)) :| \
125 $(call gb_Library_get_target
,$(gb_Library__get_name
))
126 $(call gb_Library_get_clean_target
,$(gb_Library__get_name
)) : \
127 $(call gb_ComponentTarget_get_clean_target
,$(2))
130 gb_Library__get_name
= $(if
$(filter $(1),$(gb_MERGEDLIBS
)),merged
,$(1))
132 gb_Library__get_componentprefix
= \
133 $(call gb_Library__get_layer_componentprefix
,$(call \
134 gb_Library_get_layer
,$(1)))
136 gb_Library__get_layer_componentprefix
= \
137 $(patsubst $(1):%,%,$(or \
138 $(filter $(1):%,$(gb_Library__COMPONENTPREFIXES
)), \
139 $(call gb_Output_error
,no ComponentTarget native
prefix for layer
'$(1)')))
141 # The \d gets turned into a dollar sign by a $(subst) call in
142 # gb_ComponentTarget__command in ComponentTarget.mk. As far as I
143 # understand, there is nothing magic to it, it is not some
144 # Make/awk/sed/whatever syntax.
146 gb_Library__COMPONENTPREFIXES
:= \
147 NONE
:vnd.sun.star.expand
:\dLO_LIB_DIR
/ \
148 OOO
:vnd.sun.star.expand
:\dLO_LIB_DIR
/ \
149 URELIB
:vnd.sun.star.expand
:\dURE_INTERNAL_LIB_DIR
/ \
152 define gb_Library__forward_to_Linktarget
153 gb_Library_
$(1) = $$(call gb_LinkTarget_
$(1),$$(call gb_Library_get_linktargetname
,$$(1)),$$(2),$$(3),Library_
$$(1))
157 gb_Library_get_runtime_filename
= \
158 $(or
$(call gb_Library_get_dllname
,$(1)),$(call gb_Library_get_filename
,$(1)))
160 $(eval
$(foreach method
,\
171 add_exception_objects \
172 add_x64_generated_exception_objects \
173 add_noexception_objects \
174 add_generated_cobjects \
175 add_generated_cxxobjects \
176 add_generated_exception_objects \
177 add_library_objects \
178 use_library_objects \
198 disable_standard_system_libs \
199 use_system_darwin_frameworks \
200 use_system_win32_libs \
201 set_library_path_flags \
208 add_internal_bootstrap_api \
209 use_internal_bootstrap_api \
210 add_internal_comprehensive_api \
211 use_internal_comprehensive_api \
214 add_linked_static_libs \
215 use_static_libraries \
220 add_external_headers \
224 add_package_headers \
226 export_objects_list \
228 set_visibility_default \
229 set_warnings_not_errors \
230 set_generated_cxx_suffix \
232 $(call gb_Library__forward_to_Linktarget
,$(method
))\
235 # vim: set noet sw=4: