xref: /aoo41x/main/solenv/gbuild/StaticLibrary.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# Static Library class
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir# defined globally in gbuild.mk
32*cdf0e10cSrcweir#  gb_StaticLibrary_OUTDIRLOCATION := $(OUTDIR)/lib
33*cdf0e10cSrcweir# defined by platform
34*cdf0e10cSrcweir#  gb_StaticLibrary_DEFS
35*cdf0e10cSrcweir#  gb_StaticLibrary_FILENAMES
36*cdf0e10cSrcweir#  gb_StaticLibrary_TARGETS
37*cdf0e10cSrcweir
38*cdf0e10cSrcweirgb_StaticLibrary__get_linktargetname = StaticLibrary/$(call gb_StaticLibrary_get_filename,$(1))
39*cdf0e10cSrcweir
40*cdf0e10cSrcweir# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
41*cdf0e10cSrcweir.PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_StaticLibrary_PLAINEXT)
42*cdf0e10cSrcweir$(WORKDIR)/Clean/OutDir/lib/%$(gb_StaticLibrary_PLAINEXT) :
43*cdf0e10cSrcweir	$(call gb_Helper_abbreviate_dirs,\
44*cdf0e10cSrcweir		rm -f $(OUTDIR)/lib/$*$(gb_StaticLibrary_PLAINEXT) \
45*cdf0e10cSrcweir			$(AUXTARGETS))
46*cdf0e10cSrcweir
47*cdf0e10cSrcweir# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
48*cdf0e10cSrcweir$(gb_StaticLibrary_OUTDIRLOCATION)/%$(gb_StaticLibrary_PLAINEXT) :
49*cdf0e10cSrcweir	$(call gb_Helper_abbreviate_dirs,\
50*cdf0e10cSrcweir		$(call gb_Deliver_deliver,$<,$@) \
51*cdf0e10cSrcweir			$(foreach target,$(AUXTARGETS), && $(call gb_Deliver_deliver,$(dir $<)/$(notdir $(target)),$(target))))
52*cdf0e10cSrcweir
53*cdf0e10cSrcweirdefine gb_StaticLibrary_StaticLibrary
54*cdf0e10cSrcweirifeq (,$$(findstring $(1),$$(gb_StaticLibrary_KNOWNLIBS)))
55*cdf0e10cSrcweir$$(eval $$(call gb_Output_info,Currently known static libraries are: $(sort $(gb_StaticLibrary_KNOWNLIBS)),ALL))
56*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,Static library $(1) must be registered in Repository.mk))
57*cdf0e10cSrcweirendif
58*cdf0e10cSrcweir$(call gb_StaticLibrary_get_target,$(1)) : AUXTARGETS :=
59*cdf0e10cSrcweir$(call gb_StaticLibrary__StaticLibrary_impl,$(1),$(call gb_StaticLibrary__get_linktargetname,$(1)))
60*cdf0e10cSrcweir
61*cdf0e10cSrcweirendef
62*cdf0e10cSrcweir
63*cdf0e10cSrcweirdefine gb_StaticLibrary__StaticLibrary_impl
64*cdf0e10cSrcweir$(call gb_LinkTarget_LinkTarget,$(2))
65*cdf0e10cSrcweir$(call gb_LinkTarget_set_targettype,$(2),StaticLibrary)
66*cdf0e10cSrcweir$(call gb_LinkTarget_set_defs,$(2),\
67*cdf0e10cSrcweir	$$(DEFS) \
68*cdf0e10cSrcweir	$(gb_StaticLibrary_DEFS) \
69*cdf0e10cSrcweir)
70*cdf0e10cSrcweir$(call gb_StaticLibrary_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
71*cdf0e10cSrcweir$(call gb_StaticLibrary_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
72*cdf0e10cSrcweir$(call gb_StaticLibrary_StaticLibrary_platform,$(1),$(2))
73*cdf0e10cSrcweir$$(eval $$(call gb_Module_register_target,$(call gb_StaticLibrary_get_target,$(1)),$(call gb_StaticLibrary_get_clean_target,$(1))))
74*cdf0e10cSrcweir$(call gb_Deliver_add_deliverable,$(call gb_StaticLibrary_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)))
75*cdf0e10cSrcweir
76*cdf0e10cSrcweirendef
77*cdf0e10cSrcweir
78*cdf0e10cSrcweirdefine gb_StaticLibrary_forward_to_Linktarget
79*cdf0e10cSrcweirgb_StaticLibrary_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_StaticLibrary__get_linktargetname,$$(1)),$$(2),$$(3))
80*cdf0e10cSrcweir
81*cdf0e10cSrcweirendef
82*cdf0e10cSrcweir
83*cdf0e10cSrcweir$(eval $(foreach method,\
84*cdf0e10cSrcweir	add_cobject \
85*cdf0e10cSrcweir	add_cobjects \
86*cdf0e10cSrcweir	add_cxxobject \
87*cdf0e10cSrcweir	add_cxxobjects \
88*cdf0e10cSrcweir	add_objcxxobject \
89*cdf0e10cSrcweir	add_objcxxobjects \
90*cdf0e10cSrcweir	add_exception_objects \
91*cdf0e10cSrcweir	add_noexception_objects \
92*cdf0e10cSrcweir	add_generated_exception_objects \
93*cdf0e10cSrcweir	set_cflags \
94*cdf0e10cSrcweir	set_cxxflags \
95*cdf0e10cSrcweir	set_objcxxflags \
96*cdf0e10cSrcweir	set_defs \
97*cdf0e10cSrcweir	set_include \
98*cdf0e10cSrcweir	set_ldflags \
99*cdf0e10cSrcweir	set_library_path_flags \
100*cdf0e10cSrcweir	add_linked_libs \
101*cdf0e10cSrcweir	add_linked_static_libs \
102*cdf0e10cSrcweir	add_package_headers \
103*cdf0e10cSrcweir	add_sdi_headers \
104*cdf0e10cSrcweir	add_precompiled_header \
105*cdf0e10cSrcweir,\
106*cdf0e10cSrcweir	$(call gb_StaticLibrary_forward_to_Linktarget,$(method))\
107*cdf0e10cSrcweir))
108*cdf0e10cSrcweir
109*cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
110