xref: /trunk/main/solenv/gbuild/Library.mk (revision ed367079c2b5e47ff903c5cfe19fdbf843855c49)
17871dc3eSAndrew Rist#**************************************************************
2cdf0e10cSrcweir#
37871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
47871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
57871dc3eSAndrew Rist#  distributed with this work for additional information
67871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
77871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
87871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
97871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir#
117871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir#
137871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
147871dc3eSAndrew Rist#  software distributed under the License is distributed on an
157871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
167871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
177871dc3eSAndrew Rist#  specific language governing permissions and limitations
187871dc3eSAndrew Rist#  under the License.
19cdf0e10cSrcweir#
207871dc3eSAndrew Rist#**************************************************************
217871dc3eSAndrew Rist
227871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir# Library class
25cdf0e10cSrcweir
26cdf0e10cSrcweir# defined globally in TargetLocations.mk
27cdf0e10cSrcweir#  gb_Library_OUTDIRLOCATION := $(OUTDIR)/lib
28cdf0e10cSrcweir#  gb_Library_DLLDIR := $(WORKDIR)/LinkTarget/Library
29cdf0e10cSrcweir# defined by platform
30cdf0e10cSrcweir#  gb_Library_COMPONENTPREFIXES
31cdf0e10cSrcweir#  gb_Library_DEFS
32cdf0e10cSrcweir#  gb_Library_DLLFILENAMES
33cdf0e10cSrcweir#  gb_Library_FILENAMES
34cdf0e10cSrcweir#  gb_Library_Library_platform
35cdf0e10cSrcweir#  gb_Library_TARGETS
36cdf0e10cSrcweir
37cdf0e10cSrcweirgb_Library__get_linktargetname = Library/$(call gb_Library_get_filename,$(1))
38cdf0e10cSrcweir
39*31c542e2Smseidel# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on Windows
40cdf0e10cSrcweir.PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT)
41cdf0e10cSrcweir$(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT) :
42cdf0e10cSrcweir    $(call gb_Helper_abbreviate_dirs,\
43cdf0e10cSrcweir        rm -f $(OUTDIR)/lib/$*$(gb_Library_PLAINEXT) \
44cdf0e10cSrcweir            $(AUXTARGETS))
45cdf0e10cSrcweir
46*31c542e2Smseidel# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on Windows
47cdf0e10cSrcweir$(gb_Library_OUTDIRLOCATION)/%$(gb_Library_PLAINEXT) :
48cdf0e10cSrcweir    $(call gb_Helper_abbreviate_dirs,\
49cdf0e10cSrcweir        $(call gb_Deliver_deliver,$<,$@) \
50cdf0e10cSrcweir            $(foreach target,$(AUXTARGETS), && $(call gb_Deliver_deliver,$(dir $<)/$(notdir $(target)),$(target))))
51cdf0e10cSrcweir
52cdf0e10cSrcweirdefine gb_Library_Library
53cdf0e10cSrcweirifeq (,$$(findstring $(1),$$(gb_Library_KNOWNLIBS)))
54cdf0e10cSrcweir$$(eval $$(call gb_Output_info,Currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
55cdf0e10cSrcweir$$(eval $$(call gb_Output_error,Library $(1) must be registered in Repository.mk))
56cdf0e10cSrcweirendif
57cdf0e10cSrcweir$(call gb_Library_get_target,$(1)) : AUXTARGETS :=
58cdf0e10cSrcweir$(call gb_Library__Library_impl,$(1),$(call gb_Library__get_linktargetname,$(1)))
59cdf0e10cSrcweir$(call gb_Library_add_default_nativeres,$(1),default)
60cdf0e10cSrcweir
61cdf0e10cSrcweirendef
62cdf0e10cSrcweir
63cdf0e10cSrcweirdefine gb_Library__Library_impl
64cdf0e10cSrcweir$(call gb_LinkTarget_LinkTarget,$(2))
65cdf0e10cSrcweir$(call gb_LinkTarget_set_targettype,$(2),Library)
66b63233d8Sdamjan$(call gb_LinkTarget_add_defs,$(2),\
67cdf0e10cSrcweir    $(gb_Library_DEFS) \
68cdf0e10cSrcweir)
69cdf0e10cSrcweir$(call gb_Library_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
70cdf0e10cSrcweir$(call gb_Library_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
71cdf0e10cSrcweir$(call gb_Library_Library_platform,$(1),$(2),$(gb_Library_DLLDIR)/$(call gb_Library_get_dllname,$(1)))
72cdf0e10cSrcweir$$(eval $$(call gb_Module_register_target,$(call gb_Library_get_target,$(1)),$(call gb_Library_get_clean_target,$(1))))
73b63233d8Sdamjan$(call gb_Deliver_add_deliverable,$(call gb_Library_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)),$(1))
74cdf0e10cSrcweir
75cdf0e10cSrcweirendef
76cdf0e10cSrcweir
77cdf0e10cSrcweirdefine gb_Library_set_componentfile
78cdf0e10cSrcweir$(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Library__get_componentprefix,$(1)),$(call gb_Library_get_runtime_filename,$(1)))
79b63233d8Sdamjan$(call gb_Library_get_target,$(1)) : $(call gb_ComponentTarget_get_outdir_target,$(2)) $(call gb_ComponentTarget_get_outdir_inbuild_target,$(2))
80cdf0e10cSrcweir$(call gb_Library_get_clean_target,$(1)) : $(call gb_ComponentTarget_get_clean_target,$(2))
81cdf0e10cSrcweir
82cdf0e10cSrcweirendef
83cdf0e10cSrcweir
84cdf0e10cSrcweirgb_Library__get_componentprefix = \
85cdf0e10cSrcweir    $(call gb_Library__get_layer_componentprefix,$(call \
86cdf0e10cSrcweir        gb_Library_get_layer,$(1)))
87cdf0e10cSrcweir
88cdf0e10cSrcweirgb_Library__get_layer_componentprefix = \
89cdf0e10cSrcweir    $(patsubst $(1):%,%,$(or \
90cdf0e10cSrcweir        $(filter $(1):%,$(gb_Library_COMPONENTPREFIXES)), \
91cdf0e10cSrcweir        $(call gb_Output_error,no ComponentTarget native prefix for layer '$(1)')))
92cdf0e10cSrcweir
93cdf0e10cSrcweir
94cdf0e10cSrcweirdefine gb_Library__forward_to_Linktarget
95390c74e1SDamjan Jovanovicgb_Library_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Library__get_linktargetname,$$(1)),$$(2),$$(3),$$(4))
96cdf0e10cSrcweir
97cdf0e10cSrcweirendef
98cdf0e10cSrcweir
99cdf0e10cSrcweirgb_Library_get_runtime_filename = \
100cdf0e10cSrcweir $(or $(call gb_Library_get_dllname,$(1)),$(call gb_Library_get_filename,$(1)))
101cdf0e10cSrcweir
102f006f9b4SDamjan Jovanovicdefine gb_Library_is_udk_versioned
103f006f9b4SDamjan Jovanovic$(or \
104f006f9b4SDamjan Jovanovic    $(filter $(patsubst %:$(notdir $(1)),%,$(filter %:$(notdir $(1)),$(gb_Library_FILENAMES))),$(gb_Library_RTVERLIBS)),\
105790ba93fSDamjan Jovanovic    $(filter $(patsubst %:$(notdir $(1)),%,$(filter %:$(notdir $(1)),$(gb_Library_FILENAMES))),$(gb_Library_UNOVERLIBS)))
106f006f9b4SDamjan Jovanovicendef
107f006f9b4SDamjan Jovanovic
108cdf0e10cSrcweir$(eval $(foreach method,\
1096bf52fdaSDamjan Jovanovic    add_asmobject \
1106bf52fdaSDamjan Jovanovic    add_asmobjects \
111cdf0e10cSrcweir    add_cobject \
112cdf0e10cSrcweir    add_cobjects \
113cdf0e10cSrcweir    add_cxxobject \
114cdf0e10cSrcweir    add_cxxobjects \
1153f75c46fSJim Jagielski    add_objcobject \
1163f75c46fSJim Jagielski    add_objcobjects \
117cdf0e10cSrcweir    add_objcxxobject \
118cdf0e10cSrcweir    add_objcxxobjects \
119cdf0e10cSrcweir    add_exception_objects \
120cdf0e10cSrcweir    add_noexception_objects \
1217f6ffbefSDamjan Jovanovic    add_generated_cobject \
1227f6ffbefSDamjan Jovanovic    add_generated_cobjects \
123cdf0e10cSrcweir    add_generated_exception_objects \
124b63233d8Sdamjan    set_yaccflags \
125b63233d8Sdamjan    add_cflags \
126cdf0e10cSrcweir    set_cflags \
127b63233d8Sdamjan    add_cxxflags \
128cdf0e10cSrcweir    set_cxxflags \
1293f75c46fSJim Jagielski    add_objcflags \
1303f75c46fSJim Jagielski    set_objcflags \
131b63233d8Sdamjan    add_objcxxflags \
132cdf0e10cSrcweir    set_objcxxflags \
133b63233d8Sdamjan    add_defs \
134cdf0e10cSrcweir    set_defs \
135cdf0e10cSrcweir    set_include \
136b63233d8Sdamjan    add_ldflags \
137cdf0e10cSrcweir    set_ldflags \
138b63233d8Sdamjan    add_libs \
139cdf0e10cSrcweir    set_library_path_flags \
140b63233d8Sdamjan    add_api \
141cdf0e10cSrcweir    add_linked_libs \
142cdf0e10cSrcweir    add_linked_static_libs \
14344c25570SAndre Fischer    add_external_libs \
144b63233d8Sdamjan    use_external \
145b63233d8Sdamjan    use_externals \
146cdf0e10cSrcweir    add_package_headers \
147cdf0e10cSrcweir    add_sdi_headers \
148cdf0e10cSrcweir    add_precompiled_header \
1493b02a9c8SDamjan Jovanovic    set_versionmap \
150390c74e1SDamjan Jovanovic    set_private_api \
151390c74e1SDamjan Jovanovic    set_private_extract_of_public_api \
152cdf0e10cSrcweir,\
153cdf0e10cSrcweir    $(call gb_Library__forward_to_Linktarget,$(method))\
154cdf0e10cSrcweir))
155cdf0e10cSrcweir
156cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
157