xref: /aoo41x/main/solenv/gbuild/StaticLibrary.mk (revision cdf0e10c)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2011 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28
29# Static Library class
30
31# defined globally in gbuild.mk
32#  gb_StaticLibrary_OUTDIRLOCATION := $(OUTDIR)/lib
33# defined by platform
34#  gb_StaticLibrary_DEFS
35#  gb_StaticLibrary_FILENAMES
36#  gb_StaticLibrary_TARGETS
37
38gb_StaticLibrary__get_linktargetname = StaticLibrary/$(call gb_StaticLibrary_get_filename,$(1))
39
40# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
41.PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_StaticLibrary_PLAINEXT)
42$(WORKDIR)/Clean/OutDir/lib/%$(gb_StaticLibrary_PLAINEXT) :
43	$(call gb_Helper_abbreviate_dirs,\
44		rm -f $(OUTDIR)/lib/$*$(gb_StaticLibrary_PLAINEXT) \
45			$(AUXTARGETS))
46
47# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
48$(gb_StaticLibrary_OUTDIRLOCATION)/%$(gb_StaticLibrary_PLAINEXT) :
49	$(call gb_Helper_abbreviate_dirs,\
50		$(call gb_Deliver_deliver,$<,$@) \
51			$(foreach target,$(AUXTARGETS), && $(call gb_Deliver_deliver,$(dir $<)/$(notdir $(target)),$(target))))
52
53define gb_StaticLibrary_StaticLibrary
54ifeq (,$$(findstring $(1),$$(gb_StaticLibrary_KNOWNLIBS)))
55$$(eval $$(call gb_Output_info,Currently known static libraries are: $(sort $(gb_StaticLibrary_KNOWNLIBS)),ALL))
56$$(eval $$(call gb_Output_error,Static library $(1) must be registered in Repository.mk))
57endif
58$(call gb_StaticLibrary_get_target,$(1)) : AUXTARGETS :=
59$(call gb_StaticLibrary__StaticLibrary_impl,$(1),$(call gb_StaticLibrary__get_linktargetname,$(1)))
60
61endef
62
63define gb_StaticLibrary__StaticLibrary_impl
64$(call gb_LinkTarget_LinkTarget,$(2))
65$(call gb_LinkTarget_set_targettype,$(2),StaticLibrary)
66$(call gb_LinkTarget_set_defs,$(2),\
67	$$(DEFS) \
68	$(gb_StaticLibrary_DEFS) \
69)
70$(call gb_StaticLibrary_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
71$(call gb_StaticLibrary_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
72$(call gb_StaticLibrary_StaticLibrary_platform,$(1),$(2))
73$$(eval $$(call gb_Module_register_target,$(call gb_StaticLibrary_get_target,$(1)),$(call gb_StaticLibrary_get_clean_target,$(1))))
74$(call gb_Deliver_add_deliverable,$(call gb_StaticLibrary_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)))
75
76endef
77
78define gb_StaticLibrary_forward_to_Linktarget
79gb_StaticLibrary_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_StaticLibrary__get_linktargetname,$$(1)),$$(2),$$(3))
80
81endef
82
83$(eval $(foreach method,\
84	add_cobject \
85	add_cobjects \
86	add_cxxobject \
87	add_cxxobjects \
88	add_objcxxobject \
89	add_objcxxobjects \
90	add_exception_objects \
91	add_noexception_objects \
92	add_generated_exception_objects \
93	set_cflags \
94	set_cxxflags \
95	set_objcxxflags \
96	set_defs \
97	set_include \
98	set_ldflags \
99	set_library_path_flags \
100	add_linked_libs \
101	add_linked_static_libs \
102	add_package_headers \
103	add_sdi_headers \
104	add_precompiled_header \
105,\
106	$(call gb_StaticLibrary_forward_to_Linktarget,$(method))\
107))
108
109# vim: set noet sw=4 ts=4:
110