xref: /aoo41x/main/solenv/gbuild/LinkTarget.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# CObject class
30*cdf0e10cSrcweir
31*cdf0e10cSrcweirgb_CObject_REPOS := $(gb_REPOS)
32*cdf0e10cSrcweir
33*cdf0e10cSrcweirgb_CObject_get_source = $(1)/$(2).c
34*cdf0e10cSrcweir# defined by platform
35*cdf0e10cSrcweir#  gb_CObject__command
36*cdf0e10cSrcweir
37*cdf0e10cSrcweir# this rule generates an "always rebuild" dep file, to have something to include.
38*cdf0e10cSrcweir# the dep file will be overridden on the fly, when the object is compiled
39*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
40*cdf0e10cSrcweirdefine gb_CObject__command_dep
41*cdf0e10cSrcweirmkdir -p $(dir $(1)) && \
42*cdf0e10cSrcweir	echo '$(call gb_CObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1)
43*cdf0e10cSrcweir
44*cdf0e10cSrcweirendef
45*cdf0e10cSrcweirelse
46*cdf0e10cSrcweirgb_CObject__command_dep =
47*cdf0e10cSrcweirendif
48*cdf0e10cSrcweir
49*cdf0e10cSrcweirdefine gb_CObject__rules
50*cdf0e10cSrcweir$$(call gb_CObject_get_target,%) : $$(call gb_CObject_get_source,$(1),%)
51*cdf0e10cSrcweir	$$(call gb_CObject__command,$$@,$$*,$$<,$$(DEFS),$$(CFLAGS),$$(INCLUDE))
52*cdf0e10cSrcweir
53*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
54*cdf0e10cSrcweir$$(call gb_CObject_get_dep_target,%) : $$(call gb_CObject_get_source,$(1),%)
55*cdf0e10cSrcweir	$$(call gb_CObject__command_dep,$$@,$$*,$$<,$$(DEFS),$$(CFLAGS),$$(INCLUDE))
56*cdf0e10cSrcweirendif
57*cdf0e10cSrcweir
58*cdf0e10cSrcweirendef
59*cdf0e10cSrcweir
60*cdf0e10cSrcweir$(foreach repo,$(gb_CObject_REPOS),$(eval $(call gb_CObject__rules,$(repo))))
61*cdf0e10cSrcweir
62*cdf0e10cSrcweir$(call gb_CObject_get_dep_target,%) :
63*cdf0e10cSrcweir	$(eval $(call gb_Output_error,Unable to find plain C file $(call gb_CObject_get_source,,$*) in the repositories: $(gb_CObject_REPOS)))
64*cdf0e10cSrcweir
65*cdf0e10cSrcweirgb_CObject_CObject =
66*cdf0e10cSrcweir
67*cdf0e10cSrcweir
68*cdf0e10cSrcweir# CxxObject class
69*cdf0e10cSrcweir
70*cdf0e10cSrcweirgb_CxxObject_REPOS := $(gb_REPOS)
71*cdf0e10cSrcweir
72*cdf0e10cSrcweirgb_CxxObject_get_source = $(1)/$(2).cxx
73*cdf0e10cSrcweir# defined by platform
74*cdf0e10cSrcweir#  gb_CxxObject__command
75*cdf0e10cSrcweir
76*cdf0e10cSrcweir# This rule generates an "always rebuild" dep file, to have something to
77*cdf0e10cSrcweir# include. The dep file will be overridden on the fly, when the object is
78*cdf0e10cSrcweir# compiled.
79*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
80*cdf0e10cSrcweirdefine gb_CxxObject__command_dep
81*cdf0e10cSrcweirmkdir -p $(dir $(1)) && \
82*cdf0e10cSrcweir	echo '$(call gb_CxxObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1)
83*cdf0e10cSrcweir
84*cdf0e10cSrcweirendef
85*cdf0e10cSrcweirelse
86*cdf0e10cSrcweirgb_CxxObject__command_dep =
87*cdf0e10cSrcweirendif
88*cdf0e10cSrcweir
89*cdf0e10cSrcweir# Only enable PCH if the PCH_CXXFLAGS and the PCH_DEFS (from the linktarget)
90*cdf0e10cSrcweir# are the same as the CXXFLAGS and DEFS we want to use for this object. This
91*cdf0e10cSrcweir# should usually be the case.  The DEFS/CXXFLAGS would have too be manually
92*cdf0e10cSrcweir# overridden for one object file for them to differ.  PCH_CXXFLAGS/PCH_DEFS
93*cdf0e10cSrcweir# should never be overridden on an object -- they should be the same as for the
94*cdf0e10cSrcweir# whole linktarget. In general it should be cleaner to use a static library
95*cdf0e10cSrcweir# compiled with different flags and link that in rather than mixing different
96*cdf0e10cSrcweir# flags in one linktarget.
97*cdf0e10cSrcweirdefine gb_CxxObject__set_pchflags
98*cdf0e10cSrcweirifeq ($(gb_ENABLE_PCH),$(true))
99*cdf0e10cSrcweirifneq ($(strip $$(PCH_NAME)),)
100*cdf0e10cSrcweirifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)),$$(sort $$(CXXFLAGS) $$(DEFS)))
101*cdf0e10cSrcweir$$@ : PCHFLAGS := $$(call gb_PrecompiledHeader_get_enableflags,$$(PCH_NAME))
102*cdf0e10cSrcweirelse
103*cdf0e10cSrcweirifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_NOEXCEPTIONFLAGS)),$$(sort $$(CXXFLAGS) $$(DEFS)))
104*cdf0e10cSrcweir$$@ : PCHFLAGS := $$(call gb_NoexPrecompiledHeader_get_enableflags,$$(PCH_NAME))
105*cdf0e10cSrcweirelse
106*cdf0e10cSrcweir$$(info No precompiled header available for $$*.)
107*cdf0e10cSrcweir$$(info precompiled header flags (  ex) : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)))
108*cdf0e10cSrcweir$$(info precompiled header flags (noex) : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_NOEXCEPTIONFLAGS)))
109*cdf0e10cSrcweir$$(info .           object flags        : $$(sort $$(CXXFLAGS) $$(DEFS)))
110*cdf0e10cSrcweir$$@ : PCHFLAGS :=
111*cdf0e10cSrcweirendif
112*cdf0e10cSrcweirendif
113*cdf0e10cSrcweirendif
114*cdf0e10cSrcweirendif
115*cdf0e10cSrcweirendef
116*cdf0e10cSrcweir
117*cdf0e10cSrcweirdefine gb_CxxObject__rules
118*cdf0e10cSrcweir$$(call gb_CxxObject_get_target,%) : $$(call gb_CxxObject_get_source,$(1),%)
119*cdf0e10cSrcweir	$$(eval $$(gb_CxxObject__set_pchflags))
120*cdf0e10cSrcweir	$$(call gb_CxxObject__command,$$@,$$*,$$<)
121*cdf0e10cSrcweir
122*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
123*cdf0e10cSrcweir$$(call gb_CxxObject_get_dep_target,%) : $$(call gb_CxxObject_get_source,$(1),%)
124*cdf0e10cSrcweir	$$(eval $$(gb_CxxObject__set_pchflags))
125*cdf0e10cSrcweir	$$(call gb_CxxObject__command_dep,$$@,$$*,$$<)
126*cdf0e10cSrcweirendif
127*cdf0e10cSrcweir
128*cdf0e10cSrcweirendef
129*cdf0e10cSrcweir
130*cdf0e10cSrcweir$(foreach repo,$(gb_CxxObject_REPOS),$(eval $(call gb_CxxObject__rules,$(repo))))
131*cdf0e10cSrcweir
132*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
133*cdf0e10cSrcweir$(call gb_CxxObject_get_dep_target,%) :
134*cdf0e10cSrcweir	$(eval $(call gb_Output_error,Unable to find C++ file $(call gb_CxxObject_get_source,,$*) in repositories: $(gb_CxxObject_REPOS)))
135*cdf0e10cSrcweir
136*cdf0e10cSrcweirendif
137*cdf0e10cSrcweir
138*cdf0e10cSrcweirgb_CxxObject_CxxObject =
139*cdf0e10cSrcweir
140*cdf0e10cSrcweir
141*cdf0e10cSrcweir# GenCxxObject class
142*cdf0e10cSrcweir
143*cdf0e10cSrcweirgb_GenCxxObject_get_source = $(WORKDIR)/$(1).cxx
144*cdf0e10cSrcweir# defined by platform
145*cdf0e10cSrcweir#  gb_CxxObject__command
146*cdf0e10cSrcweir
147*cdf0e10cSrcweir# This rule generates an "always rebuild" dep file, to have something to
148*cdf0e10cSrcweir# include. The dep file will be overridden on the fly, when the object is
149*cdf0e10cSrcweir# compiled.
150*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
151*cdf0e10cSrcweirdefine gb_GenCxxObject__command_dep
152*cdf0e10cSrcweirmkdir -p $(dir $(1)) && \
153*cdf0e10cSrcweir	echo '$(call gb_GenCxxObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1)
154*cdf0e10cSrcweirendef
155*cdf0e10cSrcweirelse
156*cdf0e10cSrcweirgb_GenCxxObject__command_dep =
157*cdf0e10cSrcweirendif
158*cdf0e10cSrcweir
159*cdf0e10cSrcweir$(call gb_GenCxxObject_get_target,%) : $(call gb_GenCxxObject_get_source,%)
160*cdf0e10cSrcweir	$(call gb_CxxObject__command,$@,$*,$<)
161*cdf0e10cSrcweir
162*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
163*cdf0e10cSrcweir$(call gb_GenCxxObject_get_dep_target,%) : $(call gb_GenCxxObject_get_source,%)
164*cdf0e10cSrcweir	$(call gb_GenCxxObject__command_dep,$@,$*,$<)
165*cdf0e10cSrcweir
166*cdf0e10cSrcweir$(call gb_GenCxxObject_get_dep_target,%) :
167*cdf0e10cSrcweir	$(eval $(call gb_Output_error,Unable to find generated C++ file $(call gb_GenCxxObject_get_source,$*) in WORKDIR.))
168*cdf0e10cSrcweirendif
169*cdf0e10cSrcweir
170*cdf0e10cSrcweirgb_GenCxxObject_GenCxxObject =
171*cdf0e10cSrcweir
172*cdf0e10cSrcweir
173*cdf0e10cSrcweir# ObjCxxObject class
174*cdf0e10cSrcweir#
175*cdf0e10cSrcweirgb_ObjCxxObject_REPOS := $(gb_REPOS)
176*cdf0e10cSrcweir
177*cdf0e10cSrcweirgb_ObjCxxObject_get_source = $(1)/$(2).mm
178*cdf0e10cSrcweir# defined by platform
179*cdf0e10cSrcweir#  gb_ObjCxxObject__command
180*cdf0e10cSrcweir
181*cdf0e10cSrcweir# this rule generates an "always rebuild" dep file, to have something to include.
182*cdf0e10cSrcweir# the dep file will be overridden on the fly, when the object is compiled
183*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
184*cdf0e10cSrcweirdefine gb_ObjCxxObject__command_dep
185*cdf0e10cSrcweirmkdir -p $(dir $(1)) && \
186*cdf0e10cSrcweir	echo '$(call gb_ObjCxxObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1)
187*cdf0e10cSrcweir
188*cdf0e10cSrcweirendef
189*cdf0e10cSrcweirelse
190*cdf0e10cSrcweirgb_ObjCxxObject__command_dep =
191*cdf0e10cSrcweirendif
192*cdf0e10cSrcweir
193*cdf0e10cSrcweirdefine gb_ObjCxxObject__rules
194*cdf0e10cSrcweir$$(call gb_ObjCxxObject_get_target,%) : $$(call gb_ObjCxxObject_get_source,$(1),%)
195*cdf0e10cSrcweir	$$(call gb_ObjCxxObject__command,$$@,$$*,$$<,$$(DEFS),$$(OBJCXXFLAGS),$$(INCLUDE_STL) $$(INCLUDE))
196*cdf0e10cSrcweir
197*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
198*cdf0e10cSrcweir$$(call gb_ObjCxxObject_get_dep_target,%) : $$(call gb_ObjCxxObject_get_source,$(1),%)
199*cdf0e10cSrcweir	$$(call gb_ObjCxxObject__command_dep,$$@,$$*,$$<,$$(DEFS),$$(OBJCXXFLAGS),$$(INCLUDE_STL) $$(INCLUDE))
200*cdf0e10cSrcweirendif
201*cdf0e10cSrcweir
202*cdf0e10cSrcweirendef
203*cdf0e10cSrcweir
204*cdf0e10cSrcweir$(foreach repo,$(gb_ObjCxxObject_REPOS),$(eval $(call gb_ObjCxxObject__rules,$(repo))))
205*cdf0e10cSrcweir
206*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
207*cdf0e10cSrcweir$(call gb_ObjCxxObject_get_dep_target,%) :
208*cdf0e10cSrcweir	$(eval $(call gb_Output_error,Unable to find Objective C++ file $(call gb_ObjCxxObject_get_source,,$*) in repositories: $(gb_ObjCxxObject_REPOS)))
209*cdf0e10cSrcweirendif
210*cdf0e10cSrcweir
211*cdf0e10cSrcweirgb_ObjCxxObject_ObjCxxObject =
212*cdf0e10cSrcweir
213*cdf0e10cSrcweir
214*cdf0e10cSrcweir
215*cdf0e10cSrcweir# LinkTarget class
216*cdf0e10cSrcweir
217*cdf0e10cSrcweirgb_LinkTarget_DEFAULTDEFS := $(gb_GLOBALDEFS)
218*cdf0e10cSrcweir# defined by platform
219*cdf0e10cSrcweir#  gb_LinkTarget_CXXFLAGS
220*cdf0e10cSrcweir#  gb_LinkTarget_LDFLAGS
221*cdf0e10cSrcweir#  gb_LinkTarget_INCLUDE
222*cdf0e10cSrcweir#  gb_LinkTarget_INCLUDE_STL
223*cdf0e10cSrcweir
224*cdf0e10cSrcweir.PHONY : $(call gb_LinkTarget_get_clean_target,%)
225*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,%) :
226*cdf0e10cSrcweir	$(call gb_Output_announce,$*,$(false),LNK,4)
227*cdf0e10cSrcweir	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
228*cdf0e10cSrcweir		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
229*cdf0e10cSrcweir		$(foreach object,$(COBJECTS),$(call gb_CObject_get_dep_target,$(object))) \
230*cdf0e10cSrcweir		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
231*cdf0e10cSrcweir		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dep_target,$(object))) \
232*cdf0e10cSrcweir		$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
233*cdf0e10cSrcweir		$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object))) \
234*cdf0e10cSrcweir		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
235*cdf0e10cSrcweir		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \
236*cdf0e10cSrcweir		$(call gb_LinkTarget_get_target,$*) \
237*cdf0e10cSrcweir		$(call gb_LinkTarget_get_dep_target,$*) \
238*cdf0e10cSrcweir		$(call gb_LinkTarget_get_headers_target,$*) \
239*cdf0e10cSrcweir		$(call gb_LinkTarget_get_external_headers_target,$*) \
240*cdf0e10cSrcweir		$(DLLTARGET) \
241*cdf0e10cSrcweir		$(AUXTARGETS)) && \
242*cdf0e10cSrcweir	cat $${RESPONSEFILE} /dev/null | xargs -n 200 rm -f && \
243*cdf0e10cSrcweir	rm -f $${RESPONSEFILE}
244*cdf0e10cSrcweir
245*cdf0e10cSrcweir
246*cdf0e10cSrcweir# cat the deps of all objects in one file, then we need only open that one file
247*cdf0e10cSrcweirdefine gb_LinkTarget__command_dep
248*cdf0e10cSrcweir$(call gb_Output_announce,LNK:$(2),$(true),DEP,1)
249*cdf0e10cSrcweir$(call gb_Helper_abbreviate_dirs,\
250*cdf0e10cSrcweir	mkdir -p $(dir $(1)) && \
251*cdf0e10cSrcweir	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
252*cdf0e10cSrcweir		$(foreach object,$(3),$(call gb_CObject_get_dep_target,$(object))) \
253*cdf0e10cSrcweir		$(foreach object,$(4),$(call gb_CxxObject_get_dep_target,$(object))) \
254*cdf0e10cSrcweir		$(foreach object,$(5),$(call gb_ObjCxxObject_get_dep_target,$(object)))\
255*cdf0e10cSrcweir 		$(foreach object,$(6),$(call gb_GenCxxObject_get_dep_target,$(object)))\
256*cdf0e10cSrcweir		) && \
257*cdf0e10cSrcweir	cat $${RESPONSEFILE} /dev/null | xargs -n 200 cat > $(1)) && \
258*cdf0e10cSrcweir	rm -f $${RESPONSEFILE}
259*cdf0e10cSrcweir
260*cdf0e10cSrcweirendef
261*cdf0e10cSrcweir
262*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%) $(gb_Helper_MISCDUMMY)
263*cdf0e10cSrcweir	$(call gb_LinkTarget__command,$@,$*)
264*cdf0e10cSrcweir
265*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
266*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_dep_target,%)
267*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,%) : | $(call gb_LinkTarget_get_headers_target,%)
268*cdf0e10cSrcweir	$(call gb_LinkTarget__command_dep,$@,$*,$(COBJECTS),$(CXXOBJECTS),$(OBJCXXOBJECTS),$(GENCXXOBJECTS))
269*cdf0e10cSrcweirendif
270*cdf0e10cSrcweir
271*cdf0e10cSrcweir# Ok, this is some dark voodoo: When declaring a linktarget with
272*cdf0e10cSrcweir# gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the
273*cdf0e10cSrcweir# target. When the rule for the headertarget is executed and SELF does not
274*cdf0e10cSrcweir# match the target name, we are depending on a linktarget that was never
275*cdf0e10cSrcweir# declared. In a full build exclusively in gbuild that should never happen.
276*cdf0e10cSrcweir# However, partial gbuild build will not know about how to build lower level
277*cdf0e10cSrcweir# linktargets, just as gbuild can not know about linktargets generated in the
278*cdf0e10cSrcweir# old build.pl/dmake system. Once all is migrated, gbuild should error out
279*cdf0e10cSrcweir# when is is told to depend on a linktarget it does not know about and not
280*cdf0e10cSrcweir# only warn.
281*cdf0e10cSrcweirdefine gb_LinkTarget__get_external_headers_check
282*cdf0e10cSrcweirifneq ($$(SELF),$$*)
283*cdf0e10cSrcweir$$(eval $$(call gb_Output_info,LinkTarget $$* not defined: Assuming headers to be there!,ALL))
284*cdf0e10cSrcweirendif
285*cdf0e10cSrcweir$$@ : COMMAND := $$(call gb_Helper_abbreviate_dirs, mkdir -p $$(dir $$@) && touch $$@ && mkdir -p $(call gb_LinkTarget_get_target,)pdb/$$(dir $$*))
286*cdf0e10cSrcweir
287*cdf0e10cSrcweirendef
288*cdf0e10cSrcweir
289*cdf0e10cSrcweir$(call gb_LinkTarget_get_external_headers_target,%) :
290*cdf0e10cSrcweir	$(eval $(gb_LinkTarget__get_external_headers_check))
291*cdf0e10cSrcweir	$(COMMAND)
292*cdf0e10cSrcweir
293*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,%) : $(call gb_LinkTarget_get_external_headers_target,%)
294*cdf0e10cSrcweir	$(call gb_Helper_abbreviate_dirs,\
295*cdf0e10cSrcweir		mkdir -p $(dir $@) && touch $@)
296*cdf0e10cSrcweir
297*cdf0e10cSrcweir# Explanation of some of the targets:
298*cdf0e10cSrcweir# - gb_LinkTarget_get_external_headers_target is the targets that guarantees all
299*cdf0e10cSrcweir#   headers from linked against libraries are in OUTDIR.
300*cdf0e10cSrcweir# - gb_LinkTarget_get_headers_target is the target that guarantees all headers
301*cdf0e10cSrcweir#   from the linked against the libraries and the linktargets own headers
302*cdf0e10cSrcweir#   (including generated headers) are in the OUTDIR.
303*cdf0e10cSrcweir# - gb_LinkTarget_get_target links the objects into a file in WORKDIR.
304*cdf0e10cSrcweir# gb_LinkTarget_get_target depends on gb_LinkTarget_get_headers_target which in
305*cdf0e10cSrcweir# turn depends gb_LinkTarget_get_external_headers_target.
306*cdf0e10cSrcweir# gb_LinkTarget_get_target depends additionally on the objects, which in turn
307*cdf0e10cSrcweir# depend build-order only on the gb_LinkTarget_get_headers_target. The build
308*cdf0e10cSrcweir# order-only dependency ensures all headers to be there for compiling and
309*cdf0e10cSrcweir# dependency generation without causing all objects to be rebuild when one
310*cdf0e10cSrcweir# header changes. Only the ones with an explicit dependency in their generated
311*cdf0e10cSrcweir# dependency file will be rebuild.
312*cdf0e10cSrcweir#
313*cdf0e10cSrcweir# gb_LinkTarget_get_target is the target that links the objects into a file in
314*cdf0e10cSrcweir# WORKDIR
315*cdf0e10cSrcweir# Explanation of some of the variables:
316*cdf0e10cSrcweir# - AUXTARGETS are the additionally generated files that need to be cleaned out
317*cdf0e10cSrcweir#   on clean.
318*cdf0e10cSrcweir# - PCH_CXXFLAGS and PCH_DEFS are the flags that the precompiled headers will
319*cdf0e10cSrcweir#   be compiled with.  They should never be overridden in a single object
320*cdf0e10cSrcweir#   files.
321*cdf0e10cSrcweir# - TARGETTYPE is the type of linktarget as some platforms need very different
322*cdf0e10cSrcweir#   command to link different targettypes.
323*cdf0e10cSrcweir#
324*cdf0e10cSrcweir# Since most variables are set on the linktarget and not on the object, the
325*cdf0e10cSrcweir# object learns about these setting via GNU makes scoping of target variables.
326*cdf0e10cSrcweir# Therefore it is important that objects are only directly depended on by the
327*cdf0e10cSrcweir# linktarget. This for example means that you cannot build a single object
328*cdf0e10cSrcweir# alone, because then you would directly depend on the object.
329*cdf0e10cSrcweirdefine gb_LinkTarget_LinkTarget
330*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS :=
331*cdf0e10cSrcweir$(call gb_LinkTarget_get_external_headers_target,$(1)) : SELF := $(1)
332*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : DLLTARGET :=
333*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) \
334*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : COBJECTS :=
335*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) \
336*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS :=
337*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) \
338*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS :=
339*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) \
340*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS :=
341*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
342*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : CFLAGS := $$(gb_LinkTarget_CFLAGS)
343*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
344*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
345*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
346*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $(gb_COMPILEROPTFLAGS)
347*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS)
348*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
349*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
350*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
351*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
352*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
353*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE)
354*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
355*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : INCLUDE_STL := $$(gb_LinkTarget_INCLUDE_STL)
356*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : LDFLAGS := $$(gb_LinkTarget_LDFLAGS)
357*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS :=
358*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS :=
359*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : TARGETTYPE :=
360*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
361*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : PCH_NAME :=
362*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS :=
363*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
364*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : PDBFILE :=
365*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : NATIVERES :=
366*cdf0e10cSrcweir
367*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
368*cdf0e10cSrcweirifneq ($(wildcard $(call gb_LinkTarget_get_dep_target,$(1))),)
369*cdf0e10cSrcweirinclude $(call gb_LinkTarget_get_dep_target,$(1))
370*cdf0e10cSrcweirelse
371*cdf0e10cSrcweir$(firstword $(MAKEFILE_LIST)) : $(call gb_LinkTarget_get_dep_target,$(1))
372*cdf0e10cSrcweirendif
373*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS :=
374*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS :=
375*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS :=
376*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS :=
377*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : CFLAGS := $$(gb_LinkTarget_CFLAGS)
378*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
379*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $(gb_COMPILEROPTFLAGS)
380*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS)
381*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
382*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
383*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE)
384*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE_STL := $$(gb_LinkTarget_INCLUDE_STL)
385*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE :=
386*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_NAME :=
387*cdf0e10cSrcweirendif
388*cdf0e10cSrcweir
389*cdf0e10cSrcweirendef
390*cdf0e10cSrcweir
391*cdf0e10cSrcweirdefine gb_LinkTarget_set_defs
392*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
393*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : DEFS := $(2)
394*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
395*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $(2)
396*cdf0e10cSrcweir
397*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
398*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $(2)
399*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS := $(2)
400*cdf0e10cSrcweirendif
401*cdf0e10cSrcweir
402*cdf0e10cSrcweirendef
403*cdf0e10cSrcweir
404*cdf0e10cSrcweirdefine gb_LinkTarget_set_cflags
405*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : CFLAGS := $(2)
406*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
407*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : CFLAGS := $(2)
408*cdf0e10cSrcweirendif
409*cdf0e10cSrcweir
410*cdf0e10cSrcweirendef
411*cdf0e10cSrcweir
412*cdf0e10cSrcweirdefine gb_LinkTarget_set_cxxflags
413*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
414*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : CXXFLAGS := $(2)
415*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
416*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $(2)
417*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
418*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : CXXFLAGS := $(2)
419*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := $(2)
420*cdf0e10cSrcweirendif
421*cdf0e10cSrcweir
422*cdf0e10cSrcweirendef
423*cdf0e10cSrcweir
424*cdf0e10cSrcweirdefine gb_LinkTarget_set_objcxxflags
425*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : OBJCXXFLAGS := $(2)
426*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
427*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXFLAGS := $(2)
428*cdf0e10cSrcweirendif
429*cdf0e10cSrcweir
430*cdf0e10cSrcweirendef
431*cdf0e10cSrcweir
432*cdf0e10cSrcweirdefine gb_LinkTarget_set_include
433*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
434*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $(2)
435*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
436*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $(2)
437*cdf0e10cSrcweirendif
438*cdf0e10cSrcweir
439*cdf0e10cSrcweirendef
440*cdf0e10cSrcweir
441*cdf0e10cSrcweirdefine gb_LinkTarget_set_include_stl
442*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
443*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : INCLUDE_STL := $(2)
444*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
445*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE_STL := $(2)
446*cdf0e10cSrcweirendif
447*cdf0e10cSrcweir
448*cdf0e10cSrcweirendef
449*cdf0e10cSrcweir
450*cdf0e10cSrcweirdefine gb_LinkTarget_set_ldflags
451*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : LDFLAGS := $(2)
452*cdf0e10cSrcweirendef
453*cdf0e10cSrcweir
454*cdf0e10cSrcweirdefine gb_LinkTarget_add_linked_libs
455*cdf0e10cSrcweirifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
456*cdf0e10cSrcweir$$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
457*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk))
458*cdf0e10cSrcweirendif
459*cdf0e10cSrcweir
460*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(2)
461*cdf0e10cSrcweir
462*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$(2),$$(call gb_Library_get_target,$$(lib)))
463*cdf0e10cSrcweir$(call gb_LinkTarget_get_external_headers_target,$(1)) : \
464*cdf0e10cSrcweir$$(foreach lib,$(2),$$(call gb_Library_get_headers_target,$$(lib)))
465*cdf0e10cSrcweir
466*cdf0e10cSrcweirendef
467*cdf0e10cSrcweir
468*cdf0e10cSrcweirdefine gb_LinkTarget_add_linked_static_libs
469*cdf0e10cSrcweirifneq (,$$(filter-out $(gb_StaticLibrary_KNOWNLIBS),$(2)))
470*cdf0e10cSrcweir$$(eval $$(call gb_Output_info, currently known static libraries are: $(sort $(gb_StaticLibrary_KNOWNLIBS)),ALL))
471*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,Cannot link against static library/libraries $$(filter-out $(gb_StaticLibrary_KNOWNLIBS),$(2)). Static libraries must be registered in Repository.mk))
472*cdf0e10cSrcweirendif
473*cdf0e10cSrcweir
474*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS += $(2)
475*cdf0e10cSrcweir
476*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$(2),$$(call gb_StaticLibrary_get_target,$$(lib)))
477*cdf0e10cSrcweir$(call gb_LinkTarget_get_external_headers_target,$(1)) : \
478*cdf0e10cSrcweir$$(foreach lib,$(2),$$(call gb_StaticLibrary_get_headers_target,$$(lib)))
479*cdf0e10cSrcweir
480*cdf0e10cSrcweirendef
481*cdf0e10cSrcweir
482*cdf0e10cSrcweirdefine gb_LinkTarget_add_cobject
483*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : COBJECTS += $(2)
484*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) : COBJECTS += $(2)
485*cdf0e10cSrcweir
486*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : $(call gb_CObject_get_target,$(2))
487*cdf0e10cSrcweir$(call gb_CObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
488*cdf0e10cSrcweir$(call gb_CObject_get_target,$(2)) : CFLAGS += $(3)
489*cdf0e10cSrcweir
490*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
491*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS += $(2)
492*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CObject_get_dep_target,$(2))
493*cdf0e10cSrcweirendif
494*cdf0e10cSrcweir
495*cdf0e10cSrcweirendef
496*cdf0e10cSrcweir
497*cdf0e10cSrcweirdefine gb_LinkTarget_add_cxxobject
498*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2)
499*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) : CXXOBJECTS += $(2)
500*cdf0e10cSrcweir
501*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : $(call gb_CxxObject_get_target,$(2))
502*cdf0e10cSrcweir$(call gb_CxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
503*cdf0e10cSrcweir$(call gb_CxxObject_get_target,$(2)) : CXXFLAGS += $(3)
504*cdf0e10cSrcweir
505*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
506*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS += $(2)
507*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CxxObject_get_dep_target,$(2))
508*cdf0e10cSrcweirendif
509*cdf0e10cSrcweir
510*cdf0e10cSrcweirendef
511*cdf0e10cSrcweir
512*cdf0e10cSrcweirdefine gb_LinkTarget_add_objcxxobject
513*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS += $(2)
514*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) : OBJCXXOBJECTS += $(2)
515*cdf0e10cSrcweir
516*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : $(call gb_ObjCxxObject_get_target,$(2))
517*cdf0e10cSrcweir$(call gb_ObjCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
518*cdf0e10cSrcweir$(call gb_ObjCxxObject_get_target,$(2)) : OBJCXXFLAGS += $(3)
519*cdf0e10cSrcweir
520*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
521*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS += $(2)
522*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_ObjCxxObject_get_dep_target,$(2))
523*cdf0e10cSrcweirendif
524*cdf0e10cSrcweir
525*cdf0e10cSrcweirendef
526*cdf0e10cSrcweir
527*cdf0e10cSrcweirdefine gb_LinkTarget_add_generated_cxx_object
528*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS += $(2)
529*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXOBJECTS += $(2)
530*cdf0e10cSrcweir
531*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCxxObject_get_target,$(2))
532*cdf0e10cSrcweir$(call gb_GenCxxObject_get_source,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
533*cdf0e10cSrcweir$(call gb_GenCxxObject_get_target,$(2)) : CXXFLAGS += $(3) $(gb_COMPILEROPTFLAGS)
534*cdf0e10cSrcweir
535*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
536*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS += $(2)
537*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenCxxObject_get_dep_target,$(2))
538*cdf0e10cSrcweirendif
539*cdf0e10cSrcweir
540*cdf0e10cSrcweirendef
541*cdf0e10cSrcweir
542*cdf0e10cSrcweirdefine gb_LinkTarget_add_noexception_object
543*cdf0e10cSrcweir$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_NOEXCEPTIONFLAGS) $(gb_COMPILEROPTFLAGS))
544*cdf0e10cSrcweirendef
545*cdf0e10cSrcweir
546*cdf0e10cSrcweirdefine gb_LinkTarget_add_exception_object
547*cdf0e10cSrcweir$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(gb_COMPILEROPTFLAGS))
548*cdf0e10cSrcweirendef
549*cdf0e10cSrcweir
550*cdf0e10cSrcweirdefine gb_LinkTarget_add_cobjects
551*cdf0e10cSrcweir$(foreach obj,$(2),$(call gb_LinkTarget_add_cobject,$(1),$(obj),$(3)))
552*cdf0e10cSrcweirendef
553*cdf0e10cSrcweir
554*cdf0e10cSrcweirdefine gb_LinkTarget_add_cxxobjects
555*cdf0e10cSrcweir$(foreach obj,$(2),$(call gb_LinkTarget_add_cxxobject,$(1),$(obj),$(3)))
556*cdf0e10cSrcweirendef
557*cdf0e10cSrcweir
558*cdf0e10cSrcweirdefine gb_LinkTarget_add_objcxxobjects
559*cdf0e10cSrcweir$(foreach obj,$(2),$(call gb_LinkTarget_add_objcxxobject,$(1),$(obj),$(3)))
560*cdf0e10cSrcweirendef
561*cdf0e10cSrcweir
562*cdf0e10cSrcweirdefine gb_LinkTarget_add_noexception_objects
563*cdf0e10cSrcweir$(foreach obj,$(2),$(call gb_LinkTarget_add_noexception_object,$(1),$(obj)))
564*cdf0e10cSrcweirendef
565*cdf0e10cSrcweir
566*cdf0e10cSrcweirdefine gb_LinkTarget_add_exception_objects
567*cdf0e10cSrcweir$(foreach obj,$(2),$(call gb_LinkTarget_add_exception_object,$(1),$(obj)))
568*cdf0e10cSrcweirendef
569*cdf0e10cSrcweir
570*cdf0e10cSrcweirdefine gb_LinkTarget_add_generated_exception_object
571*cdf0e10cSrcweir$(call gb_LinkTarget_add_generated_cxx_object,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS))
572*cdf0e10cSrcweirendef
573*cdf0e10cSrcweir
574*cdf0e10cSrcweirdefine gb_LinkTarget_add_generated_exception_objects
575*cdf0e10cSrcweir$(foreach obj,$(2),$(call gb_LinkTarget_add_generated_exception_object,$(1),$(obj)))
576*cdf0e10cSrcweirendef
577*cdf0e10cSrcweir
578*cdf0e10cSrcweirdefine gb_LinkTarget_set_targettype
579*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) \
580*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE := $(2)
581*cdf0e10cSrcweirendef
582*cdf0e10cSrcweir
583*cdf0e10cSrcweirdefine gb_LinkTarget_set_dlltarget
584*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) \
585*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : DLLTARGET := $(2)
586*cdf0e10cSrcweirendef
587*cdf0e10cSrcweir
588*cdf0e10cSrcweirdefine gb_LinkTarget_set_auxtargets
589*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS := $(2)
590*cdf0e10cSrcweirendef
591*cdf0e10cSrcweir
592*cdf0e10cSrcweirdefine gb_LinkTarget__add_internal_headers
593*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) : $(2)
594*cdf0e10cSrcweir$(2) :|	$(call gb_LinkTarget_get_external_headers_target,$(1))
595*cdf0e10cSrcweir
596*cdf0e10cSrcweirendef
597*cdf0e10cSrcweir
598*cdf0e10cSrcweirdefine gb_LinkTarget_add_package_headers
599*cdf0e10cSrcweir$(foreach package,$(2),$(call gb_LinkTarget__add_internal_headers,$(1),$(call gb_Package_get_target,$(package))))
600*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) : $(foreach package,$(2),$(call gb_Package_get_clean_target,$(package)))
601*cdf0e10cSrcweir
602*cdf0e10cSrcweirendef
603*cdf0e10cSrcweir
604*cdf0e10cSrcweirdefine gb_LinkTarget_add_sdi_headers
605*cdf0e10cSrcweir$(call gb_LinkTarget__add_internal_headers,$(1),$(foreach sdi,$(2),$(call gb_SdiTarget_get_target,$(sdi))))
606*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) : $(foreach sdi,$(2),$(call gb_SdiTarget_get_clean_target,$(sdi)))
607*cdf0e10cSrcweirendef
608*cdf0e10cSrcweir
609*cdf0e10cSrcweirdefine gb_LinkTarget__add_precompiled_header_impl
610*cdf0e10cSrcweir$(call gb_LinkTarget__add_internal_headers,$(1),$(call gb_PrecompiledHeader_get_target,$(3)))
611*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_PrecompiledHeader_get_clean_target,$(3))
612*cdf0e10cSrcweir$(call gb_PrecompiledHeader_get_target,$(3)) : $(2).cxx
613*cdf0e10cSrcweir
614*cdf0e10cSrcweir$(call gb_LinkTarget__add_internal_headers,$(1),$(call gb_NoexPrecompiledHeader_get_target,$(3)))
615*cdf0e10cSrcweir$(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_NoexPrecompiledHeader_get_clean_target,$(3))
616*cdf0e10cSrcweir$(call gb_NoexPrecompiledHeader_get_target,$(3)) : $(2).cxx
617*cdf0e10cSrcweir
618*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : PCH_NAME := $(3)
619*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $(call gb_PrecompiledHeader_get_target,$(3)).obj $(call gb_NoexPrecompiledHeader_get_target,$(3)).obj
620*cdf0e10cSrcweir
621*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
622*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(DEFS) -DPRECOMPILED_HEADERS
623*cdf0e10cSrcweir$(call gb_LinkTarget_get_headers_target,$(1)) \
624*cdf0e10cSrcweir$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS = $$(DEFS)
625*cdf0e10cSrcweirifeq ($(gb_FULLDEPS),$(true))
626*cdf0e10cSrcweir-include \
627*cdf0e10cSrcweir	$(call gb_PrecompiledHeader_get_dep_target,$(3)) \
628*cdf0e10cSrcweir	$(call gb_NoexPrecompiledHeader_get_dep_target,$(3))
629*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $$(DEFS) -DPRECOMPILED_HEADERS
630*cdf0e10cSrcweir$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS = $$(DEFS)
631*cdf0e10cSrcweirendif
632*cdf0e10cSrcweir
633*cdf0e10cSrcweirendef
634*cdf0e10cSrcweir
635*cdf0e10cSrcweirdefine gb_LinkTarget_add_precompiled_header
636*cdf0e10cSrcweirifeq ($(gb_ENABLE_PCH),$(true))
637*cdf0e10cSrcweir$(call gb_LinkTarget__add_precompiled_header_impl,$(1),$(2),$(notdir $(2)))
638*cdf0e10cSrcweirendif
639*cdf0e10cSrcweir
640*cdf0e10cSrcweirendef
641*cdf0e10cSrcweir
642*cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
643