xref: /aoo41x/main/solenv/gbuild/Library.mk (revision cdf0e10c)
1*cdf0e10cSrcweir#*************************************************************************
2*cdf0e10cSrcweir#
3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir#
5*cdf0e10cSrcweir# Copyright 2000, 2011 Oracle and/or its affiliates.
6*cdf0e10cSrcweir#
7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir#
9*cdf0e10cSrcweir# This file is part of OpenOffice.org.
10*cdf0e10cSrcweir#
11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir# only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir#
15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir#
21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir# version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir# for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir#
26*cdf0e10cSrcweir#*************************************************************************
27*cdf0e10cSrcweir
28*cdf0e10cSrcweir
29*cdf0e10cSrcweir# Library class
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir# defined globally in TargetLocations.mk
32*cdf0e10cSrcweir#  gb_Library_OUTDIRLOCATION := $(OUTDIR)/lib
33*cdf0e10cSrcweir#  gb_Library_DLLDIR := $(WORKDIR)/LinkTarget/Library
34*cdf0e10cSrcweir# defined by platform
35*cdf0e10cSrcweir#  gb_Library_COMPONENTPREFIXES
36*cdf0e10cSrcweir#  gb_Library_DEFS
37*cdf0e10cSrcweir#  gb_Library_DLLFILENAMES
38*cdf0e10cSrcweir#  gb_Library_FILENAMES
39*cdf0e10cSrcweir#  gb_Library_Library_platform
40*cdf0e10cSrcweir#  gb_Library_TARGETS
41*cdf0e10cSrcweir
42*cdf0e10cSrcweirgb_Library__get_linktargetname = Library/$(call gb_Library_get_filename,$(1))
43*cdf0e10cSrcweir
44*cdf0e10cSrcweir# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
45*cdf0e10cSrcweir.PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT)
46*cdf0e10cSrcweir$(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT) :
47*cdf0e10cSrcweir	$(call gb_Helper_abbreviate_dirs,\
48*cdf0e10cSrcweir		rm -f $(OUTDIR)/lib/$*$(gb_Library_PLAINEXT) \
49*cdf0e10cSrcweir			$(AUXTARGETS))
50*cdf0e10cSrcweir
51*cdf0e10cSrcweir# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
52*cdf0e10cSrcweir$(gb_Library_OUTDIRLOCATION)/%$(gb_Library_PLAINEXT) :
53*cdf0e10cSrcweir	$(call gb_Helper_abbreviate_dirs,\
54*cdf0e10cSrcweir		$(call gb_Deliver_deliver,$<,$@) \
55*cdf0e10cSrcweir			$(foreach target,$(AUXTARGETS), && $(call gb_Deliver_deliver,$(dir $<)/$(notdir $(target)),$(target))))
56*cdf0e10cSrcweir
57*cdf0e10cSrcweirdefine gb_Library_Library
58*cdf0e10cSrcweirifeq (,$$(findstring $(1),$$(gb_Library_KNOWNLIBS)))
59*cdf0e10cSrcweir$$(eval $$(call gb_Output_info,Currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
60*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,Library $(1) must be registered in Repository.mk))
61*cdf0e10cSrcweirendif
62*cdf0e10cSrcweir$(call gb_Library_get_target,$(1)) : AUXTARGETS :=
63*cdf0e10cSrcweir$(call gb_Library__Library_impl,$(1),$(call gb_Library__get_linktargetname,$(1)))
64*cdf0e10cSrcweir$(call gb_Library_add_default_nativeres,$(1),default)
65*cdf0e10cSrcweir
66*cdf0e10cSrcweirendef
67*cdf0e10cSrcweir
68*cdf0e10cSrcweirdefine gb_Library__Library_impl
69*cdf0e10cSrcweir$(call gb_LinkTarget_LinkTarget,$(2))
70*cdf0e10cSrcweir$(call gb_LinkTarget_set_targettype,$(2),Library)
71*cdf0e10cSrcweir$(call gb_LinkTarget_set_defs,$(2),\
72*cdf0e10cSrcweir	$$(DEFS) \
73*cdf0e10cSrcweir	$(gb_Library_DEFS) \
74*cdf0e10cSrcweir)
75*cdf0e10cSrcweir$(call gb_Library_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
76*cdf0e10cSrcweir$(call gb_Library_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
77*cdf0e10cSrcweir$(call gb_Library_Library_platform,$(1),$(2),$(gb_Library_DLLDIR)/$(call gb_Library_get_dllname,$(1)))
78*cdf0e10cSrcweir$$(eval $$(call gb_Module_register_target,$(call gb_Library_get_target,$(1)),$(call gb_Library_get_clean_target,$(1))))
79*cdf0e10cSrcweir$(call gb_Deliver_add_deliverable,$(call gb_Library_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)))
80*cdf0e10cSrcweir
81*cdf0e10cSrcweirendef
82*cdf0e10cSrcweir
83*cdf0e10cSrcweirdefine gb_Library_set_componentfile
84*cdf0e10cSrcweir$(call gb_ComponentTarget_ComponentTarget,$(2),$(call gb_Library__get_componentprefix,$(1)),$(call gb_Library_get_runtime_filename,$(1)))
85*cdf0e10cSrcweir$(call gb_Library_get_target,$(1)) : $(call gb_ComponentTarget_get_outdir_target,$(2))
86*cdf0e10cSrcweir$(call gb_Library_get_clean_target,$(1)) : $(call gb_ComponentTarget_get_clean_target,$(2))
87*cdf0e10cSrcweir
88*cdf0e10cSrcweirendef
89*cdf0e10cSrcweir
90*cdf0e10cSrcweirgb_Library__get_componentprefix = \
91*cdf0e10cSrcweir    $(call gb_Library__get_layer_componentprefix,$(call \
92*cdf0e10cSrcweir        gb_Library_get_layer,$(1)))
93*cdf0e10cSrcweir
94*cdf0e10cSrcweirgb_Library__get_layer_componentprefix = \
95*cdf0e10cSrcweir    $(patsubst $(1):%,%,$(or \
96*cdf0e10cSrcweir        $(filter $(1):%,$(gb_Library_COMPONENTPREFIXES)), \
97*cdf0e10cSrcweir        $(call gb_Output_error,no ComponentTarget native prefix for layer '$(1)')))
98*cdf0e10cSrcweir
99*cdf0e10cSrcweir
100*cdf0e10cSrcweirdefine gb_Library__forward_to_Linktarget
101*cdf0e10cSrcweirgb_Library_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Library__get_linktargetname,$$(1)),$$(2),$$(3))
102*cdf0e10cSrcweir
103*cdf0e10cSrcweirendef
104*cdf0e10cSrcweir
105*cdf0e10cSrcweirgb_Library_get_runtime_filename = \
106*cdf0e10cSrcweir $(or $(call gb_Library_get_dllname,$(1)),$(call gb_Library_get_filename,$(1)))
107*cdf0e10cSrcweir
108*cdf0e10cSrcweir$(eval $(foreach method,\
109*cdf0e10cSrcweir	add_cobject \
110*cdf0e10cSrcweir	add_cobjects \
111*cdf0e10cSrcweir	add_cxxobject \
112*cdf0e10cSrcweir	add_cxxobjects \
113*cdf0e10cSrcweir	add_objcxxobject \
114*cdf0e10cSrcweir	add_objcxxobjects \
115*cdf0e10cSrcweir	add_exception_objects \
116*cdf0e10cSrcweir	add_noexception_objects \
117*cdf0e10cSrcweir	add_generated_exception_objects \
118*cdf0e10cSrcweir	set_cflags \
119*cdf0e10cSrcweir	set_cxxflags \
120*cdf0e10cSrcweir	set_objcxxflags \
121*cdf0e10cSrcweir	set_defs \
122*cdf0e10cSrcweir	set_include \
123*cdf0e10cSrcweir	set_ldflags \
124*cdf0e10cSrcweir	set_library_path_flags \
125*cdf0e10cSrcweir	add_linked_libs \
126*cdf0e10cSrcweir	add_linked_static_libs \
127*cdf0e10cSrcweir	add_package_headers \
128*cdf0e10cSrcweir	add_sdi_headers \
129*cdf0e10cSrcweir	add_precompiled_header \
130*cdf0e10cSrcweir,\
131*cdf0e10cSrcweir	$(call gb_Library__forward_to_Linktarget,$(method))\
132*cdf0e10cSrcweir))
133*cdf0e10cSrcweir
134*cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
135