lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / solenv / gbuild / LinkTarget.mk
blob221d154f15cf28f37c1c1ac00ad7d03d84ebeb3c
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #the following user-defined variables are supported:
21 # YACCFLAGS
22 # LEXFLAGS
23 # CPPFLAGS
24 # CFLAGS
25 # CXXFLAGS
26 # OBJCFLAGS
27 # OBJCXXFLAGS
28 # LDFLAGS
30 # defined by platform
31 # gb_AsmObject_get_source (.asm on Windows, .s elsewhere)
32 # gb_AsmObject__command
33 # gb_CObject__command_pattern
34 # gb_LinkTarget_CXXFLAGS
35 # gb_LinkTarget_LDFLAGS
36 # gb_LinkTarget_INCLUDE
37 # gb_YaccTarget__command(grammar-file, stem-for-message, source-target, include-target)
39 # enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined]
40 gb_LinkTarget__debug_enabled = \
41 $(and $(if $(filter -$(1),$(ENABLE_DEBUGINFO_FOR)),,$(true)),\
42 $(or $(gb_Module_CURRENTMODULE_DEBUG_ENABLED),\
43 $(filter $(1),$(ENABLE_DEBUGINFO_FOR))))
45 # debug flags, if ENABLE_DEBUG is set and the LinkTarget is named
46 # in the list of libraries of ENABLE_DEBUGINFO_FOR
47 gb_LinkTarget__get_debugcflags=$(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(if $(call gb_LinkTarget__debug_enabled,$(1)),$(gb_DEBUG_CFLAGS)) $(if $(filter $(true),$(gb_SYMBOL)),$(gb_DEBUGINFO_FLAGS))
48 gb_LinkTarget__get_debugcxxflags=$(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) $(if $(call gb_LinkTarget__debug_enabled,$(1)),$(gb_DEBUG_CFLAGS)) $(if $(filter $(true),$(gb_SYMBOL)),$(gb_DEBUGINFO_FLAGS))
50 # similar for LDFLAGS, use linker optimization flags in non-debug case,
51 # but moreover strip debug from libraries for which debuginfo is not wanted
52 # (some libraries reuse .o files from other libraries, notably unittests)
53 gb_LinkTarget__get_stripldflags=$(if $(strip $(CFLAGS)$(CXXFLAGS)$(OBJCFLAGS)$(OBJCXXFLAGS)$(LDFLAGS)),,$(gb_LINKERSTRIPDEBUGFLAGS))
54 gb_LinkTarget__get_debugldflags=$(if $(call gb_LinkTarget__debug_enabled,$(1)),,$(gb_LINKEROPTFLAGS) $(call gb_LinkTarget__get_stripldflags,$(1)))
56 # generic cflags/cxxflags to use (optimization flags, debug flags)
57 # user supplied CFLAGS/CXXFLAGS override default debug/optimization flags
58 # call gb_LinkTarget__get_cflags,linktargetmakefilename
59 gb_LinkTarget__get_cflags=$(if $(CFLAGS),$(CFLAGS),$(call gb_LinkTarget__get_debugcflags,$(1)))
60 gb_LinkTarget__get_objcflags=$(if $(OBJCFLAGS),$(OBJCFLAGS),$(call gb_LinkTarget__get_debugcflags,$(1)))
61 gb_LinkTarget__get_cxxflags=$(if $(CXXFLAGS),$(CXXFLAGS),$(call gb_LinkTarget__get_debugcxxflags,$(1)))
62 gb_LinkTarget__get_objcxxflags=$(if $(OBJCXXFLAGS),$(OBJCXXFLAGS),$(call gb_LinkTarget__get_debugcxxflags,$(1)))
63 gb_LinkTarget__get_cxxclrflags=$(call gb_LinkTarget__get_debugcxxflags,$(1))
64 # call gb_LinkTarget__get_ldflags,linktargetmakefilename
65 gb_LinkTarget__get_ldflags=$(if $(LDFLAGS),$(LDFLAGS),$(call gb_LinkTarget__get_debugldflags,$(1)))
67 gb_LinkTarget_LAYER_LINKPATHS := \
68 URELIB:URELIB. \
69 UREBIN:URELIB. \
70 SDKBIN:URELIB. \
71 OOO:URELIB+OOO. \
72 SHLXTHDL:. \
73 OXT:OXT. \
74 NONE:URELIB+OOO+NONE. \
77 # Used to run a compiler plugin tool.
79 # At least for now, these definitions are generic enough so that they can be
80 # shared across all current use cases (COMPILER_EXTERNAL_TOOL,
81 # COMPILER_PLUGIN_TOOL) on all relevant toolchains (GCC?, Clang, clang-cl). If
82 # it ever becomes necessary, they can be moved to e.g.
83 # platform/com_{GCC,MSC}_class.mk and made different there.
85 # $(call gb_CObject__tool_command,relative-source,source)
86 define gb_CObject__tool_command
87 $(call gb_Output_announce,$(1).c,$(true),C ,3)
88 $(call gb_Helper_abbreviate_dirs,\
89 ICECC=no CCACHE_DISABLE=1 \
90 $(gb_CC) \
91 $(DEFS) \
92 $(gb_LTOFLAGS) \
93 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
94 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
95 $(gb_COMPILER_PLUGINS) \
96 $(T_CFLAGS) $(T_CFLAGS_APPEND) \
97 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
98 -c $(2) \
99 -I$(dir $(2)) \
100 $(INCLUDE) \
102 endef
103 define gb_ObjCObject__tool_command
104 $(call gb_Output_announce,$(1).m,$(true),OCC,3)
105 $(call gb_Helper_abbreviate_dirs,\
106 ICECC=no CCACHE_DISABLE=1 \
107 $(gb_CC) \
108 $(DEFS) \
109 $(gb_LTOFLAGS) \
110 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
111 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
112 $(gb_COMPILER_PLUGINS) \
113 $(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND) \
114 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
115 -c $(2) \
116 -I$(dir $(2)) \
117 $(INCLUDE) \
119 endef
120 define gb_CxxObject__tool_command
121 $(call gb_Output_announce,$(1).cxx,$(true),CXX,3)
122 $(call gb_Helper_abbreviate_dirs,\
123 ICECC=no CCACHE_DISABLE=1 \
124 $(gb_CXX) \
125 $(DEFS) \
126 $(gb_LTOFLAGS) \
127 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
128 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
129 $(gb_COMPILER_PLUGINS) \
130 $(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) \
131 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
132 -c $(2) \
133 -I$(dir $(2)) \
134 $(INCLUDE) \
136 endef
137 define gb_ObjCxxObject__tool_command
138 $(call gb_Output_announce,$(1).mm,$(true),OCX,3)
139 $(call gb_Helper_abbreviate_dirs,\
140 ICECC=no CCACHE_DISABLE=1 \
141 $(gb_CXX) \
142 $(DEFS) \
143 $(gb_LTOFLAGS) \
144 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
145 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
146 $(gb_COMPILER_PLUGINS) \
147 $(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND) \
148 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
149 -c $(2) \
150 -I$(dir $(2)) \
151 $(INCLUDE) \
153 endef
154 define gb_CxxClrObject__tool_command
155 $(call gb_Output_announce,$(1).cxx,$(true),CLR,3)
156 $(call gb_Helper_abbreviate_dirs,\
157 ICECC=no CCACHE_DISABLE=1 \
158 $(gb_CXX) \
159 $(DEFS) \
160 $(gb_LTOFLAGS) \
161 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
162 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
163 $(gb_COMPILER_PLUGINS) \
164 $(T_CXXCLRFLAGS) $(T_CXXCLRFLAGS_APPEND) \
165 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
166 -c $(2) \
167 -I$(dir $(2)) \
168 $(INCLUDE) \
170 endef
173 # Overview of dependencies and tasks of LinkTarget
175 # target task depends on
176 # LinkTarget linking AsmObject CObject CxxObject GenCObject GenCxxObject ObjCObject ObjCxxObject CxxClrObject GenCxxClrObject
177 # LinkTarget/headers
178 # LinkTarget/dep joined dep file AsmObject/dep CObject/dep CxxObject/dep GenCObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep CxxClrObject/dep GenCxxClrObject/dep
179 # | LinkTarget/headers
180 # LinkTarget/headers all headers available
181 # including own generated
182 # PCH precompiled headers LinkTarget/headers
183 # CObject plain c compile | LinkTarget/headers
184 # CxxObject c++ compile | LinkTarget/headers PCH
185 # GenCObject plain c compile from | LinkTarget/headers
186 # generated source
187 # GenCxxObject C++ compile from | LinkTarget/headers PCH
188 # generated source
189 # ObjCObject objective c compile | LinkTarget/headers
190 # ObjCxxObject objective c++ compile | LinkTarget/headers
191 # CxxClrObject C++ CLR compile | LinkTarget/headers
192 # GenCxxClrObject C++ CLR compile from | LinkTarget/headers
193 # generated source
195 # AsmObject asm compile | LinkTarget
197 # CObject/dep dependencies these targets generate empty dep files
198 # CxxObject/dep dependencies that are populated upon compile
199 # GenCObject/dep dependencies
200 # GenCxxObject/dep dependencies
201 # ObjCObject/dep dependencies
202 # ObjCxxObject/dep dependencies
203 # CxxClrObject/dep dependencies
204 # GenCxxClrObject/dep dependencies
205 # AsmObject/dep dependencies
207 # LinkTarget/headers means gb_LinkTarget_get_headers_target etc.
208 # dependencies prefixed with | are build-order only dependencies
211 # check that objects are only linked into one link target:
212 # multiple linking may cause problems because different link targets may
213 # require different compiler flags
214 define gb_Object__owner
215 $$(if $$(OBJECTOWNER),\
216 $$(call gb_Output_error,fdo#47246: $(1) is linked in by $$(OBJECTOWNER) $(2)))$(2)
217 endef
219 # For every object there is a dep file (if gb_FULLDEPS is active).
220 # The dep file depends on the object: the Object__command also updates the
221 # dep file as a side effect.
222 # In the dep file rule just touch it so it's newer than the object.
224 ifneq ($(FORCE_COMPILE_ALL),)
225 # This one only exists to force .c/.cxx "rebuilds" when running a compiler tool.
226 .PHONY: force_compile_all_target
227 force_compile_all_target:
228 gb_FORCE_COMPILE_ALL_TARGET := force_compile_all_target
229 endif
231 # CObject class
233 gb_CObject_get_source = $(1)/$(2).c
235 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
236 $(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_ALL_TARGET)
237 $(call gb_CObject__tool_command,$*,$<)
238 else
239 $(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%)
240 $(call gb_Output_announce,$*.c,$(true),$(if $(COMPILER_TEST),C? ,C ),3)
241 $(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$<,$(call gb_CObject_get_dep_target,$*),$(COMPILER_PLUGINS))
242 endif
244 # Note: if the *Object_dep_target does not exist it will be created by
245 # concat-deps as PHONY
246 ifeq ($(gb_FULLDEPS),$(true))
247 $(dir $(call gb_CObject_get_dep_target,%)).dir :
248 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
250 $(dir $(call gb_CObject_get_dep_target,%))%/.dir :
251 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
253 $(call gb_CObject_get_dep_target,%) :
254 $(if $(wildcard $@),touch $@)
256 endif
259 # CxxObject class
261 gb_CxxObject_get_source = $(1)/$(2).cxx
263 # Only enable PCH if the PCH_CXXFLAGS and the PCH_DEFS (from the linktarget)
264 # are the same as the T_CXXFLAGS and DEFS we want to use for this object. This
265 # should usually be the case. The DEFS/T_CXXFLAGS would have to be manually
266 # overridden for one object file for them to differ. PCH_CXXFLAGS/PCH_DEFS
267 # should never be overridden on an object -- they should be the same as for the
268 # whole linktarget. In general it should be cleaner to use a static library
269 # compiled with different flags and link that in rather than mixing different
270 # flags in one linktarget.
271 define gb_CxxObject__set_pchflags
272 ifeq ($(gb_ENABLE_PCH),$(true))
273 ifneq ($(strip $$(PCH_NAME)),)
274 ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)),$$(sort $$(T_CXXFLAGS) $$(T_CXXFLAGS_APPEND) $$(DEFS)))
275 $$@ : PCHFLAGS := $$(call gb_PrecompiledHeader_get_enableflags,$$(PCH_NAME))
276 else
277 $$(info No precompiled header available for $$*.cxx .)
278 $$(info precompiled header flags : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)))
279 $$(info . object flags : $$(sort $$(T_CXXFLAGS) $$(T_CXXFLAGS_APPEND) $$(DEFS)))
280 $$@ : PCHFLAGS :=
281 endif
282 endif
283 endif
284 endef
286 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
287 $(call gb_CxxObject_get_target,%) : $(call gb_CxxObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_ALL_TARGET)
288 $(call gb_CxxObject__tool_command,$*,$<)
289 else
290 $(call gb_CxxObject_get_target,%) : $(call gb_CxxObject_get_source,$(SRCDIR),%)
291 $(call gb_Output_announce,$*.cxx,$(true),$(if $(COMPILER_TEST),CPT,CXX),3)
292 $(eval $(gb_CxxObject__set_pchflags))
293 $(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) $(if $(COMPILER_TEST),$(gb_COMPILER_TEST_FLAGS)),$<,$(call gb_CxxObject_get_dep_target,$*),$(COMPILER_PLUGINS))
294 endif
296 ifeq ($(gb_FULLDEPS),$(true))
297 $(dir $(call gb_CxxObject_get_dep_target,%)).dir :
298 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
300 $(dir $(call gb_CxxObject_get_dep_target,%))%/.dir :
301 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
303 $(call gb_CxxObject_get_dep_target,%) :
304 $(if $(wildcard $@),touch $@,\
305 $(eval $(gb_CxxObject__set_pchflags)))
307 endif
310 # GenCObject class
312 gb_GenCObject_get_source = $(WORKDIR)/$(1).c
314 $(call gb_GenCObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET)
315 $(call gb_Output_announce,$*.c,$(true),C ,3)
316 test -f $(call gb_GenCObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenCObject_get_source,$*)" && false)
317 $(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$(call gb_GenCObject_get_source,$*),$(call gb_GenCObject_get_dep_target,$*),$(COMPILER_PLUGINS))
319 ifeq ($(gb_FULLDEPS),$(true))
320 $(dir $(call gb_GenCObject_get_dep_target,%)).dir :
321 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
323 $(dir $(call gb_GenCObject_get_dep_target,%))%/.dir :
324 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
326 $(call gb_GenCObject_get_dep_target,%) :
327 $(if $(wildcard $@),touch $@)
329 endif
332 # GenCxxObject class
334 gb_GenCxxObject_get_source = $(WORKDIR)/$(1).$(gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(2)))
336 $(call gb_GenCxxObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET)
337 $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),$(true),CXX,3)
338 test -f $(GEN_CXX_SOURCE) || (echo "Missing generated source file $(GEN_CXX_SOURCE)" && false)
339 $(eval $(gb_CxxObject__set_pchflags))
340 $(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND),$(GEN_CXX_SOURCE),$(call gb_GenCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS))
342 ifeq ($(gb_FULLDEPS),$(true))
343 $(dir $(call gb_GenCxxObject_get_dep_target,%)).dir :
344 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
346 $(dir $(call gb_GenCxxObject_get_dep_target,%))%/.dir :
347 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
349 $(call gb_GenCxxObject_get_dep_target,%) :
350 $(if $(wildcard $@),touch $@,\
351 $(eval $(gb_CxxObject__set_pchflags)))
353 endif
356 # GenCxxClrObject class
358 gb_GenCxxClrObject_get_source = $(WORKDIR)/$(1).$(gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(2)))
360 $(call gb_GenCxxClrObject_get_target,%) : $(gb_FORCE_COMPILE_ALL_TARGET)
361 $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),$(true),CLR,3)
362 test -f $(GEN_CXXCLR_SOURCE) || (echo "Missing generated source file $(GEN_CXXCLR_SOURCE)" && false)
363 $(call gb_CObject__command_pattern,$@,$(T_CXXCLRFLAGS) $(T_CXXCLRFLAGS_APPEND),$(GEN_CXXCLR_SOURCE),$(call gb_GenCxxClrObject_get_dep_target,$*),$(COMPILER_PLUGINS))
365 ifeq ($(gb_FULLDEPS),$(true))
366 $(dir $(call gb_GenCxxClrObject_get_dep_target,%)).dir :
367 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
369 $(dir $(call gb_GenCxxClrObject_get_dep_target,%))%/.dir :
370 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
372 $(call gb_GenCxxClrObject_get_dep_target,%) :
373 $(if $(wildcard $@),touch $@)
375 endif
378 # YaccTarget class
380 # XXX: This is more complicated than necessary, but we cannot just use
381 # the generated C++ file as the main target, because we need to let the
382 # header depend on that to ensure the header is present before anything
383 # tries to use it.
385 gb_YaccTarget_get_source = $(1)/$(2).y
387 .PHONY : $(call gb_YaccTarget_get_clean_target,%)
388 $(call gb_YaccTarget_get_clean_target,%) :
389 $(call gb_Output_announce,$*,$(false),YAC,3)
390 $(call gb_Helper_abbreviate_dirs,\
391 rm -f $(call gb_YaccTarget_get_grammar_target,$*) $(call gb_YaccTarget_get_header_target,$*) $(call gb_YaccTarget_get_target,$*))
393 $(call gb_YaccTarget_get_target,%) : $(call gb_YaccTarget_get_source,$(SRCDIR),%)
394 $(call gb_YaccTarget__command,$<,$*,$@,$(call gb_YaccTarget_get_header_target,$*),$(call gb_YaccTarget_get_grammar_target,$*))
396 # call gb_YaccTarget_YaccTarget,yacctarget
397 define gb_YaccTarget_YaccTarget
398 $(call gb_YaccTarget_get_grammar_target,$(1)) : $(call gb_YaccTarget_get_target,$(1))
399 touch $$@
400 $(call gb_YaccTarget_get_header_target,$(1)) : $(call gb_YaccTarget_get_target,$(1))
401 touch $$@
403 endef
405 gb_YACC := bison
408 # LexTarget class
410 gb_LexTarget_get_source = $(1)/$(2).l
412 .PHONY : $(call gb_LexTarget_get_clean_target,%)
413 $(call gb_LexTarget_get_clean_target,%) :
414 $(call gb_Output_announce,$*,$(false),LEX,3)
415 $(call gb_Helper_abbreviate_dirs,\
416 rm -f $(call gb_LexTarget_get_scanner_target,$*) $(call gb_LexTarget_get_target,$*))
418 $(call gb_LexTarget_get_target,%) : $(call gb_LexTarget_get_source,$(SRCDIR),%)
419 $(call gb_LexTarget__command,$<,$*,$@,$(call gb_LexTarget_get_scanner_target,$*))
421 # gb_LexTarget_LexTarget(scanner-file)
422 define gb_LexTarget_LexTarget
423 $(call gb_LexTarget_get_scanner_target,$(1)) : $(call gb_LexTarget_get_target,$(1))
424 touch $$@
426 endef
428 # gb_LexTarget__command(scanner-file, stem-for-message, done-pseudo-target, source-target)
429 define gb_LexTarget__command
430 $(call gb_Output_announce,$(2),$(true),LEX,3)
431 $(call gb_Helper_abbreviate_dirs,\
432 mkdir -p $(dir $(3)) && \
433 $(FLEX) $(T_LEXFLAGS) -o$(4) $(1) && touch $(3) )
434 endef
437 # ObjCxxObject class
440 gb_ObjCxxObject_get_source = $(1)/$(2).mm
442 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
443 $(call gb_ObjCxxObject_get_target,%) : $(call gb_ObjCxxObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_ALL_TARGET)
444 $(call gb_ObjCxxObject__tool_command,$*,$<)
445 else
446 $(call gb_ObjCxxObject_get_target,%) : $(call gb_ObjCxxObject_get_source,$(SRCDIR),%)
447 $(call gb_Output_announce,$*.mm,$(true),$(if $(COMPILER_TEST),O?X,OCX),3)
448 $(call gb_CObject__command_pattern,$@,$(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND),$<,$(call gb_ObjCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS))
449 endif
451 ifeq ($(gb_FULLDEPS),$(true))
452 $(dir $(call gb_ObjCxxObject_get_dep_target,%)).dir :
453 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
455 $(dir $(call gb_ObjCxxObject_get_dep_target,%))%/.dir :
456 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
458 $(call gb_ObjCxxObject_get_dep_target,%) :
459 $(if $(wildcard $@),touch $@)
461 endif
464 # ObjCObject class
467 gb_ObjCObject_get_source = $(1)/$(2).m
469 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
470 $(call gb_ObjCObject_get_target,%) : $(call gb_ObjCObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_ALL_TARGET)
471 $(call gb_ObjCObject__tool_command,$*,$<)
472 else
473 $(call gb_ObjCObject_get_target,%) : $(call gb_ObjCObject_get_source,$(SRCDIR),%)
474 $(call gb_Output_announce,$*.m,$(true),$(if $(COMPILER_TEST),O?C,OCC),3)
475 $(call gb_CObject__command_pattern,$@,$(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND),$<,$(call gb_ObjCObject_get_dep_target,$*),$(COMPILER_PLUGINS))
476 endif
478 ifeq ($(gb_FULLDEPS),$(true))
479 $(dir $(call gb_ObjCObject_get_dep_target,%)).dir :
480 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
482 $(dir $(call gb_ObjCObject_get_dep_target,%))%/.dir :
483 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
485 $(call gb_ObjCObject_get_dep_target,%) :
486 $(if $(wildcard $@),touch $@)
488 endif
491 # CxxClrObject class
494 gb_CxxClrObject_get_source = $(1)/$(2).cxx
496 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
497 $(call gb_CxxClrObject_get_target,%) : $(call gb_CxxClrObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_ALL_TARGET)
498 $(call gb_CxxClrObject__tool_command,$*,$<)
499 else
500 $(call gb_CxxClrObject_get_target,%) : $(call gb_CxxClrObject_get_source,$(SRCDIR),%)
501 $(call gb_Output_announce,$*.cxx,$(true),$(if $(COMPILER_TEST),C?R,CLR),3)
502 $(call gb_CObject__command_pattern,$@,$(T_CXXCLRFLAGS) $(T_CXXCLRFLAGS_APPEND),$<,$(call gb_CxxClrObject_get_dep_target,$*),$(COMPILER_PLUGINS))
503 endif
505 ifeq ($(gb_FULLDEPS),$(true))
506 $(dir $(call gb_CxxClrObject_get_dep_target,%)).dir :
507 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
509 $(dir $(call gb_CxxClrObject_get_dep_target,%))%/.dir :
510 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
512 $(call gb_CxxClrObject_get_dep_target,%) :
513 $(if $(wildcard $@),touch $@)
515 endif
518 # AsmObject class
520 $(call gb_AsmObject_get_target,%) : $(call gb_AsmObject_get_source,$(SRCDIR),%)
521 $(call gb_AsmObject__command,$@,$*,$<,$(call gb_AsmObject_get_dep_target,$*))
523 ifeq ($(gb_FULLDEPS),$(true))
524 $(dir $(call gb_AsmObject_get_dep_target,%)).dir :
525 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
527 $(dir $(call gb_AsmObject_get_dep_target,%))%/.dir :
528 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
530 $(call gb_AsmObject_get_dep_target,%) :
531 $(if $(wildcard $@),touch $@)
533 endif
536 # LinkTarget class
538 gb_LinkTarget_DEFAULTDEFS := $(gb_GLOBALDEFS)
540 .PHONY : $(WORKDIR)/Clean/LinkTarget/%
541 $(WORKDIR)/Clean/LinkTarget/% :
542 $(call gb_Output_announce,$*,$(false),LNK,4)
543 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
544 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
545 $(foreach object,$(COBJECTS),$(call gb_CObject_get_dep_target,$(object))) \
546 $(foreach object,$(COBJECTS),$(call gb_CObject_get_dwo_target,$(object))) \
547 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
548 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dep_target,$(object))) \
549 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dwo_target,$(object))) \
550 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
551 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dep_target,$(object))) \
552 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dwo_target,$(object))) \
553 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
554 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object))) \
555 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dwo_target,$(object))) \
556 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_target,$(object))) \
557 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_dep_target,$(object))) \
558 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_dwo_target,$(object))) \
559 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
560 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dep_target,$(object))) \
561 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dwo_target,$(object))) \
562 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
563 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_dep_target,$(object))) \
564 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_dwo_target,$(object))) \
565 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
566 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \
567 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dwo_target,$(object))) \
568 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_target,$(object))) \
569 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dep_target,$(object))) \
570 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dwo_target,$(object))) \
571 $(call gb_LinkTarget_get_target,$(LINKTARGET)) \
572 $(call gb_LinkTarget_get_dep_target,$(LINKTARGET)) \
573 $(call gb_LinkTarget_get_headers_target,$(LINKTARGET)) \
574 $(call gb_LinkTarget_get_objects_list,$(LINKTARGET)) \
575 $(ILIBTARGET) \
576 $(AUXTARGETS)) && \
577 cat $${RESPONSEFILE} /dev/null | $(if $(filter WNT,$(OS)),env -i PATH="$$PATH") xargs -n 200 rm -fr && \
578 rm -f $${RESPONSEFILE}
581 # cat the deps of all objects in one file, then we need only open that one file
582 # call gb_LinkTarget__command_dep,dep_target,linktargetname
583 define gb_LinkTarget__command_dep
584 $(call gb_Output_announce,LNK:$(2),$(true),DEP,1)
585 $(call gb_Helper_abbreviate_dirs,\
586 mkdir -p $(dir $(1)) && \
587 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
588 $(foreach object,$(COBJECTS),$(call gb_CObject_get_dep_target,$(object))) \
589 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dep_target,$(object))) \
590 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dep_target,$(object)))\
591 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object)))\
592 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_dep_target,$(object)))\
593 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dep_target,$(object)))\
594 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_dep_target,$(object))) \
595 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \
596 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dep_target,$(object))) \
597 ) && \
598 $(call gb_Executable_get_command,concat-deps) $${RESPONSEFILE} > $(1)) && \
599 rm -f $${RESPONSEFILE}
601 endef
603 # call gb_LinkTarget__command_objectlist,linktarget
604 define gb_LinkTarget__command_objectlist
605 TEMPFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
606 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
607 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
608 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
609 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
610 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_target,$(object))) \
611 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
612 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
613 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
614 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_target,$(object))) \
615 $(PCHOBJS)) && \
616 $(if $(EXTRAOBJECTLISTS),cat $(EXTRAOBJECTLISTS) >> $${TEMPFILE} && ) \
617 mv $${TEMPFILE} $(1)
619 endef
621 $(WORKDIR)/LinkTarget/%/.dir :
622 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
624 # Target for the .exports of the shared library, to speed up incremental build.
625 # This deliberately does nothing if the file exists; the file is actually
626 # written in gb_LinkTarget__command_dynamiclink.
627 # Put this pattern rule here so it overrides the one below.
628 # (this is rather ugly: because of % the functions cannot be used)
629 $(WORKDIR)/LinkTarget/Library/%.exports :
630 $(if $(wildcard $@),,mkdir -p $(dir $@) && touch $@)
632 # This recipe actually also builds the dep-target as a side-effect, which
633 # is an optimization to reduce incremental build time.
634 # (with exception for concat-dep executable itself which does not exist yet...)
635 $(WORKDIR)/LinkTarget/% : $(gb_Helper_MISCDUMMY)
636 $(call gb_LinkTarget__command_impl,$@,$*)
638 # call gb_LinkTarget__make_installed_rule,linktarget
639 define gb_LinkTarget__make_installed_rule
640 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_LinkTarget_get_headers_target,$(1))
641 $$(call gb_LinkTarget__command_impl,$(call gb_LinkTarget_get_target,$(1)),$(call gb_LinkTarget__get_workdir_linktargetname,$(1)))
643 endef
645 # it's not possible to use a pattern rule for files in INSTDIR because
646 # it would inevitably conflict with the pattern rule for Package
647 # (especially since external libraries are delivered via Package)
648 # call gb_LinkTarget__command_impl,linktargettarget,linktargetname
649 define gb_LinkTarget__command_impl
650 $(if $(gb_FULLDEPS),\
651 $(if $(findstring concat-deps,$(2)),,\
652 $(call gb_LinkTarget__command_dep,$(call gb_LinkTarget_get_dep_target,$(2)).tmp,$(2)) \
653 mv $(call gb_LinkTarget_get_dep_target,$(2)).tmp $(call gb_LinkTarget_get_dep_target,$(2))))
654 $(if $(filter $(2),$(foreach lib,$(gb_MERGEDLIBS),$(call gb_Library__get_workdir_linktargetname,$(lib)))),\
655 $(if $(filter $(true),$(call gb_LinkTarget__is_build_lib,$(2))),\
656 $(call gb_LinkTarget__command,$(1),$(2)),\
657 mkdir -p $(dir $(1)) && echo invalid - merged lib > $(1) \
658 $(if $(SOVERSIONSCRIPT),&& echo invalid - merged lib > $(WORKDIR)/LinkTarget/$(2))),\
659 $(if $(filter-out CompilerTest,$(TARGETTYPE)), \
660 $(call gb_LinkTarget__command,$(1),$(2))))
661 $(call gb_LinkTarget__command_objectlist,$(WORKDIR)/LinkTarget/$(2).objectlist)
662 endef
664 ifeq ($(gb_FULLDEPS),$(true))
665 $(call gb_LinkTarget_get_dep_target,%) : $(call gb_Executable_get_runtime_dependencies,concat-deps)
666 $(call gb_LinkTarget__command_dep,$@,$*)
667 endif
669 # Ok, this is some dark voodoo: When declaring a linktarget with
670 # gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the
671 # target. When the rule for the headertarget is executed and SELF does not
672 # match the target name, we are depending on a linktarget that was never
673 # declared. In a full build exclusively in gbuild that should never happen.
674 define gb_LinkTarget__get_headers_check
675 ifneq ($$(SELF),$$*)
676 $$(eval $$(call gb_Output_error,used LinkTarget $$* not defined))
677 endif
678 $$@ : COMMAND := $$(call gb_Helper_abbreviate_dirs, touch $$@)
680 endef
682 $(WORKDIR)/Headers/%/.dir :
683 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
685 # sadly because of the subdirectories can't have pattern deps on .dir here
686 $(WORKDIR)/Headers/% :
687 $(eval $(gb_LinkTarget__get_headers_check))
688 $(COMMAND)
690 # Explanation of some of the targets:
691 # - gb_LinkTarget_get_headers_target is the target that guarantees all headers
692 # from the linked against libraries and the linktargets own generated headers
693 # are generated.
694 # - gb_LinkTarget_get_target links the objects into a file in WORKDIR.
695 # gb_LinkTarget_get_target depends on gb_LinkTarget_get_headers_target.
696 # gb_LinkTarget_get_target depends additionally on the objects, which in turn
697 # depend build-order only on the gb_LinkTarget_get_headers_target. The build
698 # order-only dependency ensures all headers to be there for compiling and
699 # dependency generation without causing all objects to be rebuild when one
700 # header changes. Only the ones with an explicit dependency in their generated
701 # dependency file will be rebuild.
703 # gb_LinkTarget_get_target is the target that links the objects into a file in
704 # WORKDIR
705 # Explanation of some of the variables:
706 # - AUXTARGETS are the additionally generated files that need to be cleaned out
707 # on clean.
708 # - PCH_CXXFLAGS and PCH_DEFS are the flags that the precompiled headers will
709 # be compiled with. They should never be overridden in a single object
710 # files.
711 # - TARGETTYPE is the type of linktarget as some platforms need very different
712 # command to link different targettypes.
713 # - LIBRARY_X64 is only relevant for building a x64 library on windows.
714 # - PE_X86 is only relevant for building a x86 binaries on Windows.
716 # Since most variables are set on the linktarget and not on the object, the
717 # object learns about these setting via GNU makes scoping of target variables.
718 # Therefore it is important that objects are only directly depended on by the
719 # linktarget. This for example means that you cannot build a single object
720 # alone, because then you would directly depend on the object.
722 # A note about flags: because the overriding the global variables with a target
723 # local variable of the same name is considered obscure, the target local
724 # variables have a T_ prefix.
726 # call gb_LinkTarget_LinkTarget,linktarget,linktargetmakefilename,layer
727 define gb_LinkTarget_LinkTarget
728 $(call gb_LinkTarget_get_clean_target,$(1)) : LINKTARGET := $(1)
729 $(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS :=
730 $(call gb_LinkTarget_get_headers_target,$(1)) : SELF := $(call gb_LinkTarget__get_workdir_linktargetname,$(1))
731 $(call gb_LinkTarget_get_headers_target,$(1)) : \
732 | $(dir $(call gb_LinkTarget_get_headers_target,$(1))).dir \
733 $(dir $(call gb_LinkTarget_get_target,$(1))).dir \
734 $(dir $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1))).dir
735 $(call gb_LinkTarget_get_target,$(1)) : ILIBTARGET :=
736 $(call gb_LinkTarget_get_clean_target,$(1)) \
737 $(call gb_LinkTarget_get_target,$(1)) : COBJECTS :=
738 $(call gb_LinkTarget_get_clean_target,$(1)) \
739 $(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS :=
740 $(call gb_LinkTarget_get_clean_target,$(1)) \
741 $(call gb_LinkTarget_get_target,$(1)) : YACCOBJECT :=
742 $(call gb_LinkTarget_get_target,$(1)) : T_YACCFLAGS := $$(gb_LinkTarget_YYACFLAGS) $(YACCFLAGS)
743 $(call gb_LinkTarget_get_clean_target,$(1)) \
744 $(call gb_LinkTarget_get_target,$(1)) : LEXOBJECT :=
745 $(call gb_LinkTarget_get_target,$(1)) : T_LEXFLAGS := $$(gb_LinkTarget_LEXFLAGS) $(LEXFLAGS)
746 $(call gb_LinkTarget_get_clean_target,$(1)) \
747 $(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS :=
748 $(call gb_LinkTarget_get_clean_target,$(1)) \
749 $(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS :=
750 $(call gb_LinkTarget_get_clean_target,$(1)) \
751 $(call gb_LinkTarget_get_target,$(1)) : CXXCLROBJECTS :=
752 $(call gb_LinkTarget_get_clean_target,$(1)) \
753 $(call gb_LinkTarget_get_target,$(1)) : ASMOBJECTS :=
754 $(call gb_LinkTarget_get_clean_target,$(1)) \
755 $(call gb_LinkTarget_get_target,$(1)) : GENCOBJECTS :=
756 $(call gb_LinkTarget_get_clean_target,$(1)) \
757 $(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS :=
758 $(call gb_LinkTarget_get_clean_target,$(1)) \
759 $(call gb_LinkTarget_get_target,$(1)) : GENCXXCLROBJECTS :=
760 $(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS)
761 $(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS_APPEND :=
762 $(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
763 $(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS_APPEND :=
764 $(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
765 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS)
766 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS_APPEND :=
767 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS := $$(gb_LinkTarget_OBJCFLAGS)
768 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS_APPEND :=
769 $(call gb_LinkTarget_get_target,$(1)) : T_CXXCLRFLAGS := $$(gb_LinkTarget_CXXCLRFLAGS)
770 $(call gb_LinkTarget_get_target,$(1)) : T_CXXCLRFLAGS_APPEND :=
771 $(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS)
772 $(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS)
773 $(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE)
774 $(call gb_LinkTarget_get_target,$(1)) : T_LDFLAGS := $$(gb_LinkTarget_LDFLAGS) $(call gb_LinkTarget_get_linksearchpath_for_layer,$(3)) $(call gb_LinkTarget__get_ldflags,$(2))
775 $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS :=
776 $(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS :=
777 $(call gb_LinkTarget_get_target,$(1)) : T_LIBS :=
778 $(call gb_LinkTarget_get_target,$(1)) : TARGETTYPE :=
779 $(call gb_LinkTarget_get_target,$(1)) : LIBRARY_X64 :=
780 $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME :=
781 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJS :=
782 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJEX :=
783 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJNOEX :=
784 $(call gb_LinkTarget_get_target,$(1)) : PE_X86 :=
785 $(call gb_LinkTarget_get_target,$(1)) : PDBFILE :=
786 $(call gb_LinkTarget_get_target,$(1)) : TARGETGUI :=
787 $(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS :=
788 $(call gb_LinkTarget_get_target,$(1)) : NATIVERES :=
789 $(call gb_LinkTarget_get_target,$(1)) : VISIBILITY :=
790 $(call gb_LinkTarget_get_target,$(1)) : WARNINGS_NOT_ERRORS :=
791 $(call gb_LinkTarget_get_target,$(1)) : PLUGIN_WARNINGS_AS_ERRORS :=
792 $(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_CODE :=
793 $(call gb_LinkTarget_get_target,$(1)) : SOVERSIONSCRIPT :=
794 $(call gb_LinkTarget_get_target,$(1)) : COMPILER_TEST :=
796 ifeq ($(gb_FULLDEPS),$(true))
797 ifeq (depcache:,$(filter depcache,$(.FEATURES)):$(gb_PARTIAL_BUILD))
798 -includedepcache $(call gb_LinkTarget_get_dep_target,$(1))
799 else
800 -include $(call gb_LinkTarget_get_dep_target,$(1))
801 endif
802 $(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS :=
803 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS :=
804 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS :=
805 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS :=
806 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXCLROBJECTS :=
807 $(call gb_LinkTarget_get_dep_target,$(1)) : ASMOBJECTS :=
808 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS :=
809 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS :=
810 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXCLROBJECTS :=
811 $(call gb_LinkTarget_get_dep_target,$(1)) : YACCOBJECTS :=
812 endif
814 gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(1)) := cxx
816 # installed linktargets need a rule to build!
817 $(if $(findstring $(INSTDIR),$(1)),$(call gb_LinkTarget__make_installed_rule,$(1)))
819 endef
821 # call gb_LinkTarget_set_soversion_script,linktarget,soversionscript
822 define gb_LinkTarget_set_soversion_script
823 $(call gb_LinkTarget_get_target,$(1)) : $(2)
824 $(call gb_LinkTarget_get_target,$(1)) : SOVERSIONSCRIPT := $(2)
826 endef
828 # call gb_LinkTarget_add_defs,linktarget,defines
829 define gb_LinkTarget_add_defs
830 $(call gb_LinkTarget_get_target,$(1)) : DEFS += $(2)
831 $(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS += $(2)
832 endef
834 # call gb_LinkTarget_add_cflags,linktarget,cflags
835 define gb_LinkTarget_add_cflags
836 $(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS_APPEND += $(2)
837 endef
839 # call gb_LinkTarget_add_cxxflags,linktarget,cxxflags
840 define gb_LinkTarget_add_cxxflags
841 $(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS_APPEND += $(2)
842 $(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS += $(2)
843 endef
845 # call gb_LinkTarget_add_objcxxflags,linktarget,objcxxflags
846 define gb_LinkTarget_add_objcxxflags
847 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS_APPEND += $(2)
848 endef
850 # call gb_LinkTarget_add_objcflags,linktarget,objcflags
851 define gb_LinkTarget_add_objcflags
852 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS_APPEND += $(2)
854 endef
856 # call gb_LinkTarget_add_cxxclrflags,linktarget,cxxclrflags
857 define gb_LinkTarget_add_cxxclrflags
858 $(call gb_LinkTarget_get_target,$(1)) : T_CXXCLRFLAGS_APPEND += $(2)
859 endef
861 # call gb_LinkTarget__add_include,linktarget,includes
862 define gb_LinkTarget__add_include
863 $(call gb_LinkTarget_get_target,$(1)) : INCLUDE += -I$(2)
865 endef
867 # call gb_LinkTarget__check_srcdir_paths,linktarget,includepaths
868 define gb_LinkTarget__check_srcdir_paths
869 $(if $(filter-out $(wildcard $(2)),$(2)),\
870 $(call gb_Output_error,gb_LinkTarget_set_include: include paths $(filter-out $(wildcard $(2)),$(2)) do not exist) \
872 endef
874 # call gb_LinkTarget_set_include,linktarget,includes
875 define gb_LinkTarget_set_include
876 $(call gb_LinkTarget__check_srcdir_paths,$(1),\
877 $(patsubst -I%,%,$(filter -I$(SRCDIR)/%,$(filter-out -I$(WORKDIR)/%,$(2)))))
878 $(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $(2)
880 endef
882 # call gb_LinkTarget_add_ldflags,linktarget,ldflags
883 define gb_LinkTarget_add_ldflags
884 $(call gb_LinkTarget_get_target,$(1)) : T_LDFLAGS += $(2)
886 endef
888 # real use in RepositoryExternal.mk
889 # call gb_LinkTarget_set_ldflags,linktarget,ldflags
890 define gb_LinkTarget_set_ldflags
891 $(call gb_LinkTarget_get_target,$(1)) : T_LDFLAGS := $(2)
893 endef
895 # call gb_LinkTarget_add_libs,linktarget,libs
896 define gb_LinkTarget_add_libs
897 $(call gb_LinkTarget_get_target,$(1)) : T_LIBS += $(2)
898 $(if $(call gb_LinkTarget__is_merged,$(1)),\
899 $(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,merged)) : T_LIBS += $(2))
901 endef
903 # remove platform specific standard libraries for linktarget $(1)
904 # assumption is that adding these standard libs is always useful, but in very
905 # exceptional cases this disable method may be used
906 # call gb_LinkTarget_disable_standard_system_libs,linktarget
907 define gb_LinkTarget_disable_standard_system_libs
908 $(call gb_LinkTarget_get_target,$(1)) : T_LIBS := $$(filter-out $$(gb_STDLIBS),$$(T_LIBS))
910 endef
912 # call gb_LinkTarget__use_api,linktarget,api
913 define gb_LinkTarget__use_api
914 $(call gb_LinkTarget_get_headers_target,$(1)) : $(call gb_UnoApiHeadersTarget_get_target,$(2))
915 $(call gb_LinkTarget__add_include,$(1),$(call gb_UnoApiHeadersTarget_get_dir,$(2)))
917 endef
919 # call gb_LinkTarget_use_api,linktarget,apis
920 define gb_LinkTarget_use_api
921 $(foreach api,$(2),$(call gb_LinkTarget__use_api,$(1),$(api)))
923 endef
925 # call gb_LinkTarget_use_udk_api,linktarget
926 define gb_LinkTarget_use_udk_api
927 $(call gb_LinkTarget__use_api,$(1),udkapi)
928 endef
930 # call gb_LinkTarget_use_sdk_api,linktarget
931 define gb_LinkTarget_use_sdk_api
932 $(call gb_LinkTarget__use_api,$(1),udkapi)
933 $(call gb_LinkTarget__use_api,$(1),offapi)
934 endef
936 # call gb_LinkTarget__use_internal_api_one,linktarget,api,apiprefix
937 define gb_LinkTarget__use_internal_api_one
938 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
939 $(call gb_UnoApiHeadersTarget_get_$(3)target,$(2))
940 $(call gb_LinkTarget__add_include,$(1),$(call gb_UnoApiHeadersTarget_get_$(3)dir,$(2)))
942 endef
944 # call gb_LinkTarget__use_internal_api,linktarget,apis,apiprefix
945 define gb_LinkTarget__use_internal_api
946 $(foreach api,$(2),$(call gb_LinkTarget__use_internal_api_one,$(1),$(api),$(3)))
948 endef
950 # call gb_LinkTarget_use_internal_api,linktarget,api
951 define gb_LinkTarget_use_internal_api
952 $(call gb_LinkTarget__use_internal_api,$(1),$(2))
954 endef
956 # call gb_LinkTarget_use_internal_bootstrap_api,linktarget,api
957 define gb_LinkTarget_use_internal_bootstrap_api
958 $(call gb_LinkTarget__use_internal_api,$(1),$(2),bootstrap_)
960 endef
962 # call gb_LinkTarget_use_internal_comprehensive_api,linktarget,api
963 define gb_LinkTarget_use_internal_comprehensive_api
964 $(call gb_LinkTarget__use_internal_api,$(1),$(2),comprehensive_)
966 endef
968 define gb_PrintDeps_info
969 $(info LibraryDep: $(1) links against $(2))
970 endef
972 # avoid problem when a module is built partially but other modules that define
973 # needed libraries is not yet built: prevent invocation of pattern rule
974 # for library with invalid parameters by depending on the header target
975 define gb_LinkTarget__lib_dummy_depend
976 $(call gb_Library_get_target,$(1)) :| $(call gb_Library_get_headers_target,$(1))
978 endef
980 # call gb_LinkTarget__use_libraries,linktarget,requestedlibs,actuallibs,linktargetmakefilename
981 define gb_LinkTarget__use_libraries
983 # used by bin/module-deps.pl
984 ifneq ($(ENABLE_PRINT_DEPS),)
985 # exclude libraries in Library_merged
986 ifeq ($(filter $(1),$(foreach lib,$(gb_MERGEDLIBS),$(call gb_Library_get_linktarget,$(lib)))),)
987 $$(eval $$(call gb_PrintDeps_info,$(4),$(3)))
988 endif
989 endif
991 $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(3)
993 # depend on the exports of the library, not on the library itself
994 # for faster incremental builds when the ABI is unchanged
995 ifeq ($(DISABLE_DYNLOADING),)
996 $(call gb_LinkTarget_get_target,$(1)) : \
997 $(foreach lib,$(3),$(call gb_Library_get_exports_target,$(lib)))
998 endif
999 $(call gb_LinkTarget_get_headers_target,$(1)) : \
1000 $(foreach lib,$(2),$(call gb_Library_get_headers_target,$(lib)))
1001 $(foreach lib,$(2),$(call gb_LinkTarget__lib_dummy_depend,$(lib)))
1003 endef
1005 # libraries which are merged but need to be built for gb_BUILD_HELPER_TOOLS
1006 gb_BUILD_HELPER_LIBS := basegfx \
1007 comphelper \
1008 cppu \
1009 cppuhelper \
1010 i18nlangtag \
1011 reg \
1012 sal \
1013 salhelper \
1014 sax \
1015 store \
1016 tl \
1017 ucbhelper \
1018 unoidl \
1019 xmlreader \
1021 # tools libmerged depends on, so they link against gb_BUILD_HELPER_LIBS
1022 gb_BUILD_HELPER_TOOLS := $(foreach exe,\
1023 cppumaker \
1024 svidl \
1025 unoidl-check \
1026 unoidl-write \
1027 , $(call gb_Executable__get_workdir_linktargetname,$(exe)))
1029 # call gb_LinkTarget__is_build_lib,linktargetname
1030 define gb_LinkTarget__is_build_lib
1031 $(if $(filter $(call gb_LinkTarget__get_workdir_linktargetname,$(1)),$(foreach lib,$(gb_BUILD_HELPER_LIBS),$(call gb_Library__get_workdir_linktargetname,$(lib)))),$(true),$(false))
1032 endef
1034 # call gb_LinkTarget__is_build_tool,linktargetname
1035 define gb_LinkTarget__is_build_tool
1036 $(if $(filter $(call gb_LinkTarget__get_workdir_linktargetname,$(1)),$(call gb_BUILD_HELPER_TOOLS)),$(true),$(false))
1037 endef
1039 define gb_LinkTarget__is_merged
1040 $(filter $(1),$(foreach lib,$(gb_MERGEDLIBS),$(call gb_Library_get_linktarget,$(lib))))
1041 endef
1043 # call gb_LinkTarget_use_libraries,linktarget,libs
1044 define gb_LinkTarget_use_libraries
1045 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
1046 $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
1047 $$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk))
1048 endif
1050 ifeq ($(call gb_LinkTarget__is_build_tool,$(1)),$(true))
1051 $(call gb_LinkTarget__use_libraries,$(1),$(2),$(2),$(4))
1052 else
1053 $(call gb_LinkTarget__use_libraries,$(1),$(2),$(strip \
1054 $(if $(filter $(gb_MERGEDLIBS),$(2)), \
1055 $(if $(call gb_LinkTarget__is_merged,$(1)), \
1056 $(filter $(gb_MERGEDLIBS),$(2)), merged)) \
1057 $(filter-out $(gb_MERGEDLIBS),$(2)) \
1058 ),$(4))
1059 endif
1061 endef
1063 # avoid problem when a module is built partially but other modules that define
1064 # needed static libraries is not yet built: prevent invocation of pattern rule
1065 # for static library with invalid parameters by depending on the header target
1066 define gb_LinkTarget__static_lib_dummy_depend
1067 $(call gb_StaticLibrary_get_target,$(1)) :| \
1068 $(call gb_StaticLibrary_get_headers_target,$(1))
1070 endef
1072 # for a StaticLibrary, dependent libraries are not actually linked in
1073 # call gb_LinkTarget_use_static_libraries,linktarget,staticlibs
1074 define gb_LinkTarget_use_static_libraries
1075 $(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS += $$(if $$(filter-out StaticLibrary,$$(TARGETTYPE)),$(2))
1076 $(if $(call gb_LinkTarget__is_merged,$(1)),\
1077 $(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,merged)) : \
1078 LINKED_STATIC_LIBS += $$(if $$(filter-out StaticLibrary,$$(TARGETTYPE)),$(2)))
1080 ifeq ($(DISABLE_DYNLOADING),)
1081 $(call gb_LinkTarget_get_target,$(1)) : $(foreach lib,$(2),$(call gb_StaticLibrary_get_target,$(lib)))
1082 endif
1083 $(call gb_LinkTarget_get_headers_target,$(1)) : \
1084 $(foreach lib,$(2),$(call gb_StaticLibrary_get_headers_target,$(lib)))
1085 $(foreach lib,$(2),$(call gb_LinkTarget__static_lib_dummy_depend,$(lib)))
1087 endef
1089 # call gb_LinkTarget_add_cobject,linktarget,sourcefile,cflags,linktargetmakefilename
1090 define gb_LinkTarget_add_cobject
1091 $(if $(wildcard $(call gb_CObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_CObject_get_source,$(SRCDIR),$(2)))))
1092 $(call gb_LinkTarget_get_target,$(1)) : COBJECTS += $(2)
1093 $(call gb_LinkTarget_get_clean_target,$(1)) : COBJECTS += $(2)
1095 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_CObject_get_target,$(2))
1096 $(call gb_CObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1097 $(call gb_CObject_get_target,$(2)) : T_CFLAGS += $(call gb_LinkTarget__get_cflags,$(4)) $(3)
1098 $(call gb_CObject_get_target,$(2)) : \
1099 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1101 ifeq ($(gb_FULLDEPS),$(true))
1102 $(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS += $(2)
1103 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CObject_get_dep_target,$(2))
1104 $(call gb_CObject_get_dep_target,$(2)) :| $(dir $(call gb_CObject_get_dep_target,$(2))).dir
1105 $(call gb_CObject_get_target,$(2)) :| $(dir $(call gb_CObject_get_dep_target,$(2))).dir
1106 endif
1108 endef
1110 # call gb_LinkTarget_add_cxxobject,linktarget,sourcefile,cxxflags,linktargetmakefilename
1111 define gb_LinkTarget_add_cxxobject
1112 $(if $(wildcard $(call gb_CxxObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_CxxObject_get_source,$(SRCDIR),$(2)))))
1113 $(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2)
1114 $(call gb_LinkTarget_get_clean_target,$(1)) : CXXOBJECTS += $(2)
1116 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_CxxObject_get_target,$(2))
1117 $(call gb_CxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1118 $(call gb_CxxObject_get_target,$(2)) : T_CXXFLAGS += $(3)
1119 $(call gb_CxxObject_get_target,$(2)) : \
1120 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1121 ifeq ($(gb_ENABLE_PCH),$(true))
1122 $(call gb_CxxObject_get_target,$(2)) : $(call gb_PrecompiledHeader_get_timestamp,$(call gb_LinkTarget__get_workdir_linktargetname,$(1)))
1123 endif
1125 ifeq ($(gb_FULLDEPS),$(true))
1126 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS += $(2)
1127 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CxxObject_get_dep_target,$(2))
1128 $(call gb_CxxObject_get_dep_target,$(2)) :| $(dir $(call gb_CxxObject_get_dep_target,$(2))).dir
1129 $(call gb_CxxObject_get_target,$(2)) :| $(dir $(call gb_CxxObject_get_dep_target,$(2))).dir
1130 endif
1132 endef
1134 # call gb_LinkTarget_add_objcobject,linktarget,sourcefile,objcflags,linktargetmakefilename
1135 define gb_LinkTarget_add_objcobject
1136 $(if $(wildcard $(call gb_ObjCObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_ObjCObject_get_source,$(SRCDIR),$(2)))))
1137 $(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS += $(2)
1138 $(call gb_LinkTarget_get_clean_target,$(1)) : OBJCOBJECTS += $(2)
1140 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_ObjCObject_get_target,$(2))
1141 $(call gb_ObjCObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1142 $(call gb_ObjCObject_get_target,$(2)) : T_OBJCFLAGS += $(call gb_LinkTarget__get_objcflags,$(4)) $(3)
1143 $(call gb_ObjCObject_get_target,$(2)) : \
1144 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1146 ifeq ($(gb_FULLDEPS),$(true))
1147 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS += $(2)
1148 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_ObjCObject_get_dep_target,$(2))
1149 $(call gb_ObjCObject_get_dep_target,$(2)) :| $(dir $(call gb_ObjCObject_get_dep_target,$(2))).dir
1150 $(call gb_ObjCObject_get_target,$(2)) :| $(dir $(call gb_ObjCObject_get_dep_target,$(2))).dir
1151 endif
1153 endef
1155 # call gb_LinkTarget_add_objcxxobject,linktarget,sourcefile,objcxxflags,linktargetmakefilename
1156 define gb_LinkTarget_add_objcxxobject
1157 $(if $(wildcard $(call gb_ObjCxxObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_ObjCxxObject_get_source,$(SRCDIR),$(2)))))
1158 $(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS += $(2)
1159 $(call gb_LinkTarget_get_clean_target,$(1)) : OBJCXXOBJECTS += $(2)
1161 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_ObjCxxObject_get_target,$(2))
1162 $(call gb_ObjCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1163 $(call gb_ObjCxxObject_get_target,$(2)) : T_OBJCXXFLAGS += $(call gb_LinkTarget__get_objcxxflags,$(4)) $(3)
1164 $(call gb_ObjCxxObject_get_target,$(2)) : \
1165 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1167 ifeq ($(gb_FULLDEPS),$(true))
1168 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS += $(2)
1169 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_ObjCxxObject_get_dep_target,$(2))
1170 $(call gb_ObjCxxObject_get_dep_target,$(2)) :| $(dir $(call gb_ObjCxxObject_get_dep_target,$(2))).dir
1171 $(call gb_ObjCxxObject_get_target,$(2)) :| $(dir $(call gb_ObjCxxObject_get_dep_target,$(2))).dir
1172 endif
1174 endef
1176 # call gb_LinkTarget_add_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
1177 define gb_LinkTarget_add_cxxclrobject
1178 $(if $(wildcard $(call gb_CxxClrObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_CxxClrObject_get_source,$(SRCDIR),$(2)))))
1179 $(call gb_LinkTarget_get_target,$(1)) : CXXCLROBJECTS += $(2)
1180 $(call gb_LinkTarget_get_clean_target,$(1)) : CXXCLROBJECTS += $(2)
1182 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_CxxClrObject_get_target,$(2))
1183 $(call gb_CxxClrObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1184 $(call gb_CxxClrObject_get_target,$(2)) : T_CXXCLRFLAGS += $(call gb_LinkTarget__get_cxxclrflags,$(4)) $(3)
1185 $(call gb_CxxClrObject_get_target,$(2)) : \
1186 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1188 ifeq ($(gb_FULLDEPS),$(true))
1189 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXCLROBJECTS += $(2)
1190 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CxxClrObject_get_dep_target,$(2))
1191 $(call gb_CxxClrObject_get_dep_target,$(2)) :| $(dir $(call gb_CxxClrObject_get_dep_target,$(2))).dir
1192 $(call gb_CxxClrObject_get_target,$(2)) :| $(dir $(call gb_CxxClrObject_get_dep_target,$(2))).dir
1193 endif
1195 endef
1197 # call gb_LinkTarget_add_asmobject,linktarget,sourcefile
1198 define gb_LinkTarget_add_asmobject
1199 $(if $(wildcard $(call gb_AsmObject_get_source,$(SRCDIR),$(2))),,$(eval $(call gb_Output_error,No such source file $(call gb_AsmObject_get_source,$(SRCDIR),$(2)))))
1200 $(call gb_LinkTarget_get_target,$(1)) : ASMOBJECTS += $(2)
1201 $(call gb_LinkTarget_get_clean_target,$(1)) : ASMOBJECTS += $(2)
1203 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_AsmObject_get_target,$(2))
1204 $(call gb_AsmObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1205 $(call gb_AsmObject_get_target,$(2)) : \
1206 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1208 ifeq ($(gb_FULLDEPS),$(true))
1209 $(call gb_LinkTarget_get_dep_target,$(1)) : ASMOBJECTS += $(2)
1210 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_AsmObject_get_dep_target,$(2))
1211 $(call gb_AsmObject_get_dep_target,$(2)) :| $(dir $(call gb_AsmObject_get_dep_target,$(2))).dir
1212 $(call gb_AsmObject_get_target,$(2)) :| $(dir $(call gb_AsmObject_get_dep_target,$(2))).dir
1213 endif
1215 endef
1217 # call gb_LinkTarget_add_generated_c_object,linktarget,sourcefile,cflags,linktargetmakefilename
1218 define gb_LinkTarget_add_generated_c_object
1219 $(call gb_LinkTarget_get_target,$(1)) : GENCOBJECTS += $(2)
1220 $(call gb_LinkTarget_get_clean_target,$(1)) : GENCOBJECTS += $(2)
1222 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCObject_get_target,$(2))
1223 $(call gb_GenCObject_get_target,$(2)) : $(call gb_GenCObject_get_source,$(2))
1224 # Often gb_GenCObject_get_source does not have its own rule and is only a byproduct.
1225 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1226 $(call gb_GenCObject_get_source,$(2)) : | $(gb_Helper_MISCDUMMY)
1227 $(call gb_GenCObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1228 $(call gb_GenCObject_get_target,$(2)) : WARNINGS_NOT_ERRORS := $(true)
1229 $(call gb_GenCObject_get_target,$(2)) : T_CFLAGS += $(call gb_LinkTarget__get_cflags,$(4)) $(3)
1230 $(call gb_GenCObject_get_target,$(2)) : \
1231 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1233 ifeq ($(gb_FULLDEPS),$(true))
1234 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS += $(2)
1235 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenCObject_get_dep_target,$(2))
1236 $(call gb_GenCObject_get_dep_target,$(2)) :| $(dir $(call gb_GenCObject_get_dep_target,$(2))).dir
1237 $(call gb_GenCObject_get_target,$(2)) :| $(dir $(call gb_GenCObject_get_dep_target,$(2))).dir
1238 endif
1240 endef
1242 # call gb_LinkTarget_add_generated_cxx_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1243 define gb_LinkTarget_add_generated_cxx_object
1244 $(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS += $(2)
1245 $(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXOBJECTS += $(2)
1247 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCxxObject_get_target,$(2))
1248 $(call gb_GenCxxObject_get_target,$(2)) : $(call gb_GenCxxObject_get_source,$(2),$(1))
1249 # Often gb_GenCxxObject_get_source does not have its own rule and is only a byproduct.
1250 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1251 $(call gb_GenCxxObject_get_source,$(2),$(1)) : | $(gb_Helper_MISCDUMMY)
1252 $(call gb_GenCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1253 $(call gb_GenCxxObject_get_target,$(2)) : WARNINGS_NOT_ERRORS := $(true)
1254 $(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(3)
1255 $(call gb_GenCxxObject_get_target,$(2)) : \
1256 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1257 $(call gb_GenCxxObject_get_target,$(2)) : GEN_CXX_SOURCE := $(call gb_GenCxxObject_get_source,$(2),$(1))
1258 ifeq ($(gb_ENABLE_PCH),$(true))
1259 $(call gb_GenCxxObject_get_target,$(2)) : $(call gb_PrecompiledHeader_get_timestamp,$(call gb_LinkTarget__get_workdir_linktargetname,$(1)))
1260 endif
1262 ifeq ($(gb_FULLDEPS),$(true))
1263 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS += $(2)
1264 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenCxxObject_get_dep_target,$(2))
1265 $(call gb_GenCxxObject_get_dep_target,$(2)) :| $(dir $(call gb_GenCxxObject_get_dep_target,$(2))).dir
1266 $(call gb_GenCxxObject_get_target,$(2)) :| $(dir $(call gb_GenCxxObject_get_dep_target,$(2))).dir
1267 endif
1269 endef
1271 # call gb_LinkTarget_add_generated_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
1272 define gb_LinkTarget_add_generated_cxxclrobject
1273 $(call gb_LinkTarget_get_target,$(1)) : GENCXXCLROBJECTS += $(2)
1274 $(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXCLROBJECTS += $(2)
1276 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCxxClrObject_get_target,$(2))
1277 $(call gb_GenCxxClrObject_get_target,$(2)) : $(call gb_GenCxxClrObject_get_source,$(2),$(1))
1278 $(call gb_GenCxxClrObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1279 $(call gb_GenCxxClrObject_get_target,$(2)) : T_CXXCLRFLAGS += $(call gb_LinkTarget__get_cxxclrflags,$(4)) $(3)
1280 $(call gb_GenCxxClrObject_get_target,$(2)) : \
1281 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1282 $(call gb_GenCxxClrObject_get_target,$(2)) : GEN_CXXCLR_SOURCE := $(call gb_GenCxxClrObject_get_source,$(2),$(1))
1284 ifeq ($(gb_FULLDEPS),$(true))
1285 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXCLROBJECTS += $(2)
1286 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenCxxClrObject_get_dep_target,$(2))
1287 $(call gb_GenCxxClrObject_get_dep_target,$(2)) :| $(dir $(call gb_GenCxxClrObject_get_dep_target,$(2))).dir
1288 $(call gb_GenCxxClrObject_get_target,$(2)) :| $(dir $(call gb_GenCxxClrObject_get_dep_target,$(2))).dir
1289 endif
1291 endef
1293 # Add a bison grammar to the build.
1294 # call gb_LinkTarget_add_grammar,linktarget,yaccfile,linktargetmakefilename,cxxflags
1295 define gb_LinkTarget_add_grammar
1296 $(call gb_YaccTarget_YaccTarget,$(2))
1297 $(call gb_LinkTarget_add_generated_exception_object,$(1),YaccTarget/$(2),$(3),$(if $(filter GCC,$(COM)),-Wno-unused-macros))
1298 $(call gb_GenCxxObject_get_target,YaccTarget/$(2)): PLUGIN_WARNINGS_AS_ERRORS := $(true)
1299 $(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_YaccTarget_get_clean_target,$(2))
1300 $(call gb_LinkTarget_get_headers_target,$(1)) : $(call gb_YaccTarget_get_header_target,$(2))
1301 $(call gb_LinkTarget__add_include,$(1),$(dir $(call gb_YaccTarget_get_header_target,$(2))))
1303 endef
1305 # Add bison grammars to the build.
1306 # call gb_LinkTarget_add_grammars,linktarget,yaccfiles,ignored,linktargetmakefilename
1307 define gb_LinkTarget_add_grammars
1308 $(foreach grammar,$(2),$(call gb_LinkTarget_add_grammar,$(1),$(grammar),$(4)))
1309 endef
1311 # Add a flex scanner to the build.
1312 # call gb_LinkTarget_add_scanner,linktarget,lexfile,linktargetmakefilename,cxxflags
1313 define gb_LinkTarget_add_scanner
1314 $(call gb_LexTarget_LexTarget,$(2))
1315 $(call gb_LinkTarget_add_generated_exception_object,$(1),LexTarget/$(2),$(3),$(if $(filter GCC,$(COM)),-Wno-unused-macros))
1316 $(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_LexTarget_get_clean_target,$(2))
1318 endef
1320 # Add flex scanners to the build.
1321 # call gb_LinkTarget_add_scanners,linktarget,lexfiles,ignored,linktargetmakefilename
1322 define gb_LinkTarget_add_scanners
1323 $(foreach scanner,$(2),$(call gb_LinkTarget_add_scanner,$(1),$(scanner),$(4)))
1325 endef
1327 # call gb_LinkTarget_add_exception_object,linktarget,sourcefile,linktargetmakefilename
1328 define gb_LinkTarget_add_exception_object
1329 $(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(call gb_LinkTarget__get_cxxflags,$(3)))
1330 endef
1332 # call gb_LinkTarget__use_linktarget_objects,linktarget,linktargets
1333 define gb_LinkTarget__use_linktarget_objects
1334 $(call gb_LinkTarget_get_target,$(1)) : $(foreach linktarget,$(2),$(call gb_LinkTarget_get_target,$(linktarget)))
1335 ifneq ($(OS),iOS)
1336 $(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS += $(foreach linktarget,$(2),$(call gb_LinkTarget_get_objects_list,$(linktarget)))
1337 endif
1339 endef
1341 # call gb_LinkTarget_use_library_objects,linktarget,libs
1342 define gb_LinkTarget_use_library_objects
1343 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
1344 $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
1345 $$(eval $$(call gb_Output_error,Cannot import objects library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk))
1346 endif
1347 $(call gb_LinkTarget__use_linktarget_objects,$(1),$(foreach lib,$(2),$(call gb_Library_get_linktarget,$(lib))))
1348 $(call gb_LinkTarget_get_headers_target,$(1)) : \
1349 $(foreach lib,$(2),$(call gb_Library_get_headers_target,$(lib)))
1351 endef
1353 # call gb_LinkTarget_use_executable_objects,linktarget,exes
1354 define gb_LinkTarget_use_executable_objects
1355 $(call gb_LinkTarget__use_linktarget_objects,$(1),$(foreach exe,$(2),$(call gb_Executable_get_linktarget,$(exe))))
1357 endef
1359 # call gb_LinkTarget_add_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1360 define gb_LinkTarget_add_cobjects
1361 $(foreach obj,$(2),$(call gb_LinkTarget_add_cobject,$(1),$(obj),$(3),$(4)))
1362 endef
1364 # call gb_LinkTarget_add_cxxobjects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1365 define gb_LinkTarget_add_cxxobjects
1366 $(foreach obj,$(2),$(call gb_LinkTarget_add_cxxobject,$(1),$(obj),$(3)))
1367 endef
1369 # call gb_LinkTarget_add_objcobjects,linktarget,sourcefiles,objcflags,linktargetmakefilename
1370 define gb_LinkTarget_add_objcobjects
1371 $(foreach obj,$(2),$(call gb_LinkTarget_add_objcobject,$(1),$(obj),$(3),$(4)))
1372 endef
1374 # call gb_LinkTarget_add_objcxxobjects,linktarget,sourcefiles,objcxxflags,linktargetmakefilename
1375 define gb_LinkTarget_add_objcxxobjects
1376 $(foreach obj,$(2),$(call gb_LinkTarget_add_objcxxobject,$(1),$(obj),$(3),$(4)))
1377 endef
1379 # call gb_LinkTarget_add_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename
1380 define gb_LinkTarget_add_cxxclrobjects
1381 $(foreach obj,$(2),$(call gb_LinkTarget_add_cxxclrobject,$(1),$(obj),$(3),$(4)))
1382 endef
1384 # call gb_LinkTarget_add_asmobjects,linktarget,sourcefiles,asmflags,linktargetmakefilename
1385 define gb_LinkTarget_add_asmobjects
1386 $(foreach obj,$(2),$(call gb_LinkTarget_add_asmobject,$(1),$(obj),$(3)))
1387 endef
1389 # call gb_LinkTarget_add_exception_objects,linktarget,sourcefiles,ignored,linktargetmakefilename
1390 define gb_LinkTarget_add_exception_objects
1391 $(foreach obj,$(2),$(call gb_LinkTarget_add_exception_object,$(1),$(obj),$(4)))
1392 endef
1394 #only useful for building x64 libraries on windows
1395 # call gb_LinkTarget_add_x64_generated_exception_objects,linktarget,sourcefiles,ignored,linktargetmakefilename
1396 define gb_LinkTarget_add_x64_generated_exception_objects
1397 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_exception_object,$(1),$(obj),$(4)))
1398 $(foreach obj,$(2),$(eval $(call gb_GenCxxObject_get_target,$(obj)) : CXXOBJECT_X64 := YES))
1399 endef
1401 # call gb_LinkTarget_add_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1402 define gb_LinkTarget_add_generated_cobjects
1403 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_c_object,$(1),$(obj),$(3),$(4)))
1404 endef
1406 #only useful for building x64 libraries on windows
1407 # call gb_LinkTarget_add_x64_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1408 define gb_LinkTarget_add_x64_generated_cobjects
1409 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_c_object,$(1),$(obj),$(3),$(4)))
1410 endef
1412 # call gb_LinkTarget_add_generated_exception_object,linktarget,sourcefile,linktargetmakefilename,cxxflags
1413 define gb_LinkTarget_add_generated_exception_object
1414 $(call gb_LinkTarget_add_generated_cxx_object,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(call gb_LinkTarget__get_cxxflags,$(3)) $(4))
1415 endef
1417 # call gb_LinkTarget_add_generated_exception_objects,linktarget,sourcefile,ignored,linktargetmakefilename
1418 define gb_LinkTarget_add_generated_exception_objects
1419 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_exception_object,$(1),$(obj),$(4)))
1420 endef
1422 # call gb_LinkTarget_add_generated_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename
1423 define gb_LinkTarget_add_generated_cxxclrobjects
1424 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_cxxclrobject,$(1),$(obj),$(3),$(4)))
1425 endef
1427 # call gb_LinkTarget_set_targettype,linktarget,targettype
1428 define gb_LinkTarget_set_targettype
1429 $(call gb_LinkTarget_get_target,$(1)) : TARGETTYPE := $(2)
1431 endef
1433 # call gb_LinkTarget_set_x64,linktarget,boolean
1434 define gb_LinkTarget_set_x64
1435 $(call gb_LinkTarget_get_target,$(1)) : LIBRARY_X64 := $(2)
1437 endef
1439 # call gb_LinkTarget_set_x86,linktarget,boolean
1440 define gb_LinkTarget_set_x86
1441 $(call gb_LinkTarget_get_target,$(1)) : PE_X86 := $(2)
1443 endef
1445 # call gb_LinkTarget_set_ilibtarget,linktarget,ilibfilename
1446 define gb_LinkTarget_set_ilibtarget
1447 $(call gb_LinkTarget_get_clean_target,$(1)) \
1448 $(call gb_LinkTarget_get_target,$(1)) : ILIBTARGET := $(2)
1450 endef
1452 # Add a file that is built by the LinkTarget command and define
1453 # a dummy touch rule for it so it can be tracked via dependencies.
1454 # The assumption is that the file is created by linking; in case it does not
1455 # exist there is some problem. This can be caused on WNT by re-naming DLL
1456 # files (which are aux-targets) but not the import .lib files (which
1457 # are the LinkTargets) and doing an incremental build.
1458 # call gb_LinkTarget_add_auxtarget,linktarget,auxtarget
1459 define gb_LinkTarget_add_auxtarget
1460 $(2) : $(call gb_LinkTarget_get_target,$(1))
1461 if test -e $$@; then \
1462 touch -r $$< $$@; \
1463 else \
1464 rm -f $$<; \
1465 echo "ERROR: aux-target missing, library deleted, please try running make again"; \
1466 false; \
1469 $(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS += $(2)
1471 endef
1473 # call gb_LinkTarget_add_auxtargets,linktarget,auxtargets
1474 define gb_LinkTarget_add_auxtargets
1475 $(foreach aux,$(2),$(call gb_LinkTarget_add_auxtarget,$(1),$(aux)))
1477 endef
1479 # call gb_LinkTarget__use_custom_headers,linktarget,customtarget
1480 define gb_LinkTarget__use_custom_headers
1481 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
1482 $(call gb_CustomTarget_get_target,$(2))
1483 $(call gb_LinkTarget__add_include,$(1),$(call gb_CustomTarget_get_workdir,$(2)))
1485 endef
1487 # call gb_LinkTarget_use_custom_headers,linktarget,customtargets
1488 define gb_LinkTarget_use_custom_headers
1489 $(foreach customtarget,$(2),$(call gb_LinkTarget__use_custom_headers,$(1),$(customtarget)))
1491 endef
1493 # add SDI (svidl) headers
1494 # call gb_LinkTarget_add_sdi_headers,linktarget,sditargets
1495 define gb_LinkTarget_add_sdi_headers
1496 $(call gb_LinkTarget_get_headers_target,$(1)) : $(foreach sdi,$(2),$(call gb_SdiTarget_get_target,$(sdi)))
1497 $(call gb_LinkTarget_get_clean_target,$(1)) : $(foreach sdi,$(2),$(call gb_SdiTarget_get_clean_target,$(sdi)))
1499 endef
1501 # call gb_LinkTarget__set_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1502 define gb_LinkTarget__set_precompiled_header_impl
1503 $(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_PrecompiledHeader_get_clean_target,$(3))
1504 $(call gb_PrecompiledHeader_get_target,$(3)) : $(2).cxx
1506 $(call gb_PrecompiledHeader_get_target,$(3)) : $(call gb_LinkTarget_get_headers_target,$(1))
1508 $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME := $(3)
1509 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJEX = $(call gb_PrecompiledHeader_get_objectfile, $(call gb_PrecompiledHeader_get_target,$(3)))
1510 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $$(PCHOBJEX)
1512 $(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $$(DEFS)
1513 $(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(T_CXXFLAGS) $(call gb_LinkTarget__get_cxxflags,$(4))
1515 $(call gb_PrecompiledHeader_get_target,$(3)) : VISIBILITY :=
1517 $(call gb_PrecompiledHeader_get_timestamp,$(call gb_LinkTarget__get_workdir_linktargetname,$(1))) : $(call gb_PrecompiledHeader_get_target,$(3))
1519 ifeq ($(gb_FULLDEPS),$(true))
1520 -include $(call gb_PrecompiledHeader_get_dep_target,$(3))
1521 endif
1523 endef
1525 # call gb_LinkTarget_set_precompiled_header,linktarget,pchcxxfile,linktargetmakefilename
1526 define gb_LinkTarget_set_precompiled_header
1527 ifeq ($(gb_ENABLE_PCH),$(true))
1528 $(call gb_LinkTarget__set_precompiled_header_impl,$(1),$(2),$(notdir $(2)),$(4))
1529 endif
1531 endef
1533 # use a header package, possibly from another module
1534 # call gb_LinkTarget_use_package,linktarget,package
1535 define gb_LinkTarget_use_package
1536 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
1537 $(call gb_Package_get_target,$(strip $(2)))
1539 endef
1541 # call gb_LinkTarget_use_packages,linktarget,packages
1542 define gb_LinkTarget_use_packages
1543 $(foreach package,$(2),$(call gb_LinkTarget_use_package,$(1),$(package)))
1544 endef
1546 # use a GeneratedPackage, possibly from another module
1547 # call gb_LinkTarget_use_generated_package,linktarget,package
1548 define gb_LinkTarget_use_generated_package
1549 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
1550 $(call gb_GeneratedPackage_get_target,$(strip $(2)))
1552 endef
1554 # Use sources from unpacked tarball of an external project
1555 # call gb_LinkTarget_use_unpacked,linktarget,unpackedtarget
1556 define gb_LinkTarget_use_unpacked
1557 $(call gb_LinkTarget_get_headers_target,$(1)) :| $(call gb_UnpackedTarball_get_final_target,$(2))
1559 endef
1561 # Use artifacts from ExternalProject (i. e. configure) of an external project
1562 # example in expat: StaticLibrary depends on ExternalProject outcome
1563 # call gb_LinkTarget_use_external_project,linktarget,externalproject,full-dep
1564 define gb_LinkTarget_use_external_project
1565 $(call gb_LinkTarget_get_target,$(1)) :| $(call gb_ExternalProject_get_target,$(2))
1566 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
1567 $(if $(3),$(call gb_ExternalProject_get_target,$(2)),$(call gb_UnpackedTarball_get_final_target,$(2)))
1569 endef
1571 # this forwards to functions that must be defined in RepositoryExternal.mk.
1572 # Automatically forward for libmerged library too when linktarget is merged.
1574 # call gb_LinkTarget_use_external,linktarget,external
1575 define gb_LinkTarget_use_external
1576 $(if $(filter undefined,$(origin gb_LinkTarget__use_$(2))),\
1577 $(error gb_LinkTarget_use_external: unknown external: $(2)),\
1578 $(if $(call gb_LinkTarget__is_merged,$(1)),$(call gb_LinkTarget__use_$(2),$(call gb_Library_get_linktarget,merged))) \
1579 $(call gb_LinkTarget__use_$(2),$(1)) \
1581 endef
1583 # $(call gb_LinkTarget_use_externals,library,externals)
1584 gb_LinkTarget_use_externals = \
1585 $(foreach external,$(2),$(call gb_LinkTarget_use_external,$(1),$(external)))
1587 # call gb_LinkTarget_set_visibility_default,linktarget
1588 define gb_LinkTarget_set_visibility_default
1589 $(call gb_LinkTarget_get_target,$(1)) : VISIBILITY := default
1590 ifeq ($(gb_ENABLE_PCH),$(true))
1591 ifneq ($(strip $$(PCH_NAME)),)
1592 $(call gb_PrecompiledHeader_get_target,$$(PCH_NAME)) : VISIBILITY := default
1593 endif
1594 endif
1596 endef
1598 # call gb_LinkTarget_set_warnings_not_errors,linktarget
1599 define gb_LinkTarget_set_warnings_not_errors
1600 $(call gb_LinkTarget_get_target,$(1)) : WARNINGS_NOT_ERRORS := $(true)
1602 endef
1604 # call gb_LinkTarget_set_external_code,linktarget
1605 define gb_LinkTarget_set_external_code
1606 $(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_CODE := $(true)
1608 endef
1610 # Set suffix of C++ files, if different from 'cxx'
1612 # This is useful for external libraries.
1614 # call gb_LinkTarget_set_generated_cxx_suffix,linktarget,used-suffix
1615 define gb_LinkTarget_set_generated_cxx_suffix
1616 gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(1)) := $(2)
1618 endef
1620 # vim: set noet sw=4: