run bison, flex and nasm via wsl in wsl-as-helper case
[libreoffice.git] / solenv / gbuild / LinkTarget.mk
blobe054cffb4c856e514166bfd86cad0fc2a170c21e
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 # Same happens for the gb_LinkTarget_add_libs calls from RepositoryExternal.mk. But we have no real
40 # way to separate for gbuild internal and external gb_LinkTarget_add_libs calls.
41 # So this flags these call parameters with an @ postfix. But now these must be filtered out, so this
42 # defines that filter, just in case we need to change it because it conflicts with some parameters.
43 # FYI: on Windows, gb_Library_use_system_win32_libs also calls gb_LinkTarget_add_libs; easy to miss.
44 gb_LinkTarget__syslib = %@
46 # debug flags, if the LinkTarget is named in the list of libraries of ENABLE_SYMBOLS_FOR
47 gb_LinkTarget__get_debugflags= \
48 $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS), \
49 $(if $(ENABLE_OPTIMIZED_DEBUG),$(gb_COMPILERDEBUGOPTFLAGS),$(gb_COMPILERNOOPTFLAGS))) \
50 $(if $(call gb_target_symbols_enabled,$(1)),$(gb_DEBUGINFO_FLAGS))
52 # T_LDFLAGS is just expanded once. Override the flags here, so that the linker and compiler use the same.
53 ifeq (EMSCRIPTEN,$(OS))
54 gb_LinkTarget__get_debugldflags=$(call gb_LinkTarget__get_debugflags,$1)
55 else
56 # similar for LDFLAGS, use linker optimization flags in non-debug case,
57 # but moreover strip debug from libraries for which debuginfo is not wanted
58 # (some libraries reuse .o files from other libraries, notably unittests)
59 gb_LinkTarget__get_stripldflags=$(if $(strip $(CFLAGS)$(CXXFLAGS)$(OBJCFLAGS)$(OBJCXXFLAGS)$(LDFLAGS)),,$(gb_LINKERSTRIPDEBUGFLAGS))
60 gb_LinkTarget__get_debugldflags=$(if $(call gb_target_symbols_enabled,$(1)),$(gb_LINKER_DEBUGINFO_FLAGS),$(gb_LINKEROPTFLAGS) $(call gb_LinkTarget__get_stripldflags,$(1)))
61 endif
63 # generic cflags/cxxflags to use (optimization flags, debug flags)
64 # user supplied CFLAGS/CXXFLAGS override default debug/optimization flags
65 # call gb_LinkTarget__get_cflags,linktargetmakefilename
66 gb_LinkTarget__get_cflags=$(if $(CFLAGS),$(CFLAGS),$(call gb_LinkTarget__get_debugflags,$(1)))
67 gb_LinkTarget__get_objcflags=$(if $(OBJCFLAGS),$(OBJCFLAGS),$(call gb_LinkTarget__get_debugflags,$(1)))
68 gb_LinkTarget__get_cxxflags=$(if $(CXXFLAGS),$(CXXFLAGS),$(call gb_LinkTarget__get_debugflags,$(1)))
69 gb_LinkTarget__get_objcxxflags=$(if $(OBJCXXFLAGS),$(OBJCXXFLAGS),$(call gb_LinkTarget__get_debugflags,$(1)))
70 gb_LinkTarget__get_cxxclrflags=$(call gb_LinkTarget__get_debugflags,$(1))
71 # call gb_LinkTarget__get_ldflags,linktargetmakefilename
72 gb_LinkTarget__get_ldflags=$(if $(LDFLAGS),$(LDFLAGS),$(call gb_LinkTarget__get_debugldflags,$(1)))
74 gb_LinkTarget_LAYER_LINKPATHS := \
75 URELIB:URELIB. \
76 UREBIN:URELIB. \
77 SDKBIN:URELIB. \
78 OOO:URELIB+OOO. \
79 SHLXTHDL:. \
80 OXT:OXT. \
81 NONE:URELIB+OOO+NONE. \
84 # Used to run a compiler plugin tool.
86 # At least for now, these definitions are generic enough so that they can be
87 # shared across all current use cases (COMPILER_EXTERNAL_TOOL,
88 # COMPILER_PLUGIN_TOOL) on all relevant toolchains (GCC?, Clang, clang-cl). If
89 # it ever becomes necessary, they can be moved to e.g.
90 # platform/com_{GCC,MSC}_class.mk and made different there.
92 # $(call gb_CObject__tool_command,relative-source,source,compiler-plugins)
93 define gb_CObject__tool_command
94 $(call gb_Helper_abbreviate_dirs,\
95 ICECC=no CCACHE_DISABLE=1 \
96 $(gb_CC) \
97 $(DEFS) \
98 $(T_LTOFLAGS) \
99 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
100 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
101 $(if $(3),$(gb_COMPILER_PLUGINS_TOOL)) \
102 $(T_CFLAGS) $(T_CFLAGS_APPEND) \
103 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
104 -c $(2) \
105 $(INCLUDE) \
107 endef
108 define gb_ObjCObject__tool_command
109 $(call gb_Helper_abbreviate_dirs,\
110 ICECC=no CCACHE_DISABLE=1 \
111 $(gb_CC) \
112 $(DEFS) \
113 $(T_LTOFLAGS) \
114 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
115 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
116 $(if $(3),$(gb_COMPILER_PLUGINS_TOOL)) \
117 $(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND) \
118 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
119 -c $(2) \
120 $(INCLUDE) \
122 endef
123 define gb_CxxObject__tool_command
124 $(call gb_Helper_abbreviate_dirs,\
125 ICECC=no CCACHE_DISABLE=1 \
126 $(gb_CXX) \
127 $(DEFS) \
128 $(T_LTOFLAGS) \
129 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
130 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
131 $(if $(3),$(gb_COMPILER_PLUGINS_TOOL)) \
132 $(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) \
133 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
134 -c $(2) \
135 $(INCLUDE) \
137 endef
138 define gb_ObjCxxObject__tool_command
139 $(call gb_Helper_abbreviate_dirs,\
140 ICECC=no CCACHE_DISABLE=1 \
141 $(gb_CXX) \
142 $(DEFS) \
143 $(T_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 $(if $(3),$(gb_COMPILER_PLUGINS_TOOL)) \
147 $(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND) \
148 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
149 -c $(2) \
150 $(INCLUDE) \
152 endef
153 define gb_CxxClrObject__tool_command
154 $(call gb_Helper_abbreviate_dirs,\
155 ICECC=no CCACHE_DISABLE=1 \
156 $(gb_CXX) \
157 $(DEFS) \
158 $(T_LTOFLAGS) \
159 $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
160 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
161 $(if $(3),$(gb_COMPILER_PLUGINS_TOOL)) \
162 $(T_CXXCLRFLAGS) $(T_CXXCLRFLAGS_APPEND) \
163 $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
164 -c $(2) \
165 $(INCLUDE) \
167 endef
170 # Overview of dependencies and tasks of LinkTarget
172 # target task depends on
173 # LinkTarget linking AsmObject CObject CxxObject GenCObject GenCxxObject ObjCObject ObjCxxObject GenObjCObject GenObjCxxObject GenNasmObject CxxClrObject
174 # LinkTarget/headers
175 # LinkTarget/dep joined dep file AsmObject/dep CObject/dep CxxObject/dep GenCObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep GenObjCObject/dep GenObjCxxObject/dep GenNasmObject/dep CxxClrObject/dep GenCxxClrObject/dep
176 # | LinkTarget/headers
177 # LinkTarget/headers all headers available
178 # including own generated
179 # PCH precompiled headers LinkTarget/headers
180 # CObject plain c compile | LinkTarget/headers
181 # CxxObject c++ compile | LinkTarget/headers PCH
182 # GenCObject plain c compile from | LinkTarget/headers
183 # generated source
184 # GenCxxObject C++ compile from | LinkTarget/headers PCH
185 # generated source
186 # ObjCObject objective c compile | LinkTarget/headers
187 # ObjCxxObject objective c++ compile | LinkTarget/headers
188 # GenObjCObject objective c compile from | LinkTarget/headers
189 # generated source
190 # GenObjCxxObject objective c++ compile from | LinkTarget/headers
191 # generated source
192 # GenNasmObject nasm compile from | LinkTarget/headers
193 # generated source
194 # CxxClrObject C++ CLR compile | LinkTarget/headers
195 # GenCxxClrObject C++ CLR compile from | LinkTarget/headers
196 # generated source
198 # AsmObject asm compile | LinkTarget
200 # CObject/dep dependencies these targets generate empty dep files
201 # CxxObject/dep dependencies that are populated upon compile
202 # GenCObject/dep dependencies
203 # GenCxxObject/dep dependencies
204 # ObjCObject/dep dependencies
205 # ObjCxxObject/dep dependencies
206 # GenObjCObject/dep dependencies
207 # GenObjCxxObject/dep dependencies
208 # GenNasmObject/dep dependencies
209 # CxxClrObject/dep dependencies
210 # GenCxxClrObject/dep dependencies
211 # AsmObject/dep dependencies
213 # LinkTarget/headers means gb_LinkTarget_get_headers_target etc.
214 # dependencies prefixed with | are build-order only dependencies
217 # check that objects are only linked into one link target:
218 # multiple linking may cause problems because different link targets may
219 # require different compiler flags
220 define gb_Object__owner
221 $$(if $$(OBJECTOWNER),\
222 $$(call gb_Output_error,fdo#47246: $(1) is linked in by $$(OBJECTOWNER) $(2)))$(2)
223 endef
225 # For every object there is a dep file (if gb_FULLDEPS is active).
226 # The dep file depends on the object: the Object__command also updates the
227 # dep file as a side effect.
228 # In the dep file rule just touch it so it's newer than the object.
230 # Setting FORCE_COMPILE allows forcing compilation for specific sources,
231 # usually used to force running a tool on the sources (see compilerplugins/README).
232 # If set, it'll force all considered sources for rebuild. But it's possible
233 # to explicitly specify gbuild build targets where running of the tool will be skipped
234 # (where 'all' means everything, '-' prepended means to not enable, '/' appended means
235 # everything in the directory; there is no ordering, more specific overrides
236 # more general, and disabling takes precedence).
237 # Example: FORCE_COMPILE="all -sw/ -Library_sc"
239 # Detect whether forced compile should be used for the given gbuild target.
240 # enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined]
241 # call gb_LinkTarget__force_compile,linktargetmakefilename
242 gb_LinkTarget__force_compile = \
243 $(and $(if $(filter -$(1),$(FORCE_COMPILE)),,$(true)),\
244 $(or $(gb_Module_CURRENTMODULE_FORCE_COMPILE),\
245 $(filter $(1),$(FORCE_COMPILE))))
247 # This one only exists to force .c/.cxx "rebuilds" when running a compiler tool.
248 .PHONY: force_compile_target
249 force_compile_target:
250 ifneq ($(FORCE_COMPILE),)
251 gb_FORCE_COMPILE_TARGET := force_compile_target
252 endif
254 # A tool is run either if FORCE_COMPILE is not set (in that case it's always run,
255 # because the target is not up to date), or if FORCE_COMPILE is set then
256 # the tool is run only if the value of FORCE_COMPILE includes the target.
257 gb_LinkTarget__tool_compile_enabled = \
258 $(if $(FORCE_COMPILE),$(T_FORCE_COMPILE),$(true))
260 # CObject class
262 gb_CObject_get_source = $(1)/$(2).c
264 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
265 $(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_TARGET)
266 $(call gb_Output_announce,$*.c,$(true),C ,3)
267 $(call gb_Trace_StartRange,$*.c,C )
268 $(if $(call gb_LinkTarget__tool_compile_enabled),$(call gb_CObject__tool_command,$*,$<,$(COMPILER_PLUGINS)))
269 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$<,$(call gb_CObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_CC))))
270 $(call gb_Trace_EndRange,$*.c,C )
271 else
272 $(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%)
273 $(call gb_Output_announce,$*.c,$(true),$(if $(COMPILER_TEST),C? ,C ),3)
274 $(call gb_Trace_StartRange,$*.c,$(if $(COMPILER_TEST),C? ,C ))
275 $(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$<,$(call gb_CObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_CC))
276 $(call gb_Trace_EndRange,$*.c,$(if $(COMPILER_TEST),C? ,C ))
277 endif
279 # Note: if the *Object_dep_target does not exist it will be created by
280 # concat-deps as PHONY
281 ifeq ($(gb_FULLDEPS),$(true))
283 $(call gb_CObject_get_dep_target,%) :
284 $(if $(wildcard $@),touch $@)
286 endif
289 # CxxObject class
291 gb_CxxObject_get_source = $(1)/$(2).cxx
293 # Only enable PCH if the PCH_CXXFLAGS and the PCH_DEFS (from the linktarget)
294 # are the same as the T_CXXFLAGS and DEFS we want to use for this object. This
295 # should usually be the case. The DEFS/T_CXXFLAGS would have to be manually
296 # overridden for one object file for them to differ. PCH_CXXFLAGS/PCH_DEFS
297 # should never be overridden on an object -- they should be the same as for the
298 # whole linktarget. In general it should be cleaner to use a static library
299 # compiled with different flags and link that in rather than mixing different
300 # flags in one linktarget. If OBJECT_HAS_EXTRA_CXXFLAGS is set, the object
301 # has explicitly set additional CXXFLAGS, so in that case avoid using the PCH.
302 # T_PCH_EXTRA_CXXFLAGS is used when some object requires extra flags when using
303 # the PCH, but they are intended (gb_PrecompiledHeader_pch_with_obj).
304 define gb_CxxObject__set_pchflags
305 ifneq ($(gb_ENABLE_PCH),)
306 ifneq ($(strip $$(PCH_NAME)),)
307 ifeq ($(OBJECT_HAS_EXTRA_CXXFLAGS),)
308 ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS)),$$(sort $$(T_CXXFLAGS) $$(T_CXXFLAGS_APPEND) $$(DEFS)))
309 $$@ : PCHFLAGS := $$(call gb_PrecompiledHeader_get_enableflags,$$(PCH_NAME),$$(PCH_LINKTARGETMAKEFILENAME),$$(PCH_HEADER)) $$(T_PCH_EXTRA_CXXFLAGS)
310 else
311 $$(warning No precompiled header available for $$*.cxx .)
312 $$(info precompiled header flags : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS)))
313 $$(info . object flags : $$(sort $$(T_CXXFLAGS) $$(T_CXXFLAGS_APPEND) $$(DEFS)))
314 $$(error Incorrect precompiled header setup or internal gbuild error.)
315 $$@ : PCHFLAGS :=
316 endif
317 endif
318 endif
319 endif
320 endef
322 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
323 $(call gb_CxxObject_get_target,%) : $(call gb_CxxObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_TARGET)
324 $(call gb_Output_announce,$*.cxx,$(true),CXX,3)
325 $(call gb_Trace_StartRange,$*.cxx,CXX)
326 $(if $(call gb_LinkTarget__tool_compile_enabled),$(call gb_CxxObject__tool_command,$*,$<,$(COMPILER_PLUGINS)))
327 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(eval $(gb_CxxObject__set_pchflags))))
328 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(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),$(T_CXX))))
329 $(call gb_Trace_EndRange,$*.cxx,CXX)
330 else
331 $(call gb_CxxObject_get_target,%) : $(call gb_CxxObject_get_source,$(SRCDIR),%)
332 $(call gb_Output_announce,$*.cxx,$(true),$(if $(COMPILER_TEST),CPT,CXX),3)
333 $(call gb_Trace_StartRange,$*.cxx,$(if $(COMPILER_TEST),CPT,CXX))
334 $(eval $(gb_CxxObject__set_pchflags))
335 $(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),$(T_CXX))
336 $(call gb_Trace_EndRange,$*.cxx,$(if $(COMPILER_TEST),CPT,CXX))
337 endif
339 ifeq ($(gb_FULLDEPS),$(true))
340 $(call gb_CxxObject_get_dep_target,%) :
341 $(if $(wildcard $@),touch $@)
343 endif
346 # GenCObject class
348 gb_GenCObject_get_source = $(WORKDIR)/$(1).c
350 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
351 $(call gb_GenCObject_get_target,%) : $(gb_FORCE_COMPILE_TARGET)
352 $(call gb_Output_announce,$*.c,$(true),C ,3)
353 $(call gb_Trace_StartRange,$*.c,C )
354 test -f $(call gb_GenCObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenCObject_get_source,$*)" && false)
355 $(if $(call gb_LinkTarget__tool_compile_enabled),$(call gb_CObject__tool_command,$*,$(call gb_GenCObject_get_source,$*),$(COMPILER_PLUGINS)))
356 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$(call gb_GenCObject_get_source,$*),$(call gb_GenCObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_CC))))
357 $(call gb_Trace_EndRange,$*.c,C )
358 else
359 $(call gb_GenCObject_get_target,%) :
360 $(call gb_Output_announce,$*.c,$(true),C ,3)
361 $(call gb_Trace_StartRange,$*.c,C )
362 test -f $(call gb_GenCObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenCObject_get_source,$*)" && false)
363 $(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$(call gb_GenCObject_get_source,$*),$(call gb_GenCObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_CC))
364 $(call gb_Trace_EndRange,$*.c,C )
365 endif
367 ifeq ($(gb_FULLDEPS),$(true))
368 $(dir $(call gb_GenCObject_get_dep_target,%)).dir :
369 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
371 $(dir $(call gb_GenCObject_get_dep_target,%))%/.dir :
372 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
374 $(call gb_GenCObject_get_dep_target,%) :
375 $(if $(wildcard $@),touch $@)
377 endif
380 # GenCxxObject class
382 gb_GenCxxObject_get_source = $(WORKDIR)/$(1).$(gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(2)))
384 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
385 $(call gb_GenCxxObject_get_target,%) : $(gb_FORCE_COMPILE_TARGET)
386 $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),$(true),CXX,3)
387 $(call gb_Trace_StartRange,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),CXX)
388 test -f $(GEN_CXX_SOURCE) || (echo "Missing generated source file $(GEN_CXX_SOURCE)" && false)
389 $(if $(call gb_LinkTarget__tool_compile_enabled),$(call gb_CxxObject__tool_command,$*,$(GEN_CXX_SOURCE),$(COMPILER_PLUGINS)))
390 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(eval $(gb_CxxObject__set_pchflags))))
391 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND),$(GEN_CXX_SOURCE),$(call gb_GenCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_CXX))))
392 $(call gb_Trace_EndRange,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),CXX)
393 else
394 $(call gb_GenCxxObject_get_target,%) :
395 $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),$(true),CXX,3)
396 $(call gb_Trace_StartRange,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),CXX)
397 test -f $(GEN_CXX_SOURCE) || (echo "Missing generated source file $(GEN_CXX_SOURCE)" && false)
398 $(eval $(gb_CxxObject__set_pchflags))
399 $(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND),$(GEN_CXX_SOURCE),$(call gb_GenCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),$(T_CXX))
400 $(call gb_Trace_EndRange,$(subst $(BUILDDIR)/,,$(GEN_CXX_SOURCE)),CXX)
401 endif
403 ifeq ($(gb_FULLDEPS),$(true))
404 $(dir $(call gb_GenCxxObject_get_dep_target,%)).dir :
405 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
407 $(dir $(call gb_GenCxxObject_get_dep_target,%))%/.dir :
408 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
410 $(call gb_GenCxxObject_get_dep_target,%) :
411 $(if $(wildcard $@),touch $@)
413 endif
416 # GenCxxClrObject class
418 gb_GenCxxClrObject_get_source = $(WORKDIR)/$(1).$(gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(2)))
420 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
421 $(call gb_GenCxxClrObject_get_target,%) : $(gb_FORCE_COMPILE_TARGET)
422 $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),$(true),CLR,3)
423 $(call gb_Trace_StartRange,$(subst $(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),CLR)
424 test -f $(GEN_CXXCLR_SOURCE) || (echo "Missing generated source file $(GEN_CXXCLR_SOURCE)" && false)
425 $(if $(call gb_LinkTarget__tool_compile_enabled),$(call gb_CxxClrObject__tool_command,$*,$(GEN_CXXCLR_SOURCE),$(COMPILER_PLUGINS)))
426 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(call gb_CObject__command_pattern,$@,$(T_CXXCLRFLAGS) $(T_CXXCLRFLAGS_APPEND),$(GEN_CXXCLR_SOURCE),$(call gb_GenCxxClrObject_get_dep_target,$*),$(COMPILER_PLUGINS),)))
427 $(call gb_Trace_EndRange,$(subst $(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),CLR)
428 else
429 $(call gb_GenCxxClrObject_get_target,%) :
430 $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),$(true),CLR,3)
431 $(call gb_Trace_StartRange,$(subst $(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),CLR)
432 test -f $(GEN_CXXCLR_SOURCE) || (echo "Missing generated source file $(GEN_CXXCLR_SOURCE)" && false)
433 $(call gb_CObject__command_pattern,$@,$(T_CXXCLRFLAGS) $(T_CXXCLRFLAGS_APPEND),$(GEN_CXXCLR_SOURCE),$(call gb_GenCxxClrObject_get_dep_target,$*),$(COMPILER_PLUGINS),)
434 $(call gb_Trace_EndRange,$(subst $(BUILDDIR)/,,$(GEN_CXXCLR_SOURCE)),CLR)
435 endif
437 ifeq ($(gb_FULLDEPS),$(true))
438 $(dir $(call gb_GenCxxClrObject_get_dep_target,%)).dir :
439 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
441 $(dir $(call gb_GenCxxClrObject_get_dep_target,%))%/.dir :
442 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
444 $(call gb_GenCxxClrObject_get_dep_target,%) :
445 $(if $(wildcard $@),touch $@)
447 endif
450 # YaccTarget class
452 # XXX: This is more complicated than necessary, but we cannot just use
453 # the generated C++ file as the main target, because we need to let the
454 # header depend on that to ensure the header is present before anything
455 # tries to use it.
457 gb_YaccTarget_get_source = $(1)/$(2).y
459 .PHONY : $(call gb_YaccTarget_get_clean_target,%)
460 $(call gb_YaccTarget_get_clean_target,%) :
461 $(call gb_Output_announce,$*,$(false),YAC,3)
462 $(call gb_Helper_abbreviate_dirs,\
463 rm -f $(call gb_YaccTarget_get_grammar_target,$*) $(call gb_YaccTarget_get_header_target,$*) $(call gb_YaccTarget_get_target,$*))
465 $(call gb_YaccTarget_get_target,%) : $(call gb_YaccTarget_get_source,$(SRCDIR),%)
466 $(call gb_YaccTarget__command,$<,$*,$@,$(call gb_YaccTarget_get_header_target,$*),$(call gb_YaccTarget_get_grammar_target,$*))
468 # call gb_YaccTarget_YaccTarget,yacctarget
469 define gb_YaccTarget_YaccTarget
470 $(call gb_YaccTarget_get_grammar_target,$(1)) : $(call gb_YaccTarget_get_target,$(1))
471 touch $$@
472 $(call gb_YaccTarget_get_header_target,$(1)) : $(call gb_YaccTarget_get_target,$(1))
473 touch $$@
475 endef
477 # LexTarget class
479 gb_LexTarget_get_source = $(1)/$(2).l
481 .PHONY : $(call gb_LexTarget_get_clean_target,%)
482 $(call gb_LexTarget_get_clean_target,%) :
483 $(call gb_Output_announce,$*,$(false),LEX,3)
484 $(call gb_Helper_abbreviate_dirs,\
485 rm -f $(call gb_LexTarget_get_scanner_target,$*) $(call gb_LexTarget_get_target,$*))
487 $(call gb_LexTarget_get_target,%) : $(call gb_LexTarget_get_source,$(SRCDIR),%)
488 $(call gb_Output_announce,$*,$(true),LEX,3)
489 $(call gb_Trace_StartRange,$*,LEX)
490 $(call gb_LexTarget__command,$<,$*,$@,$(call gb_LexTarget_get_scanner_target,$*))
491 $(call gb_Trace_EndRange,$*,LEX)
493 # gb_LexTarget_LexTarget(scanner-file)
494 define gb_LexTarget_LexTarget
495 $(call gb_LexTarget_get_scanner_target,$(1)) : $(call gb_LexTarget_get_target,$(1))
496 touch $$@
498 endef
500 # gb_LexTarget__command(scanner-file, stem-for-message, done-pseudo-target, source-target)
501 define gb_LexTarget__command
502 mkdir -p $(dir $(3)) && \
503 $(call gb_Helper_wsl_path,$(FLEX) $(T_LEXFLAGS) -o$(4) $(1)) && touch $(3)
504 endef
507 # ObjCxxObject class
510 gb_ObjCxxObject_get_source = $(1)/$(2).mm
512 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
513 $(call gb_ObjCxxObject_get_target,%) : $(call gb_ObjCxxObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_TARGET)
514 $(call gb_Output_announce,$*.mm,$(true),OCX,3)
515 $(call gb_Trace_StartRange,$*.mm,OCX)
516 $(if $(call gb_LinkTarget__tool_compile_enabled),$(call gb_ObjCxxObject__tool_command,$*,$<,$(COMPILER_PLUGINS)))
517 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(call gb_CObject__command_pattern,$@,$(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND),$<,$(call gb_ObjCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),)))
518 $(call gb_Trace_EndRange,$*.mm,OCX)
519 else
520 $(call gb_ObjCxxObject_get_target,%) : $(call gb_ObjCxxObject_get_source,$(SRCDIR),%)
521 $(call gb_Output_announce,$*.mm,$(true),$(if $(COMPILER_TEST),O?X,OCX),3)
522 $(call gb_Trace_StartRange,$*.mm,$(if $(COMPILER_TEST),O?X,OCX))
523 $(call gb_CObject__command_pattern,$@,$(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND),$<,$(call gb_ObjCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),)
524 $(call gb_Trace_EndRange,$*.mm,$(if $(COMPILER_TEST),O?X,OCX))
525 endif
527 ifeq ($(gb_FULLDEPS),$(true))
528 $(dir $(call gb_ObjCxxObject_get_dep_target,%)).dir :
529 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
531 $(dir $(call gb_ObjCxxObject_get_dep_target,%))%/.dir :
532 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
534 $(call gb_ObjCxxObject_get_dep_target,%) :
535 $(if $(wildcard $@),touch $@)
537 endif
540 # ObjCObject class
543 gb_ObjCObject_get_source = $(1)/$(2).m
545 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
546 $(call gb_ObjCObject_get_target,%) : $(call gb_ObjCObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_TARGET)
547 $(call gb_Output_announce,$*.m,$(true),OCC,3)
548 $(call gb_Trace_StartRange,$*.m,OCC)
549 $(if $(call gb_LinkTarget__tool_compile_enabled),$(call gb_ObjCObject__tool_command,$*,$<,$(COMPILER_PLUGINS)))
550 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(call gb_CObject__command_pattern,$@,$(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND),$<,$(call gb_ObjCObject_get_dep_target,$*),$(COMPILER_PLUGINS),)))
551 $(call gb_Trace_EndRange,$*.m,OCC)
552 else
553 $(call gb_ObjCObject_get_target,%) : $(call gb_ObjCObject_get_source,$(SRCDIR),%)
554 $(call gb_Output_announce,$*.m,$(true),$(if $(COMPILER_TEST),O?C,OCC),3)
555 $(call gb_Trace_StartRange,$*.m,$(if $(COMPILER_TEST),O?C,OCC))
556 $(call gb_CObject__command_pattern,$@,$(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND),$<,$(call gb_ObjCObject_get_dep_target,$*),$(COMPILER_PLUGINS),)
557 $(call gb_Trace_EndRange,$*.m,$(if $(COMPILER_TEST),O?C,OCC))
558 endif
560 ifeq ($(gb_FULLDEPS),$(true))
561 $(dir $(call gb_ObjCObject_get_dep_target,%)).dir :
562 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
564 $(dir $(call gb_ObjCObject_get_dep_target,%))%/.dir :
565 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
567 $(call gb_ObjCObject_get_dep_target,%) :
568 $(if $(wildcard $@),touch $@)
570 endif
573 # GenObjCObject class
575 gb_GenObjCObject_get_source = $(WORKDIR)/$(1).m
577 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
578 $(call gb_GenObjCObject_get_target,%) : $(gb_FORCE_COMPILE_TARGET)
579 $(call gb_Output_announce,$*.m,$(true),OCC,3)
580 $(call gb_Trace_StartRange,$*.m,OCC)
581 test -f $(call gb_GenObjCObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenObjCObject_get_source,$*)" && false)
582 $(if $(call gb_LinkTarget__tool_compile_enabled),$(call gb_ObjCObject__tool_command,$*,$(call gb_GenObjCObject_get_source,$*),$(COMPILER_PLUGINS)))
583 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(call gb_CObject__command_pattern,$@,$(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND),$(call gb_GenObjCObject_get_source,$*),$(call gb_GenObjCObject_get_dep_target,$*),$(COMPILER_PLUGINS),)))
584 $(call gb_Trace_EndRange,$*.m,OCC)
585 else
586 $(call gb_GenObjCObject_get_target,%) :
587 $(call gb_Output_announce,$*.m,$(true),OCC,3)
588 $(call gb_Trace_StartRange,$*.m,OCC)
589 test -f $(call gb_GenObjCObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenObjCObject_get_source,$*)" && false)
590 $(call gb_CObject__command_pattern,$@,$(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND),$(call gb_GenObjCObject_get_source,$*),$(call gb_GenObjCObject_get_dep_target,$*),$(COMPILER_PLUGINS),)
591 $(call gb_Trace_EndRange,$*.m,OCC)
592 endif
594 ifeq ($(gb_FULLDEPS),$(true))
595 $(dir $(call gb_GenObjCObject_get_dep_target,%)).dir :
596 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
598 $(dir $(call gb_GenObjCObject_get_dep_target,%))%/.dir :
599 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
601 $(call gb_GenObjCObject_get_dep_target,%) :
602 $(if $(wildcard $@),touch $@)
604 endif
607 # GenObjCxxObject class
609 gb_GenObjCxxObject_get_source = $(WORKDIR)/$(1).mm
611 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
612 $(call gb_GenObjCxxObject_get_target,%) : $(gb_FORCE_COMPILE_TARGET)
613 $(call gb_Output_announce,$*.mm,$(true),OCX,3)
614 $(call gb_Trace_StartRange,$*.mm,OCX)
615 test -f $(call gb_GenObjCxxObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenObjCxxObject_get_source,$*)" && false)
616 $(if $(call gb_LinkTarget__tool_compile_enabled),$(call gb_ObjCxxObject__tool_command,$*,$(call gb_GenObjCxxObject_get_source,$*),$(COMPILER_PLUGINS)))
617 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(call gb_CObject__command_pattern,$@,$(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND),$(call gb_GenObjCxxObject_get_source,$*),$(call gb_GenObjCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),)))
618 $(call gb_Trace_EndRange,$*.mm,OCX)
619 else
620 $(call gb_GenObjCxxObject_get_target,%) :
621 $(call gb_Output_announce,$*.mm,$(true),OCX,3)
622 $(call gb_Trace_StartRange,$*.mm,OCX)
623 test -f $(call gb_GenObjCxxObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenObjCxxObject_get_source,$*)" && false)
624 $(call gb_CObject__command_pattern,$@,$(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND),$(call gb_GenObjCxxObject_get_source,$*),$(call gb_GenObjCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS),)
625 $(call gb_Trace_EndRange,$*.mm,OCX)
626 endif
628 ifeq ($(gb_FULLDEPS),$(true))
629 $(dir $(call gb_GenObjCxxObject_get_dep_target,%)).dir :
630 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
632 $(dir $(call gb_GenObjCxxObject_get_dep_target,%))%/.dir :
633 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
635 $(call gb_GenObjCxxObject_get_dep_target,%) :
636 $(if $(wildcard $@),touch $@)
638 endif
640 # GenNasmObject class
642 gb_GenNasmObject_get_source = $(WORKDIR)/$(1)
644 $(call gb_GenNasmObject_get_target,%) :
645 $(call gb_Output_announce,$*,$(true),ASM,3)
646 $(call gb_Trace_StartRange,$*,ASM)
647 test -f $(call gb_GenNasmObject_get_source,$*) || (echo "Missing generated source file $(call gb_GenNasmObject_get_source,$*)" && false)
648 mkdir -p $(dir $@) $(dir $(call gb_GenNasmObject_get_dep_target,$*)) && cd $(SRCDIR) && \
649 $(call gb_Helper_wsl_path,$(NASM) $(T_NASMFLAGS) $(T_NASMFLAGS_APPEND) -I$(dir $(call gb_GenNasmObject_get_source,$*)) \
650 $(call gb_GenNasmObject_get_source,$*) -o $@) && \
651 echo "$@ : $(call gb_GenNasmObject_get_source,$*)" > $(call gb_GenNasmObject_get_dep_target,$*)
652 $(call gb_Trace_EndRange,$*,ASM)
654 ifeq ($(gb_FULLDEPS),$(true))
655 $(dir $(call gb_GenNasmObject_get_dep_target,%)).dir :
656 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
658 $(dir $(call gb_GenNasmObject_get_dep_target,%))%/.dir :
659 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
661 $(call gb_GenNasmObject_get_dep_target,%) :
662 $(if $(wildcard $@),touch $@)
664 endif
667 # CxxClrObject class
670 gb_CxxClrObject_get_source = $(1)/$(2).cxx
672 ifneq ($(COMPILER_EXTERNAL_TOOL)$(COMPILER_PLUGIN_TOOL),)
673 $(call gb_CxxClrObject_get_target,%) : $(call gb_CxxClrObject_get_source,$(SRCDIR),%) $(gb_FORCE_COMPILE_TARGET)
674 $(call gb_Output_announce,$*.cxx,$(true),CLR,3)
675 $(call gb_Trace_StartRange,$*.cxx,CLR)
676 $(if $(call gb_LinkTarget__tool_compile_enabled),$(call gb_CxxClrObject__tool_command,$*,$<,$(COMPILER_PLUGINS)))
677 $(if $(call gb_LinkTarget__tool_compile_enabled),$(if $(COMPILER_PLUGIN_TOOL),$(call gb_CObject__command_pattern,$@,$(T_CXXCLRFLAGS) $(T_CXXCLRFLAGS_APPEND),$<,$(call gb_CxxClrObject_get_dep_target,$*),$(COMPILER_PLUGINS),)))
678 $(call gb_Trace_EndRange,$*.cxx,CLR)
679 else
680 $(call gb_CxxClrObject_get_target,%) : $(call gb_CxxClrObject_get_source,$(SRCDIR),%)
681 $(call gb_Output_announce,$*.cxx,$(true),$(if $(COMPILER_TEST),C?R,CLR),3)
682 $(call gb_Trace_StartRange,$*.cxx,$(if $(COMPILER_TEST),C?R,CLR))
683 $(call gb_CObject__command_pattern,$@,$(T_CXXCLRFLAGS) $(T_CXXCLRFLAGS_APPEND),$<,$(call gb_CxxClrObject_get_dep_target,$*),$(COMPILER_PLUGINS),)
684 $(call gb_Trace_EndRange,$*.cxx,$(if $(COMPILER_TEST),C?R,CLR))
685 endif
687 ifeq ($(gb_FULLDEPS),$(true))
688 $(dir $(call gb_CxxClrObject_get_dep_target,%)).dir :
689 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
691 $(dir $(call gb_CxxClrObject_get_dep_target,%))%/.dir :
692 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
694 $(call gb_CxxClrObject_get_dep_target,%) :
695 $(if $(wildcard $@),touch $@)
697 endif
700 # AsmObject class
702 $(call gb_AsmObject_get_target,%) : $(call gb_AsmObject_get_source,$(SRCDIR),%)
703 $(call gb_AsmObject__command,$@,$*,$<,$(call gb_AsmObject_get_dep_target,$*))
705 ifeq ($(gb_FULLDEPS),$(true))
706 $(dir $(call gb_AsmObject_get_dep_target,%)).dir :
707 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
709 $(dir $(call gb_AsmObject_get_dep_target,%))%/.dir :
710 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
712 $(call gb_AsmObject_get_dep_target,%) :
713 $(if $(wildcard $@),touch $@)
715 endif
718 # LinkTarget class
720 gb_LinkTarget_DEFAULTDEFS := $(gb_GLOBALDEFS)
722 .PHONY : $(WORKDIR)/Clean/LinkTarget/%
723 $(WORKDIR)/Clean/LinkTarget/% :
724 $(call gb_Output_announce,$(LINKTARGETMAKEFILENAME),$(false),LNK,4)
725 RESPONSEFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)),\
726 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
727 $(foreach object,$(COBJECTS),$(call gb_CObject_get_dep_target,$(object))) \
728 $(foreach object,$(COBJECTS),$(call gb_CObject_get_dwo_target,$(object))) \
729 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
730 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dep_target,$(object))) \
731 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dwo_target,$(object))) \
732 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
733 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dep_target,$(object))) \
734 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dwo_target,$(object))) \
735 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
736 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object))) \
737 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dwo_target,$(object))) \
738 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_target,$(object))) \
739 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_dep_target,$(object))) \
740 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_dwo_target,$(object))) \
741 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
742 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dep_target,$(object))) \
743 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dwo_target,$(object))) \
744 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
745 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_dep_target,$(object))) \
746 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_dwo_target,$(object))) \
747 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
748 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \
749 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dwo_target,$(object))) \
750 $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_target,$(object))) \
751 $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_dep_target,$(object))) \
752 $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_dwo_target,$(object))) \
753 $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_target,$(object))) \
754 $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_dep_target,$(object))) \
755 $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_dwo_target,$(object))) \
756 $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \
757 $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_dep_target,$(object))) \
758 $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_dwo_target,$(object))) \
759 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_target,$(object))) \
760 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dep_target,$(object))) \
761 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dwo_target,$(object))) \
762 $(call gb_LinkTarget_get_target,$(LINKTARGET)) \
763 $(call gb_LinkTarget_get_dep_target,$(LINKTARGET)) \
764 $(if $(gb_PARTIAL_BUILD),, \
765 $(call gb_LinkTarget_get_dep_libraries_target,$(LINKTARGET)) \
766 $(call gb_LinkTarget_get_dep_externals_target,$(LINKTARGET)) \
767 $(call gb_LinkTarget_get_dep_statics_target,$(LINKTARGET)) \
769 $(call gb_LinkTarget_get_headers_target,$(LINKTARGET)) \
770 $(call gb_LinkTarget_get_objects_list,$(LINKTARGET)) \
771 $(call gb_LinkTarget_get_pch_timestamp,$(LINKTARGETMAKEFILENAME)) \
772 $(call gb_LinkTarget_get_pch_reuse_timestamp,$(LINKTARGETMAKEFILENAME)) \
773 $(ILIBTARGET) \
774 $(AUXTARGETS)) && \
775 cat $${RESPONSEFILE} /dev/null | $(if $(filter WNT,$(OS)),env -i PATH="$$PATH") xargs -n 200 rm -fr && \
776 rm -f $${RESPONSEFILE}
779 # cat the deps of all objects in one file, then we need only open that one file
780 # call gb_LinkTarget__command_dep,dep_target,linktargetname
781 define gb_LinkTarget__command_dep
782 $(call gb_Output_announce,LNK:$(2).d,$(true),DEP,1)
783 $(call gb_Trace_StartRange,LNK:$(2),DEP)
784 $(call gb_Helper_abbreviate_dirs,\
785 mkdir -p $(dir $(1)) && \
786 RESPONSEFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)),\
787 $(foreach object,$(COBJECTS),$(call gb_CObject_get_dep_target,$(object))) \
788 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dep_target,$(object))) \
789 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dep_target,$(object)))\
790 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object)))\
791 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_dep_target,$(object)))\
792 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_dep_target,$(object)))\
793 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_dep_target,$(object))) \
794 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \
795 $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_dep_target,$(object))) \
796 $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_dep_target,$(object))) \
797 $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_dep_target,$(object))) \
798 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_dep_target,$(object))) \
799 ) && \
800 SYSTEM_BOOST="$(SYSTEM_BOOST)" $(call gb_Executable_get_command,concat-deps) $${RESPONSEFILE} > $(1)) && \
801 rm -f $${RESPONSEFILE}
802 $(call gb_Trace_EndRange,LNK:$(2),DEP)
804 endef
806 # call gb_LinkTarget__command_objectlist,linktarget
807 define gb_LinkTarget__command_objectlist
808 $(file >$(1),\
809 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
810 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
811 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
812 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
813 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_target,$(object))) \
814 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
815 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
816 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
817 $(foreach object,$(GENOBJCOBJECTS),$(call gb_GenObjCObject_get_target,$(object))) \
818 $(foreach object,$(GENOBJCXXOBJECTS),$(call gb_GenObjCxxObject_get_target,$(object))) \
819 $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \
820 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_target,$(object))) \
821 $(PCHOBJS) \
822 $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))))
824 endef
826 $(WORKDIR)/LinkTarget/%/.dir :
827 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
829 # Target for the .exports of the shared library, to speed up incremental build.
830 # This deliberately does nothing if the file exists; the file is actually
831 # written in gb_LinkTarget__command_dynamiclink.
832 # Put this pattern rule here so it overrides the one below.
833 # (this is rather ugly: because of % the functions cannot be used)
834 $(WORKDIR)/LinkTarget/Library/%.exports :
835 $(if $(wildcard $@),,mkdir -p $(dir $@) && touch $@)
837 # This recipe actually also builds the dep-target as a side-effect, which
838 # is an optimization to reduce incremental build time.
839 # (with exception for concat-dep executable itself which does not exist yet...)
840 $(WORKDIR)/LinkTarget/% : $(gb_Helper_MISCDUMMY)
841 $(call gb_LinkTarget__command_impl,$@,$*)
843 # call gb_LinkTarget__make_installed_rule,linktarget
844 define gb_LinkTarget__make_installed_rule
845 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_LinkTarget_get_headers_target,$(1))
846 $$(call gb_LinkTarget__command_impl,$(call gb_LinkTarget_get_target,$(1)),$(call gb_LinkTarget__get_workdir_linktargetname,$(1)))
848 endef
850 define gb_LinkTarget__add_linked_libs
851 $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(2)
853 endef
855 # it's not possible to use a pattern rule for files in INSTDIR because
856 # it would inevitably conflict with the pattern rule for Package
857 # (especially since external libraries are delivered via Package)
858 # call gb_LinkTarget__command_impl,linktargettarget,linktargetname
859 define gb_LinkTarget__command_impl
860 $(if $(gb_FULLDEPS),
861 $(if $(ENABLE_CUSTOMTARGET_COMPONENTS),$(if $(gb_PARTIAL_BUILD),,
862 $(call gb_LinkTarget__command_dep_libraries,$(call gb_LinkTarget_get_dep_libraries_target,$(2)).tmp,$(2))
863 mv $(call gb_LinkTarget_get_dep_libraries_target,$(2)).tmp $(call gb_LinkTarget_get_dep_libraries_target,$(2))
864 $(call gb_LinkTarget__command_dep_externals,$(call gb_LinkTarget_get_dep_externals_target,$(2)).tmp,$(2))
865 mv $(call gb_LinkTarget_get_dep_externals_target,$(2)).tmp $(call gb_LinkTarget_get_dep_externals_target,$(2))
866 $(call gb_LinkTarget__command_dep_statics,$(call gb_LinkTarget_get_dep_statics_target,$(2)).tmp,$(2))
867 mv $(call gb_LinkTarget_get_dep_statics_target,$(2)).tmp $(call gb_LinkTarget_get_dep_statics_target,$(2))))
868 $(if $(findstring concat-deps,$(2)),,
869 $(call gb_LinkTarget__command_dep,$(call gb_LinkTarget_get_dep_target,$(2)).tmp,$(2))
870 mv $(call gb_LinkTarget_get_dep_target,$(2)).tmp $(call gb_LinkTarget_get_dep_target,$(2))))
871 $(if $(filter $(2),$(foreach lib,$(gb_MERGEDLIBS),$(call gb_Library__get_workdir_linktargetname,$(lib)))),
872 $(if $(filter $(true),$(call gb_LinkTarget__is_build_lib,$(2))),
873 $(call gb_LinkTarget__command,$(1),$(2)),
874 mkdir -p $(dir $(1)) && echo invalid - merged lib > $(1)
875 $(if $(SOVERSIONSCRIPT),&& echo invalid - merged lib > $(WORKDIR)/LinkTarget/$(2))),
876 $(if $(filter-out CompilerTest,$(TARGETTYPE)),
877 $(call gb_LinkTarget__command,$(1),$(2))))
878 $(call gb_LinkTarget__command_objectlist,$(WORKDIR)/LinkTarget/$(2).objectlist)
879 endef
881 ifeq ($(gb_FULLDEPS),$(true))
882 $(call gb_LinkTarget_get_dep_target,%) : $(call gb_Executable_get_runtime_dependencies,concat-deps)
883 $(call gb_LinkTarget__command_dep,$@,$*)
885 $(dir $(call gb_LinkTarget_get_dep_target,%))/.dir :
886 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
888 ifeq ($(ENABLE_CUSTOMTARGET_COMPONENTS),TRUE)
889 ifeq (,$(gb_PARTIAL_BUILD))
891 define gb_LinkTarget__static_dep_x_template
893 define gb_LinkTarget__command_dep_$(1)
894 $$(call gb_Output_announce,LNK:$$(2).d.$(1),$$(true),DEP,1)
895 $$(shell mkdir -p $$(dir $$(1)))
896 $$(file >$$(1).tmp,$$(call gb_LinkTarget__get_all_$(1),$$(2)))
897 $$(call gb_Helper_replace_if_different_and_touch,$$(1).tmp,$$(1))
899 endef
901 $$(call gb_LinkTarget_get_dep_$(1)_target,%) : ;
902 $$(call gb_LinkTarget__command_dep_$(1),$$@,$$*)
904 endef # gb_LinkTarget__static_dep_x_template
906 $(eval $(call gb_LinkTarget__static_dep_x_template,libraries))
907 $(eval $(call gb_LinkTarget__static_dep_x_template,externals))
908 $(eval $(call gb_LinkTarget__static_dep_x_template,statics))
910 endif # !gb_PARTIAL_BUILD
911 endif # ENABLE_CUSTOMTARGET_COMPONENTS
912 endif # gb_FULLDEPS
914 # Ok, this is some dark voodoo: When declaring a linktarget with
915 # gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the
916 # target. When the rule for the headertarget is executed and SELF does not
917 # match the target name, we are depending on a linktarget that was never
918 # declared. In a full build exclusively in gbuild that should never happen.
919 define gb_LinkTarget__get_headers_check
920 ifneq ($$(SELF),$$*)
921 $$(eval $$(call gb_Output_error,used LinkTarget $$* not defined))
922 endif
923 $$@ : COMMAND := $$(call gb_Helper_abbreviate_dirs, touch $$@)
925 endef
927 $(WORKDIR)/Headers/%/.dir :
928 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
930 # sadly because of the subdirectories can't have pattern deps on .dir here
931 $(WORKDIR)/Headers/% :
932 $(eval $(gb_LinkTarget__get_headers_check))
933 $(COMMAND)
935 # Explanation of some of the targets:
936 # - gb_LinkTarget_get_headers_target is the target that guarantees all headers
937 # from the linked against libraries and the linktargets own generated headers
938 # are generated.
939 # - gb_LinkTarget_get_target links the objects into a file in WORKDIR.
940 # gb_LinkTarget_get_target depends on gb_LinkTarget_get_headers_target.
941 # gb_LinkTarget_get_target depends additionally on the objects, which in turn
942 # depend build-order only on the gb_LinkTarget_get_headers_target. The build
943 # order-only dependency ensures all headers to be there for compiling and
944 # dependency generation without causing all objects to be rebuild when one
945 # header changes. Only the ones with an explicit dependency in their generated
946 # dependency file will be rebuild.
948 # gb_LinkTarget_get_target is the target that links the objects into a file in
949 # WORKDIR
950 # Explanation of some of the variables:
951 # - AUXTARGETS are the additionally generated files that need to be cleaned out
952 # on clean.
953 # - PCH_CXXFLAGS and PCH_DEFS are the flags that the precompiled headers will
954 # be compiled with. They should never be overridden in a single object
955 # files.
956 # - TARGETTYPE is the type of linktarget as some platforms need very different
957 # command to link different targettypes.
958 # - LIBRARY_X64 is only relevant for building a x64 library on windows.
959 # - PE_X86 is only relevant for building a x86 binaries on Windows.
961 # Since most variables are set on the linktarget and not on the object, the
962 # object learns about these setting via GNU makes scoping of target variables.
963 # Therefore it is important that objects are only directly depended on by the
964 # linktarget. This for example means that you cannot build a single object
965 # alone, because then you would directly depend on the object.
967 # A note about flags: because the overriding the global variables with a target
968 # local variable of the same name is considered obscure, the target local
969 # variables have a T_ prefix.
971 # call gb_LinkTarget_LinkTarget,linktarget,linktargetmakefilename,layer
972 define gb_LinkTarget_LinkTarget
973 $(call gb_LinkTarget_get_clean_target,$(1)) : LINKTARGET := $(1)
974 $(call gb_LinkTarget_get_clean_target,$(1)) : LINKTARGETMAKEFILENAME := $(2)
975 $(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS :=
976 $(call gb_LinkTarget_get_headers_target,$(1)) : SELF := $(call gb_LinkTarget__get_workdir_linktargetname,$(1))
977 $(call gb_LinkTarget_get_headers_target,$(1)) : \
978 | $(dir $(call gb_LinkTarget_get_headers_target,$(1))).dir \
979 $(dir $(call gb_LinkTarget_get_target,$(1))).dir \
980 $(dir $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1))).dir
981 $(call gb_LinkTarget_get_target,$(1)) : ILIBTARGET :=
982 $(call gb_LinkTarget_get_clean_target,$(1)) \
983 $(call gb_LinkTarget_get_target,$(1)) : COBJECTS :=
984 $(call gb_LinkTarget_get_clean_target,$(1)) \
985 $(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS :=
986 $(call gb_LinkTarget_get_clean_target,$(1)) \
987 $(call gb_LinkTarget_get_target,$(1)) : YACCOBJECT :=
988 $(call gb_LinkTarget_get_target,$(1)) : T_YACCFLAGS := $$(gb_LinkTarget_YYACFLAGS) $(YACCFLAGS)
989 $(call gb_LinkTarget_get_clean_target,$(1)) \
990 $(call gb_LinkTarget_get_target,$(1)) : LEXOBJECT :=
991 $(call gb_LinkTarget_get_target,$(1)) : T_LEXFLAGS := $$(gb_LinkTarget_LEXFLAGS) $(LEXFLAGS)
992 $(call gb_LinkTarget_get_clean_target,$(1)) \
993 $(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS :=
994 $(call gb_LinkTarget_get_clean_target,$(1)) \
995 $(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS :=
996 $(call gb_LinkTarget_get_clean_target,$(1)) \
997 $(call gb_LinkTarget_get_target,$(1)) : CXXCLROBJECTS :=
998 $(call gb_LinkTarget_get_clean_target,$(1)) \
999 $(call gb_LinkTarget_get_target,$(1)) : ASMOBJECTS :=
1000 $(call gb_LinkTarget_get_clean_target,$(1)) \
1001 $(call gb_LinkTarget_get_target,$(1)) : GENCOBJECTS :=
1002 $(call gb_LinkTarget_get_clean_target,$(1)) \
1003 $(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS :=
1004 $(call gb_LinkTarget_get_clean_target,$(1)) \
1005 $(call gb_LinkTarget_get_target,$(1)) : GENOBJCOBJECTS :=
1006 $(call gb_LinkTarget_get_clean_target,$(1)) \
1007 $(call gb_LinkTarget_get_target,$(1)) : GENNASMOBJECTS :=
1008 $(call gb_LinkTarget_get_clean_target,$(1)) \
1009 $(call gb_LinkTarget_get_target,$(1)) : GENOBJCXXOBJECTS :=
1010 $(call gb_LinkTarget_get_clean_target,$(1)) \
1011 $(call gb_LinkTarget_get_target,$(1)) : GENCXXCLROBJECTS :=
1012 $(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS)
1013 $(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS_APPEND :=
1014 $(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
1015 $(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS_APPEND :=
1016 $(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
1017 $(call gb_LinkTarget_get_target,$(1)) : OBJECT_HAS_EXTRA_CXXFLAGS :=
1018 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS)
1019 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS_APPEND :=
1020 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS := $$(gb_LinkTarget_OBJCFLAGS)
1021 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS_APPEND :=
1022 $(call gb_LinkTarget_get_target,$(1)) : T_NASMFLAGS := $$(NAFLAGS)
1023 $(call gb_LinkTarget_get_target,$(1)) : T_NASMFLAGS_APPEND :=
1024 $(call gb_LinkTarget_get_target,$(1)) : T_CXXCLRFLAGS := $$(gb_LinkTarget_CXXCLRFLAGS)
1025 $(call gb_LinkTarget_get_target,$(1)) : T_CXXCLRFLAGS_APPEND :=
1026 $(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS)
1027 $(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS)
1028 $(call gb_LinkTarget_get_target,$(1)) : INCLUDE := -I$$(SRCDIR)/include $$(gb_LinkTarget_INCLUDE)
1029 $(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))
1030 $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS :=
1031 $(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS :=
1032 $(call gb_LinkTarget_get_target,$(1)) : T_LIBS :=
1033 $(call gb_LinkTarget_get_target,$(1)) : T_STDLIBS_CXX := $(gb_STDLIBS_CXX)
1034 $(call gb_LinkTarget_get_target,$(1)) : TARGETTYPE :=
1035 $(call gb_LinkTarget_get_target,$(1)) : LIBRARY_X64 :=
1036 $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME :=
1037 $(call gb_LinkTarget_get_target,$(1)) : PCH_HEADER :=
1038 $(call gb_LinkTarget_get_target,$(1)) : PCH_LINKTARGETMAKEFILENAME :=
1039 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJS :=
1040 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJEX :=
1041 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJNOEX :=
1042 $(call gb_LinkTarget_get_target,$(1)) : T_PCH_EXTRA_CXXFLAGS :=
1043 $(call gb_LinkTarget_get_target,$(1)) : PE_X86 :=
1044 $(call gb_LinkTarget_get_target,$(1)) : PDBFILE :=
1045 $(call gb_LinkTarget_get_target,$(1)) : TARGETGUI :=
1046 $(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS :=
1047 $(call gb_LinkTarget_get_target,$(1)) : NATIVERES :=
1048 $(call gb_LinkTarget_get_target,$(1)) : VISIBILITY :=
1049 $(call gb_LinkTarget_get_target,$(1)) : WARNINGS_NOT_ERRORS :=
1050 $(call gb_LinkTarget_get_target,$(1)) : WARNINGS_DISABLED :=
1051 $(call gb_LinkTarget_get_target,$(1)) : PLUGIN_WARNINGS_AS_ERRORS :=
1052 $(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_CODE :=
1053 $(call gb_LinkTarget_get_target,$(1)) : SOVERSIONSCRIPT :=
1054 $(call gb_LinkTarget_get_target,$(1)) : COMPILER_TEST :=
1055 $(call gb_LinkTarget_get_target,$(1)) : T_SYMBOLS := $(if $(call gb_target_symbols_enabled,$(2)),$(true),$(false))
1056 $(call gb_LinkTarget_get_target,$(1)) : T_FORCE_COMPILE := $(if $(call gb_LinkTarget__force_compile,$(2)),$(true),$(false))
1057 $(call gb_LinkTarget_get_target,$(1)) : T_CC :=
1058 $(call gb_LinkTarget_get_target,$(1)) : T_CXX :=
1059 $(call gb_LinkTarget_get_target,$(1)) : T_USE_LD := $(USE_LD)
1060 $(call gb_LinkTarget_get_target,$(1)) : T_LTOFLAGS := $(gb_LTOFLAGS)
1061 $(call gb_LinkTarget_get_target,$(1)) : T_PREJS :=
1063 ifeq ($(gb_FULLDEPS),$(true))
1064 ifeq (depcache:,$(filter depcache,$(.FEATURES)):$(gb_PARTIAL_BUILD))
1065 -includedepcache $(call gb_LinkTarget_get_dep_target,$(1))
1066 else
1067 -include $(call gb_LinkTarget_get_dep_target,$(1))
1068 endif
1069 $(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS :=
1070 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS :=
1071 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS :=
1072 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS :=
1073 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXCLROBJECTS :=
1074 $(call gb_LinkTarget_get_dep_target,$(1)) : ASMOBJECTS :=
1075 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS :=
1076 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS :=
1077 $(call gb_LinkTarget_get_dep_target,$(1)) : GENOBJCOBJECTS :=
1078 $(call gb_LinkTarget_get_dep_target,$(1)) : GENOBJCXXOBJECTS :=
1079 $(call gb_LinkTarget_get_dep_target,$(1)) : GENNASMOBJECTS :=
1080 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXCLROBJECTS :=
1081 $(call gb_LinkTarget_get_dep_target,$(1)) : YACCOBJECTS :=
1082 endif # gb_FULLDEPS
1084 gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(1)) := cxx
1086 # installed linktargets need a rule to build!
1087 $(if $(findstring $(INSTDIR),$(1)),$(call gb_LinkTarget__make_installed_rule,$(1)))
1089 $(call gb_PrecompiledHeader_generate_timestamp_rule,$(2))
1091 endef # gb_LinkTarget_LinkTarget
1093 # call gb_LinkTarget_set_soversion_script,linktarget,soversionscript
1094 define gb_LinkTarget_set_soversion_script
1095 $(call gb_LinkTarget_get_target,$(1)) : $(2)
1096 $(call gb_LinkTarget_get_target,$(1)) : SOVERSIONSCRIPT := $(2)
1098 endef
1100 # call gb_LinkTarget_add_defs,linktarget,defines
1101 define gb_LinkTarget_add_defs
1102 $(call gb_LinkTarget_get_target,$(1)) : DEFS += $(2)
1103 $(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS += $(2)
1104 endef
1106 # call gb_LinkTarget_add_cflags,linktarget,cflags
1107 define gb_LinkTarget_add_cflags
1108 $(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS_APPEND += $(2)
1109 endef
1111 # call gb_LinkTarget_add_cxxflags,linktarget,cxxflags
1112 define gb_LinkTarget_add_cxxflags
1113 $(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS_APPEND += $(2)
1114 $(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS += $(2)
1115 endef
1117 # call gb_LinkTarget_add_objcxxflags,linktarget,objcxxflags
1118 define gb_LinkTarget_add_objcxxflags
1119 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS_APPEND += $(2)
1120 endef
1122 # call gb_LinkTarget_add_objcflags,linktarget,objcflags
1123 define gb_LinkTarget_add_objcflags
1124 $(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS_APPEND += $(2)
1126 endef
1128 # call gb_LinkTarget_add_nasmflags,linktarget,nasmflags
1129 define gb_LinkTarget_add_nasmflags
1130 $(call gb_LinkTarget_get_target,$(1)) : T_NASMFLAGS_APPEND += $(2)
1131 endef
1133 # call gb_LinkTarget_add_cxxclrflags,linktarget,cxxclrflags
1134 define gb_LinkTarget_add_cxxclrflags
1135 $(call gb_LinkTarget_get_target,$(1)) : T_CXXCLRFLAGS_APPEND += $(2)
1136 endef
1138 # call gb_LinkTarget__add_include,linktarget,includes
1139 define gb_LinkTarget__add_include
1140 $(call gb_LinkTarget_get_target,$(1)) : INCLUDE += -I$(2)
1142 endef
1144 # call gb_LinkTarget__check_srcdir_paths,linktarget,includepaths
1145 define gb_LinkTarget__check_srcdir_paths
1146 $(if $(filter-out $(wildcard $(2)),$(2)),\
1147 $(call gb_Output_error,gb_LinkTarget_set_include: include paths $(filter-out $(wildcard $(2)),$(2)) do not exist) \
1149 endef
1151 # call gb_LinkTarget_set_include,linktarget,includes
1152 define gb_LinkTarget_set_include
1153 $(call gb_LinkTarget__check_srcdir_paths,$(1),\
1154 $(patsubst -I%,%,$(filter -I$(SRCDIR)/%,$(filter-out -I$(INSTDIR)/% -I$(WORKDIR)/%,$(2)))))
1155 $(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $(2)
1157 endef
1159 # call gb_LinkTarget_add_ldflags,linktarget,ldflags
1160 define gb_LinkTarget_add_ldflags
1161 $(call gb_LinkTarget_get_target,$(1)) : T_LDFLAGS += $(2)
1163 endef
1165 # real use in RepositoryExternal.mk
1166 # call gb_LinkTarget_set_ldflags,linktarget,ldflags
1167 define gb_LinkTarget_set_ldflags
1168 $(call gb_LinkTarget_get_target,$(1)) : T_LDFLAGS := $(2)
1170 endef
1172 # call gb_LinkTarget_add_libs,linktarget,libs
1173 define gb_LinkTarget_add_libs
1174 $(call gb_LinkTarget_get_target,$(1)) : T_LIBS += $(2)
1175 $(if $(call gb_LinkTarget__is_merged,$(1)),\
1176 $(call gb_Library_get_linktarget_target,merged) : T_LIBS += $(2))
1177 ifeq ($(ENABLE_CUSTOMTARGET_COMPONENTS),TRUE)
1178 $(if $(gb_DEBUG_STATIC),$$(info $$(call gb_LinkTarget__get_all_libraries_var,$(1)) += $(filter-out $(call gb_LinkTarget__get_all_libraries,$(1)),$(patsubst %,$(gb_LinkTarget__syslib),$(2)))))
1179 $$(eval $$(call gb_LinkTarget__get_all_libraries_var,$(1)) += $(filter-out $(call gb_LinkTarget__get_all_libraries,$(1)),$(patsubst %,$(gb_LinkTarget__syslib),$(2))))
1180 ifeq (,$(gb_PARTIAL_BUILD))
1181 $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(filter-out $(call gb_LinkTarget__get_all_libraries,$(1)),$(patsubst %,$(gb_LinkTarget__syslib),$(2)))
1182 endif
1183 endif
1185 endef
1187 # remove platform specific standard libraries for linktarget $(1)
1188 # assumption is that adding these standard libs is always useful, but in very
1189 # exceptional cases this disable method may be used
1190 # call gb_LinkTarget_disable_standard_system_libs,linktarget
1191 define gb_LinkTarget_disable_standard_system_libs
1192 $(call gb_LinkTarget_get_target,$(1)) : T_LIBS := $$(filter-out $$(gb_STDLIBS),$$(T_LIBS))
1193 $(call gb_LinkTarget_get_target,$(1)) : T_STDLIBS_CXX :=
1195 endef
1197 # call gb_LinkTarget__use_api,linktarget,api
1198 define gb_LinkTarget__use_api
1199 $(call gb_LinkTarget_get_headers_target,$(1)) : $(call gb_UnoApiHeadersTarget_get_target,$(2))
1200 $(call gb_LinkTarget__add_include,$(1),$(call gb_UnoApiHeadersTarget_get_dir,$(2)))
1202 endef
1204 # call gb_LinkTarget_use_api,linktarget,apis
1205 define gb_LinkTarget_use_api
1206 $(foreach api,$(2),$(call gb_LinkTarget__use_api,$(1),$(api)))
1208 endef
1210 # call gb_LinkTarget_use_udk_api,linktarget
1211 define gb_LinkTarget_use_udk_api
1212 $(call gb_LinkTarget__use_api,$(1),udkapi)
1213 endef
1215 # call gb_LinkTarget_use_sdk_api,linktarget
1216 define gb_LinkTarget_use_sdk_api
1217 $(call gb_LinkTarget__use_api,$(1),udkapi)
1218 $(call gb_LinkTarget__use_api,$(1),offapi)
1219 endef
1221 # call gb_LinkTarget__use_internal_api_one,linktarget,api,apiprefix
1222 define gb_LinkTarget__use_internal_api_one
1223 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
1224 $(call gb_UnoApiHeadersTarget_get_$(3)target,$(2))
1225 $(call gb_LinkTarget__add_include,$(1),$(call gb_UnoApiHeadersTarget_get_$(3)dir,$(2)))
1227 endef
1229 # call gb_LinkTarget__use_internal_api,linktarget,apis,apiprefix
1230 define gb_LinkTarget__use_internal_api
1231 $(foreach api,$(2),$(call gb_LinkTarget__use_internal_api_one,$(1),$(api),$(3)))
1233 endef
1235 # call gb_LinkTarget_use_internal_api,linktarget,api
1236 define gb_LinkTarget_use_internal_api
1237 $(call gb_LinkTarget__use_internal_api,$(1),$(2))
1239 endef
1241 # call gb_LinkTarget_use_internal_bootstrap_api,linktarget,api
1242 define gb_LinkTarget_use_internal_bootstrap_api
1243 $(call gb_LinkTarget__use_internal_api,$(1),$(2),bootstrap_)
1245 endef
1247 # call gb_LinkTarget_use_internal_comprehensive_api,linktarget,api
1248 define gb_LinkTarget_use_internal_comprehensive_api
1249 $(call gb_LinkTarget__use_internal_api,$(1),$(2),comprehensive_)
1251 endef
1253 define gb_PrintDeps_info
1254 $(info LibraryDep: $(1) links against $(2))
1255 endef
1257 # returns $(true), if the target class really calls a linker.
1258 # call gb_LinkTarget_does_real_link,linktarget
1259 gb_LinkTarget_does_real_link = $(if $(filter Executable CppunitTest $(if $(DISABLE_DYNLOADING),,Library), \
1260 $(call gb_LinkTarget__get_workdir_linktargetclass,$(1))),$(true))
1262 # avoid problem when a module is built partially but other modules that define
1263 # needed libraries is not yet built: prevent invocation of pattern rule
1264 # for library with invalid parameters by depending on the header target
1265 define gb_LinkTarget__lib_dummy_depend
1266 $(call gb_Library_get_target,$(1)) :| $(call gb_Library_get_headers_target,$(1))
1268 endef
1270 define gb_LinkTarget__generate_all_x_accessors
1271 gb_LinkTarget__get_all_$(1)_var = $$(call gb_LinkTarget__get_workdir_linktargetname,$$(1))<>ALL_$(2)
1272 gb_LinkTarget__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(1)))
1273 gb_Library__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_Library_get_linktarget,$$(1))))
1274 gb_Executable__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_Executable_get_linktarget,$$(1))))
1275 gb_ExternalProject__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_ExternalProject__get_workdir_linktargetname,$$(1))))
1276 gb_CppunitTest__get_all_$(1) = $$($$(call gb_LinkTarget__get_all_$(1)_var,$$(call gb_CppunitTest__get_workdir_linktargetname,$$(1))))
1278 endef
1280 $(eval $(call gb_LinkTarget__generate_all_x_accessors,libraries,LIBRARIES))
1281 gb_LinkTarget__filter_lo_libraries = $(filter-out $(gb_LinkTarget__syslib),$(1))
1282 gb_LinkTarget__get_all_lo_libraries = $(call gb_LinkTarget__filter_lo_libraries,$(call gb_LinkTarget__get_all_libraries,$(1)))
1283 gb_LinkTarget__filter_sys_libraries = $(filter $(gb_LinkTarget__syslib),$(1))
1284 gb_LinkTarget__get_all_sys_libraries = $(call gb_LinkTarget__filter_sys_libraries,$(call gb_LinkTarget__get_all_libraries,$(1)))
1285 $(eval $(call gb_LinkTarget__generate_all_x_accessors,externals,EXTERNALS))
1286 $(eval $(call gb_LinkTarget__generate_all_x_accessors,statics,STATICS))
1288 # call gb_LinkTarget__register_type,type,linktarget,type list
1289 define gb_LinkTarget__register_type
1290 ifeq ($(ENABLE_CUSTOMTARGET_COMPONENTS),TRUE)
1291 ifeq (,$(DISABLE_DYNLOADING))
1292 $$(error ENABLE_CUSTOMTARGET_COMPONENTS just works with DISABLE_DYNLOADING)
1293 endif
1294 $(foreach type,$(3),$(if $(filter $(type),$(call gb_LinkTarget__get_all_$(1),$(2))),, \
1295 $(if $(gb_DEBUG_STATIC),$$(info $(call gb_LinkTarget__get_all_$(1)_var,$(2)) += $(type))) \
1296 $$(eval $(call gb_LinkTarget__get_all_$(1)_var,$(2)) += $(type)) \
1298 endif
1300 endef
1302 # call gb_LinkTarget__use_libraries,linktarget,requestedlibs,actuallibs,linktargetmakefilename
1303 define gb_LinkTarget__use_libraries
1305 # used by bin/module-deps.pl
1306 ifneq ($(ENABLE_PRINT_DEPS),)
1307 # exclude libraries in Library_merged
1308 ifeq ($(filter $(1),$(foreach lib,$(gb_MERGEDLIBS),$(call gb_Library_get_linktarget,$(lib)))),)
1309 $$(eval $$(call gb_PrintDeps_info,$(4),$(3)))
1310 endif
1311 endif
1313 $(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(3)
1315 ifeq (,$(DISABLE_DYNLOADING))
1316 # depend on the exports of the library, not on the library itself
1317 # for faster incremental builds when the ABI is unchanged.
1318 # export files are created from the library, so this also ensures the library exists.
1319 $(foreach lib,$(call gb_LinkTarget__filter_lo_libraries,$(3)),$(if $(filter $(lib),$(gb_Library_KNOWNLIBS)), \
1320 $$(eval $(call gb_LinkTarget_get_target,$(1)) : $(call gb_Library_get_exports_target,$(lib))) \
1323 else # DISABLE_DYNLOADING
1324 # depend on the now-static libraries themself, but only if the target actually links to it
1325 ifneq (,$(call gb_LinkTarget_does_real_link,$(1)))
1326 $(call gb_LinkTarget_get_target,$(1)) : T_LIBS += $(call gb_LinkTarget__filter_sys_libraries,$(3))
1327 $(if $(filter-out Library,gb_LinkTarget__get_workdir_linktargetclass,$(1)), \
1328 $(foreach lib,$(call gb_LinkTarget__filter_lo_libraries,$(3)),$(if $(filter $(lib),$(gb_Library_KNOWNLIBS)), \
1329 $$(eval $(call gb_LinkTarget_get_target,$(1)) : $(call gb_Library_get_linktarget_target,$(lib))) \
1331 endif
1332 endif # DISABLE_DYNLOADING
1334 $(call gb_LinkTarget__register_type,libraries,$(1),$(3))
1336 $(foreach lib,$(call gb_LinkTarget__filter_lo_libraries,$(2)),$(if $(filter $(lib),$(gb_Library_KNOWNLIBS)), \
1337 $(eval $(call gb_LinkTarget_get_headers_target,$(1)) : $(call gb_Library_get_headers_target,$(lib))) \
1338 $(call gb_LinkTarget__lib_dummy_depend,$(lib)) \
1341 endef # gb_LinkTarget__use_libraries
1343 # libraries which are merged but need to be built for gb_BUILD_HELPER_TOOLS
1344 gb_BUILD_HELPER_LIBS := $(foreach lib, \
1345 basegfx \
1346 comphelper \
1347 cppu \
1348 cppuhelper \
1349 i18nlangtag \
1350 reg \
1351 sal \
1352 salhelper \
1353 sax \
1354 store \
1355 tl \
1356 ucbhelper \
1357 unoidl \
1358 xmlreader \
1359 , $(call gb_Library__get_workdir_linktargetname,$(lib)))
1361 # tools libmerged depends on, so they link against gb_BUILD_HELPER_LIBS
1362 gb_BUILD_HELPER_TOOLS := $(foreach exe,\
1363 cppumaker \
1364 svidl \
1365 unoidl-check \
1366 unoidl-write \
1367 , $(call gb_Executable__get_workdir_linktargetname,$(exe)))
1369 # call gb_LinkTarget__is_build_lib,linktargetname
1370 define gb_LinkTarget__is_build_lib
1371 $(if $(filter $(call gb_LinkTarget__get_workdir_linktargetname,$(1)),$(call gb_BUILD_HELPER_LIBS)),$(true))
1372 endef
1374 # call gb_LinkTarget__is_build_tool,linktargetname
1375 define gb_LinkTarget__is_build_tool
1376 $(if $(filter $(call gb_LinkTarget__get_workdir_linktargetname,$(1)),$(call gb_BUILD_HELPER_TOOLS)),$(true))
1377 endef
1379 define gb_LinkTarget__is_merged
1380 $(filter $(1),$(foreach lib,$(gb_MERGEDLIBS),$(call gb_Library_get_linktarget,$(lib))))
1381 endef
1383 # call gb_LinkTarget_use_libraries,linktarget,libs
1384 define gb_LinkTarget_use_libraries
1385 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2)))
1386 $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
1387 $$(eval $$(call gb_Output_error,Cannot link against library/libraries '$$(filter-out $(gb_Library_KNOWNLIBS) $(gb_LinkTarget__syslib),$(2))'. Libraries must be registered in Repository.mk or RepositoryExternal.mk))
1388 endif
1389 ifneq (,$$(filter $(2),$(gb_Library_KNOWNPLUGINS)))
1390 ifneq (,$$(filter $(1),$$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library__get_workdir_linktargetname,$(plugin)))))
1391 $$(eval $$(call gb_Output_error,Cannot link against plugin library/libraries '$$(filter $(2),$(gb_Library_KNOWNPLUGINS))'. Only plugins are allowed to do that.))
1392 endif
1393 endif
1395 ifeq ($(call gb_LinkTarget__is_build_tool,$(1))$(call gb_LinkTarget__is_build_lib,$(1)),$(true))
1396 $(call gb_LinkTarget__use_libraries,$(1),$(2),$(2),$(4))
1397 else
1398 # $$(3) = Always just depend on non-merged libs. If any dependency is merged, but you aren't, also depend on "merged".
1399 $(call gb_LinkTarget__use_libraries,$(1),$(2),$(strip \
1400 $(filter-out $(gb_MERGEDLIBS),$(2)) \
1401 $(if $(filter $(gb_MERGEDLIBS),$(2)),$(if $(call gb_LinkTarget__is_merged,$(1)),,merged)) \
1402 ),$(4))
1403 endif
1405 endef
1407 # avoid problem when a module is built partially but other modules that define
1408 # needed static libraries is not yet built: prevent invocation of pattern rule
1409 # for static library with invalid parameters by depending on the header target
1410 define gb_LinkTarget__static_lib_dummy_depend
1411 $(call gb_StaticLibrary_get_target,$(1)) :| \
1412 $(call gb_StaticLibrary_get_headers_target,$(1))
1414 endef
1416 # for a StaticLibrary, dependent libraries are not actually linked in
1417 # call gb_LinkTarget_use_static_libraries,linktarget,staticlibs
1418 define gb_LinkTarget_use_static_libraries
1419 $(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS += $$(if $$(filter-out StaticLibrary,$$(TARGETTYPE)),$(2))
1420 $(if $(call gb_LinkTarget__is_merged,$(1)),\
1421 $(call gb_Library_get_linktarget_target,merged) : \
1422 LINKED_STATIC_LIBS += $$(if $$(filter-out StaticLibrary,$$(TARGETTYPE)),$(2)))
1424 # depend on the static libraries, but only if the target actually links to it
1425 ifneq (,$(call gb_LinkTarget_does_real_link,$(1)))
1426 # make has a size limit for the prerequisites string, which will be exceeded for some larger static links,
1427 # like soffice.bin, but there seems to be no limit for makefile lines...
1428 $(foreach lib,$(2), \
1429 $$(eval $(call gb_LinkTarget_get_target,$(1)): $(call gb_StaticLibrary_get_linktarget_target,$(lib))))
1430 endif
1432 $(call gb_LinkTarget__register_type,statics,$(1),$(2))
1434 $(call gb_LinkTarget_get_headers_target,$(1)) : \
1435 $(foreach lib,$(2),$(call gb_StaticLibrary_get_headers_target,$(lib)))
1436 $(foreach lib,$(2),$(call gb_LinkTarget__static_lib_dummy_depend,$(lib)))
1438 endef # gb_LinkTarget_use_static_libraries
1440 # call gb_LinkTarget_add_cobject,linktarget,sourcefile,cflags,linktargetmakefilename
1441 define gb_LinkTarget_add_cobject
1442 $(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)))))
1443 $(call gb_LinkTarget_get_target,$(1)) : COBJECTS += $(2)
1444 $(call gb_LinkTarget_get_clean_target,$(1)) : COBJECTS += $(2)
1446 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_CObject_get_target,$(2))
1447 $(call gb_CObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1448 $(call gb_CObject_get_target,$(2)) : T_CFLAGS += $(call gb_LinkTarget__get_cflags,$(4)) $(3)
1449 $(call gb_CObject_get_target,$(2)) : \
1450 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1452 ifeq ($(gb_FULLDEPS),$(true))
1453 $(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS += $(2)
1454 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CObject_get_dep_target,$(2))
1455 $(call gb_CObject_get_dep_target,$(2)) :| $(dir $(call gb_CObject_get_dep_target,$(2))).dir
1456 $(call gb_CObject_get_target,$(2)) :| $(dir $(call gb_CObject_get_dep_target,$(2))).dir
1457 endif
1459 endef
1461 # call gb_LinkTarget_add_cxxobject_internal,linktarget,sourcefile,cxxflags,linktargetmakefilename,exceptionflags
1462 # The purpose of the exceptionflags extra argument is to differentiate between usage that just needs
1463 # exception flags and usage that adds other flags. Using a PCH requires the same cxxflags as the ones used
1464 # to create the PCH, so non-empty cxxflags here mean the object cannot use the PCH, and the add_exception_cxxobject
1465 # variant passes the necessary flags by setting the extra argument.
1466 define gb_LinkTarget_add_cxxobject_internal
1467 $(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)))))
1468 $(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2)
1469 $(call gb_LinkTarget_get_clean_target,$(1)) : CXXOBJECTS += $(2)
1471 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_CxxObject_get_target,$(2))
1472 $(call gb_CxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1473 $(call gb_CxxObject_get_target,$(2)) : T_CXXFLAGS += $(call gb_LinkTarget__get_cxxflags,$(4)) $(3) $(5)
1474 $(call gb_CxxObject_get_target,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS := $(if $(strip $(3)),1)
1475 $(call gb_CxxObject_get_target,$(2)) : \
1476 OBJECTOWNER := $(if $(6),,$(call gb_Object__owner,$(2),$(1)))
1477 ifneq ($(gb_ENABLE_PCH),)
1478 ifeq ($(6),)
1479 $(call gb_CxxObject_get_target,$(2)) : $(call gb_LinkTarget_get_pch_timestamp,$(4))
1480 endif
1481 endif
1483 ifeq ($(gb_FULLDEPS),$(true))
1484 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS += $(2)
1485 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CxxObject_get_dep_target,$(2))
1486 $(call gb_CxxObject_get_dep_target,$(2)) :| $(dir $(call gb_CxxObject_get_dep_target,$(2))).dir
1487 $(call gb_CxxObject_get_target,$(2)) :| $(dir $(call gb_CxxObject_get_dep_target,$(2))).dir
1488 endif
1490 endef
1492 # call gb_LinkTarget_add_cxxobject,linktarget,sourcefile,cxxflags,linktargetmakefilename
1493 define gb_LinkTarget_add_cxxobject
1494 $(call gb_LinkTarget_add_cxxobject_internal,$(1),$(2),$(3),$(4))
1495 endef
1497 # call gb_LinkTarget_add_objcobject,linktarget,sourcefile,objcflags,linktargetmakefilename
1498 define gb_LinkTarget_add_objcobject
1499 $(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)))))
1500 $(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS += $(2)
1501 $(call gb_LinkTarget_get_clean_target,$(1)) : OBJCOBJECTS += $(2)
1503 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_ObjCObject_get_target,$(2))
1504 $(call gb_ObjCObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1505 $(call gb_ObjCObject_get_target,$(2)) : T_OBJCFLAGS += $(call gb_LinkTarget__get_objcflags,$(4)) $(3)
1506 $(call gb_ObjCObject_get_target,$(2)) : \
1507 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1509 ifeq ($(gb_FULLDEPS),$(true))
1510 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS += $(2)
1511 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_ObjCObject_get_dep_target,$(2))
1512 $(call gb_ObjCObject_get_dep_target,$(2)) :| $(dir $(call gb_ObjCObject_get_dep_target,$(2))).dir
1513 $(call gb_ObjCObject_get_target,$(2)) :| $(dir $(call gb_ObjCObject_get_dep_target,$(2))).dir
1514 endif
1516 endef
1518 # call gb_LinkTarget_add_objcxxobject,linktarget,sourcefile,objcxxflags,linktargetmakefilename
1519 define gb_LinkTarget_add_objcxxobject
1520 $(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)))))
1521 $(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS += $(2)
1522 $(call gb_LinkTarget_get_clean_target,$(1)) : OBJCXXOBJECTS += $(2)
1524 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_ObjCxxObject_get_target,$(2))
1525 $(call gb_ObjCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1526 $(call gb_ObjCxxObject_get_target,$(2)) : T_OBJCXXFLAGS += $(call gb_LinkTarget__get_objcxxflags,$(4)) $(3)
1527 $(call gb_ObjCxxObject_get_target,$(2)) : \
1528 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1530 ifeq ($(gb_FULLDEPS),$(true))
1531 $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS += $(2)
1532 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_ObjCxxObject_get_dep_target,$(2))
1533 $(call gb_ObjCxxObject_get_dep_target,$(2)) :| $(dir $(call gb_ObjCxxObject_get_dep_target,$(2))).dir
1534 $(call gb_ObjCxxObject_get_target,$(2)) :| $(dir $(call gb_ObjCxxObject_get_dep_target,$(2))).dir
1535 endif
1537 endef
1539 # call gb_LinkTarget_add_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
1540 define gb_LinkTarget_add_cxxclrobject
1541 $(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)))))
1542 $(call gb_LinkTarget_get_target,$(1)) : CXXCLROBJECTS += $(2)
1543 $(call gb_LinkTarget_get_clean_target,$(1)) : CXXCLROBJECTS += $(2)
1545 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_CxxClrObject_get_target,$(2))
1546 $(call gb_CxxClrObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1547 $(call gb_CxxClrObject_get_target,$(2)) : T_CXXCLRFLAGS += $(call gb_LinkTarget__get_cxxclrflags,$(4)) $(3)
1548 $(call gb_CxxClrObject_get_target,$(2)) : \
1549 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1551 ifeq ($(gb_FULLDEPS),$(true))
1552 $(call gb_LinkTarget_get_dep_target,$(1)) : CXXCLROBJECTS += $(2)
1553 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CxxClrObject_get_dep_target,$(2))
1554 $(call gb_CxxClrObject_get_dep_target,$(2)) :| $(dir $(call gb_CxxClrObject_get_dep_target,$(2))).dir
1555 $(call gb_CxxClrObject_get_target,$(2)) :| $(dir $(call gb_CxxClrObject_get_dep_target,$(2))).dir
1556 endif
1558 endef
1560 # call gb_LinkTarget_add_asmobject,linktarget,sourcefile
1561 define gb_LinkTarget_add_asmobject
1562 $(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)))))
1563 $(call gb_LinkTarget_get_target,$(1)) : ASMOBJECTS += $(2)
1564 $(call gb_LinkTarget_get_clean_target,$(1)) : ASMOBJECTS += $(2)
1566 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_AsmObject_get_target,$(2))
1567 $(call gb_AsmObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1568 $(call gb_AsmObject_get_target,$(2)) : \
1569 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1571 ifeq ($(gb_FULLDEPS),$(true))
1572 $(call gb_LinkTarget_get_dep_target,$(1)) : ASMOBJECTS += $(2)
1573 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_AsmObject_get_dep_target,$(2))
1574 $(call gb_AsmObject_get_dep_target,$(2)) :| $(dir $(call gb_AsmObject_get_dep_target,$(2))).dir
1575 $(call gb_AsmObject_get_target,$(2)) :| $(dir $(call gb_AsmObject_get_dep_target,$(2))).dir
1576 endif
1578 endef
1580 # call gb_LinkTarget_add_generated_c_object,linktarget,sourcefile,cflags,linktargetmakefilename
1581 define gb_LinkTarget_add_generated_c_object
1582 $(call gb_LinkTarget_get_target,$(1)) : GENCOBJECTS += $(2)
1583 $(call gb_LinkTarget_get_clean_target,$(1)) : GENCOBJECTS += $(2)
1585 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCObject_get_target,$(2))
1586 $(call gb_GenCObject_get_target,$(2)) : $(call gb_GenCObject_get_source,$(2))
1587 # Often gb_GenCObject_get_source does not have its own rule and is only a byproduct.
1588 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1589 $(call gb_GenCObject_get_source,$(2)) : | $(gb_Helper_MISCDUMMY)
1590 $(call gb_GenCObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1591 $(call gb_GenCObject_get_target,$(2)) : WARNINGS_NOT_ERRORS := $(true)
1592 $(call gb_GenCObject_get_target,$(2)) : T_CFLAGS += $(call gb_LinkTarget__get_cflags,$(4)) $(3)
1593 $(call gb_GenCObject_get_target,$(2)) : \
1594 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1596 ifeq ($(gb_FULLDEPS),$(true))
1597 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS += $(2)
1598 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenCObject_get_dep_target,$(2))
1599 $(call gb_GenCObject_get_dep_target,$(2)) :| $(dir $(call gb_GenCObject_get_dep_target,$(2))).dir
1600 $(call gb_GenCObject_get_target,$(2)) :| $(dir $(call gb_GenCObject_get_dep_target,$(2))).dir
1601 endif
1603 endef
1605 # call gb_LinkTarget_add_generated_cxx_object_internal,linktarget,sourcefile,cxxflags,linktargetmakefilename,exceptionflags
1606 define gb_LinkTarget_add_generated_cxx_object_internal
1607 $(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS += $(2)
1608 $(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXOBJECTS += $(2)
1610 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCxxObject_get_target,$(2))
1611 $(call gb_GenCxxObject_get_target,$(2)) : $(call gb_GenCxxObject_get_source,$(2),$(1))
1612 # Often gb_GenCxxObject_get_source does not have its own rule and is only a byproduct.
1613 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1614 $(call gb_GenCxxObject_get_source,$(2),$(1)) : | $(gb_Helper_MISCDUMMY)
1615 $(call gb_GenCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1616 $(call gb_GenCxxObject_get_target,$(2)) : WARNINGS_NOT_ERRORS := $(true)
1617 $(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(call gb_LinkTarget__get_cxxflags,$(4)) $(3) $(5)
1618 $(call gb_GenCxxObject_get_target,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS := $(if $(strip $(3)),1)
1619 $(call gb_GenCxxObject_get_target,$(2)) : \
1620 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1621 $(call gb_GenCxxObject_get_target,$(2)) : GEN_CXX_SOURCE := $(call gb_GenCxxObject_get_source,$(2),$(1))
1622 ifneq ($(gb_ENABLE_PCH),)
1623 $(call gb_GenCxxObject_get_target,$(2)) : $(call gb_LinkTarget_get_pch_timestamp,$(4))
1624 endif
1626 ifeq ($(gb_FULLDEPS),$(true))
1627 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS += $(2)
1628 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenCxxObject_get_dep_target,$(2))
1629 $(call gb_GenCxxObject_get_dep_target,$(2)) :| $(dir $(call gb_GenCxxObject_get_dep_target,$(2))).dir
1630 $(call gb_GenCxxObject_get_target,$(2)) :| $(dir $(call gb_GenCxxObject_get_dep_target,$(2))).dir
1631 endif
1633 endef
1635 # call gb_LinkTarget_add_generated_cxx_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1636 define gb_LinkTarget_add_generated_cxx_object
1637 $(call gb_LinkTarget_add_generated_cxx_object_internal,$(1),$(2),$(3),$(4))
1638 endef
1640 # call gb_LinkTarget_add_generated_objc_object,linktarget,sourcefile,cflags,linktargetmakefilename
1641 define gb_LinkTarget_add_generated_objc_object
1642 $(call gb_LinkTarget_get_target,$(1)) : GENOBJCOBJECTS += $(2)
1643 $(call gb_LinkTarget_get_clean_target,$(1)) : GENOBJCOBJECTS += $(2)
1645 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenObjCObject_get_target,$(2))
1646 $(call gb_GenObjCObject_get_target,$(2)) : $(call gb_GenObjCObject_get_source,$(2))
1647 # Often gb_GenObjCObject_get_source does not have its own rule and is only a byproduct.
1648 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1649 $(call gb_GenObjCObject_get_source,$(2)) : | $(gb_Helper_MISCDUMMY)
1650 $(call gb_GenObjCObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1651 $(call gb_GenObjCObject_get_target,$(2)) : WARNINGS_NOT_ERRORS := $(true)
1652 $(call gb_GenObjCObject_get_target,$(2)) : T_OBJCFLAGS += $(call gb_LinkTarget__get_objcflags,$(4)) $(3)
1653 $(call gb_GenObjCObject_get_target,$(2)) : \
1654 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1656 ifeq ($(gb_FULLDEPS),$(true))
1657 $(call gb_LinkTarget_get_dep_target,$(1)) : GENOBJCOBJECTS += $(2)
1658 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenObjCObject_get_dep_target,$(2))
1659 $(call gb_GenObjCObject_get_dep_target,$(2)) :| $(dir $(call gb_GenObjCObject_get_dep_target,$(2))).dir
1660 $(call gb_GenObjCObject_get_target,$(2)) :| $(dir $(call gb_GenObjCObject_get_dep_target,$(2))).dir
1661 endif
1663 endef
1665 # call gb_LinkTarget_add_generated_nasm_object,linktarget,sourcefile,nasmflags,linktargetmakefilename
1666 define gb_LinkTarget_add_generated_nasm_object
1667 $(call gb_LinkTarget_get_target,$(1)) : GENNASMOBJECTS += $(2)
1668 $(call gb_LinkTarget_get_clean_target,$(1)) : GENNASMOBJECTS += $(2)
1670 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenNasmObject_get_target,$(2))
1671 $(call gb_GenNasmObject_get_target,$(2)) : $(call gb_GenNasmObject_get_source,$(2))
1672 # Often gb_GenNasmObject_get_source does not have its own rule and is only a byproduct.
1673 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1674 $(call gb_GenNasmObject_get_source,$(2)) : | $(gb_Helper_MISCDUMMY)
1675 $(call gb_GenNasmObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1676 $(call gb_GenNasmObject_get_target,$(2)) : T_NASMFLAGS += $(call gb_LinkTarget__get_nasmflags,$(4)) $(3)
1677 $(call gb_GenNasmObject_get_target,$(2)) : \
1678 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1680 ifeq ($(gb_FULLDEPS),$(true))
1681 $(call gb_LinkTarget_get_dep_target,$(1)) : GENNASMOBJECTS += $(2)
1682 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenNasmObject_get_dep_target,$(2))
1683 $(call gb_GenNasmObject_get_dep_target,$(2)) :| $(dir $(call gb_GenNasmObject_get_dep_target,$(2))).dir
1684 $(call gb_GenNasmObject_get_target,$(2)) :| $(dir $(call gb_GenNasmObject_get_dep_target,$(2))).dir
1685 endif
1687 endef
1689 # call gb_LinkTarget_add_generated_objcxx_object,linktarget,sourcefile,cflags,linktargetmakefilename
1690 define gb_LinkTarget_add_generated_objcxx_object
1691 $(call gb_LinkTarget_get_target,$(1)) : GENOBJCXXOBJECTS += $(2)
1692 $(call gb_LinkTarget_get_clean_target,$(1)) : GENOBJCXXOBJECTS += $(2)
1694 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenObjCxxObject_get_target,$(2))
1695 $(call gb_GenObjCxxObject_get_target,$(2)) : $(call gb_GenObjCxxObject_get_source,$(2))
1696 # Often gb_GenObjCxxObject_get_source does not have its own rule and is only a byproduct.
1697 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1698 $(call gb_GenObjCxxObject_get_source,$(2)) : | $(gb_Helper_MISCDUMMY)
1699 $(call gb_GenObjCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1700 $(call gb_GenObjCxxObject_get_target,$(2)) : WARNINGS_NOT_ERRORS := $(true)
1701 $(call gb_GenObjCxxObject_get_target,$(2)) : T_OBJCXXFLAGS += $(call gb_LinkTarget__get_objcxxflags,$(4)) $(3)
1702 $(call gb_GenObjCxxObject_get_target,$(2)) : \
1703 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1705 ifeq ($(gb_FULLDEPS),$(true))
1706 $(call gb_LinkTarget_get_dep_target,$(1)) : GENOBJCXXOBJECTS += $(2)
1707 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenObjCxxObject_get_dep_target,$(2))
1708 $(call gb_GenObjCxxObject_get_dep_target,$(2)) :| $(dir $(call gb_GenObjCxxObject_get_dep_target,$(2))).dir
1709 $(call gb_GenObjCxxObject_get_target,$(2)) :| $(dir $(call gb_GenObjCxxObject_get_dep_target,$(2))).dir
1710 endif
1712 endef
1714 # call gb_LinkTarget_add_generated_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
1715 define gb_LinkTarget_add_generated_cxxclrobject
1716 $(call gb_LinkTarget_get_target,$(1)) : GENCXXCLROBJECTS += $(2)
1717 $(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXCLROBJECTS += $(2)
1719 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCxxClrObject_get_target,$(2))
1720 $(call gb_GenCxxClrObject_get_target,$(2)) : $(call gb_GenCxxClrObject_get_source,$(2),$(1))
1721 $(call gb_GenCxxClrObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
1722 $(call gb_GenCxxClrObject_get_target,$(2)) : T_CXXCLRFLAGS += $(call gb_LinkTarget__get_cxxclrflags,$(4)) $(3)
1723 $(call gb_GenCxxClrObject_get_target,$(2)) : \
1724 OBJECTOWNER := $(call gb_Object__owner,$(2),$(1))
1725 $(call gb_GenCxxClrObject_get_target,$(2)) : GEN_CXXCLR_SOURCE := $(call gb_GenCxxClrObject_get_source,$(2),$(1))
1727 ifeq ($(gb_FULLDEPS),$(true))
1728 $(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXCLROBJECTS += $(2)
1729 $(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenCxxClrObject_get_dep_target,$(2))
1730 $(call gb_GenCxxClrObject_get_dep_target,$(2)) :| $(dir $(call gb_GenCxxClrObject_get_dep_target,$(2))).dir
1731 $(call gb_GenCxxClrObject_get_target,$(2)) :| $(dir $(call gb_GenCxxClrObject_get_dep_target,$(2))).dir
1732 endif
1734 endef
1736 # Add a bison grammar to the build.
1737 # call gb_LinkTarget_add_grammar,linktarget,yaccfile,cxxflags,linktargetmakefilename
1738 define gb_LinkTarget_add_grammar
1739 $(call gb_YaccTarget_YaccTarget,$(2))
1740 $(call gb_LinkTarget_add_generated_exception_object,$(1),YaccTarget/$(2),$(3) $(if $(filter GCC,$(COM)),-Wno-unused-macros),$(4))
1741 $(call gb_GenCxxObject_get_target,YaccTarget/$(2)): PLUGIN_WARNINGS_AS_ERRORS := $(true)
1742 $(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_YaccTarget_get_clean_target,$(2))
1743 $(call gb_LinkTarget_get_headers_target,$(1)) : $(call gb_YaccTarget_get_header_target,$(2))
1744 $(call gb_LinkTarget__add_include,$(1),$(dir $(call gb_YaccTarget_get_header_target,$(2))))
1746 endef
1748 # Add bison grammars to the build.
1749 # call gb_LinkTarget_add_grammars,linktarget,yaccfiles,cxxflags,linktargetmakefilename
1750 define gb_LinkTarget_add_grammars
1751 $(foreach grammar,$(2),$(call gb_LinkTarget_add_grammar,$(1),$(grammar),$(3),$(4)))
1752 endef
1754 # Add a flex scanner to the build.
1755 # call gb_LinkTarget_add_scanner,linktarget,lexfile,cxxflags,linktargetmakefilename
1756 define gb_LinkTarget_add_scanner
1757 $(call gb_LexTarget_LexTarget,$(2))
1758 $(call gb_LinkTarget_add_generated_exception_object,$(1),LexTarget/$(2),$(3) $(if $(filter GCC,$(COM)),-Wno-unused-macros),$(4))
1759 $(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_LexTarget_get_clean_target,$(2))
1761 endef
1763 # Add flex scanners to the build.
1764 # call gb_LinkTarget_add_scanners,linktarget,lexfiles,cxxflags,linktargetmakefilename
1765 define gb_LinkTarget_add_scanners
1766 $(foreach scanner,$(2),$(call gb_LinkTarget_add_scanner,$(1),$(scanner),$(3),$(4)))
1768 endef
1770 # call gb_LinkTarget_add_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1771 define gb_LinkTarget_add_exception_object
1772 $(call gb_LinkTarget_add_cxxobject_internal,$(1),$(2),$(3),$(4),$(gb_LinkTarget_EXCEPTIONFLAGS))
1773 endef
1775 # call gb_LinkTarget__use_linktarget_objects,linktarget,linktargets
1776 define gb_LinkTarget__use_linktarget_objects
1777 $(call gb_LinkTarget_get_target,$(1)) : $(foreach linktarget,$(2),$(call gb_LinkTarget_get_target,$(linktarget)))
1778 ifneq ($(OS),iOS)
1779 $(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS += $(foreach linktarget,$(2),$(call gb_LinkTarget_get_objects_list,$(linktarget)))
1780 endif
1782 endef
1784 # call gb_LinkTarget_use_library_objects,linktarget,libs
1785 define gb_LinkTarget_use_library_objects
1786 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
1787 $$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
1788 $$(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))
1789 endif
1790 $(call gb_LinkTarget__use_linktarget_objects,$(1),$(foreach lib,$(2),$(call gb_Library_get_linktarget,$(lib))))
1791 $(call gb_LinkTarget_get_headers_target,$(1)) : \
1792 $(foreach lib,$(2),$(call gb_Library_get_headers_target,$(lib)))
1794 endef
1796 # call gb_LinkTarget_use_executable_objects,linktarget,exes
1797 define gb_LinkTarget_use_executable_objects
1798 $(call gb_LinkTarget__use_linktarget_objects,$(1),$(foreach exe,$(2),$(call gb_Executable_get_linktarget,$(exe))))
1800 endef
1802 # call gb_LinkTarget_add_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1803 define gb_LinkTarget_add_cobjects
1804 $(foreach obj,$(2),$(call gb_LinkTarget_add_cobject,$(1),$(obj),$(3),$(4)))
1805 endef
1807 # call gb_LinkTarget_add_cxxobjects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1808 define gb_LinkTarget_add_cxxobjects
1809 $(foreach obj,$(2),$(call gb_LinkTarget_add_cxxobject,$(1),$(obj),$(3),$(4)))
1810 endef
1812 # call gb_LinkTarget_add_objcobjects,linktarget,sourcefiles,objcflags,linktargetmakefilename
1813 define gb_LinkTarget_add_objcobjects
1814 $(foreach obj,$(2),$(call gb_LinkTarget_add_objcobject,$(1),$(obj),$(3),$(4)))
1815 endef
1817 # call gb_LinkTarget_add_objcxxobjects,linktarget,sourcefiles,objcxxflags,linktargetmakefilename
1818 define gb_LinkTarget_add_objcxxobjects
1819 $(foreach obj,$(2),$(call gb_LinkTarget_add_objcxxobject,$(1),$(obj),$(3),$(4)))
1820 endef
1822 # call gb_LinkTarget_add_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename
1823 define gb_LinkTarget_add_cxxclrobjects
1824 $(foreach obj,$(2),$(call gb_LinkTarget_add_cxxclrobject,$(1),$(obj),$(3),$(4)))
1825 endef
1827 # call gb_LinkTarget_add_asmobjects,linktarget,sourcefiles,asmflags,linktargetmakefilename
1828 define gb_LinkTarget_add_asmobjects
1829 $(foreach obj,$(2),$(call gb_LinkTarget_add_asmobject,$(1),$(obj),$(3),$(4)))
1830 endef
1832 # call gb_LinkTarget_add_exception_objects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1833 define gb_LinkTarget_add_exception_objects
1834 $(foreach obj,$(2),$(call gb_LinkTarget_add_exception_object,$(1),$(obj),$(3),$(4)))
1835 endef
1837 #only useful for building x64 libraries on windows
1838 # call gb_LinkTarget_add_x64_generated_exception_objects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1839 define gb_LinkTarget_add_x64_generated_exception_objects
1840 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_exception_object,$(1),$(obj),$(3),$(4)))
1841 $(foreach obj,$(2),$(eval $(call gb_GenCxxObject_get_target,$(obj)) : CXXOBJECT_X64 := YES))
1842 endef
1844 # call gb_LinkTarget_add_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1845 define gb_LinkTarget_add_generated_cobjects
1846 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_c_object,$(1),$(obj),$(3),$(4)))
1847 endef
1849 #only useful for building x64 libraries on windows
1850 # call gb_LinkTarget_add_x64_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1851 define gb_LinkTarget_add_x64_generated_cobjects
1852 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_c_object,$(1),$(obj),$(3),$(4)))
1853 endef
1855 # call gb_LinkTarget_add_generated_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1856 define gb_LinkTarget_add_generated_exception_object
1857 $(call gb_LinkTarget_add_generated_cxx_object_internal,$(1),$(2),$(3),$(4),$(gb_LinkTarget_EXCEPTIONFLAGS))
1858 endef
1860 # call gb_LinkTarget_add_generated_exception_objects,linktarget,sourcefile,cxxflags,linktargetmakefilename
1861 define gb_LinkTarget_add_generated_exception_objects
1862 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_exception_object,$(1),$(obj),$(3),$(4)))
1863 endef
1865 # call gb_LinkTarget_add_generated_objcobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1866 define gb_LinkTarget_add_generated_objcobjects
1867 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_objc_object,$(1),$(obj),$(3),$(4)))
1868 endef
1870 # call gb_LinkTarget_add_generated_objcxxobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1871 define gb_LinkTarget_add_generated_objcxxobjects
1872 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_objcxx_object,$(1),$(obj),$(3),$(4)))
1873 endef
1875 # call gb_LinkTarget_add_generated_nasmobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1876 define gb_LinkTarget_add_generated_nasmobjects
1877 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_nasm_object,$(1),$(obj),$(3),$(4)))
1878 endef
1880 # call gb_LinkTarget_add_generated_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename
1881 define gb_LinkTarget_add_generated_cxxclrobjects
1882 $(foreach obj,$(2),$(call gb_LinkTarget_add_generated_cxxclrobject,$(1),$(obj),$(3),$(4)))
1883 endef
1885 # call gb_LinkTarget_set_targettype,linktarget,targettype
1886 define gb_LinkTarget_set_targettype
1887 $(call gb_LinkTarget_get_target,$(1)) : TARGETTYPE := $(2)
1889 endef
1891 # call gb_LinkTarget_set_x64,linktarget,boolean
1892 define gb_LinkTarget_set_x64
1893 $(call gb_LinkTarget_get_target,$(1)) : LIBRARY_X64 := $(2)
1895 endef
1897 # call gb_LinkTarget_set_x86,linktarget,boolean
1898 define gb_LinkTarget_set_x86
1899 $(call gb_LinkTarget_get_target,$(1)) : PE_X86 := $(2)
1901 endef
1903 # call gb_LinkTarget_set_ilibtarget,linktarget,ilibfilename
1904 define gb_LinkTarget_set_ilibtarget
1905 ifeq (,$(DISABLE_DYNLOADING))
1906 $(call gb_LinkTarget_get_clean_target,$(1)) \
1907 $(call gb_LinkTarget_get_target,$(1)) : ILIBTARGET := $(2)
1908 endif
1910 endef
1912 # Add a file that is built by the LinkTarget command and define
1913 # a dummy touch rule for it so it can be tracked via dependencies.
1914 # The assumption is that the file is created by linking; in case it does not
1915 # exist there is some problem. This can be caused on WNT by re-naming DLL
1916 # files (which are aux-targets) but not the import .lib files (which
1917 # are the LinkTargets) and doing an incremental build.
1918 # call gb_LinkTarget_add_auxtarget,linktarget,auxtarget
1919 define gb_LinkTarget_add_auxtarget
1920 $(2) : $(call gb_LinkTarget_get_target,$(1))
1921 if test -e $$@; then \
1922 touch -r $$< $$@; \
1923 else \
1924 rm -f $$<; \
1925 echo "ERROR: aux-target $$@ missing, library deleted, please try running make again"; \
1926 false; \
1929 $(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS += $(2)
1931 endef
1933 # call gb_LinkTarget_add_auxtargets,linktarget,auxtargets
1934 define gb_LinkTarget_add_auxtargets
1935 $(foreach aux,$(2),$(call gb_LinkTarget_add_auxtarget,$(1),$(aux)))
1937 endef
1939 # call gb_LinkTarget__use_custom_headers,linktarget,customtarget
1940 define gb_LinkTarget__use_custom_headers
1941 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
1942 $(call gb_CustomTarget_get_target,$(2))
1943 $(call gb_LinkTarget__add_include,$(1),$(call gb_CustomTarget_get_workdir,$(2)))
1945 endef
1947 # call gb_LinkTarget_use_custom_headers,linktarget,customtargets
1948 define gb_LinkTarget_use_custom_headers
1949 $(foreach customtarget,$(2),$(call gb_LinkTarget__use_custom_headers,$(1),$(customtarget)))
1951 endef
1953 # add SDI (svidl) headers
1954 # call gb_LinkTarget_add_sdi_headers,linktarget,sditargets
1955 define gb_LinkTarget_add_sdi_headers
1956 $(call gb_LinkTarget_get_headers_target,$(1)) : $(foreach sdi,$(2),$(call gb_SdiTarget_get_target,$(sdi)))
1957 $(call gb_LinkTarget_get_clean_target,$(1)) : $(foreach sdi,$(2),$(call gb_SdiTarget_get_clean_target,$(sdi)))
1959 endef
1961 # call gb_LinkTarget__set_precompiled_header_variables,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1962 define gb_LinkTarget__set_precompiled_header_variables
1963 $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME := $(3)
1964 $(call gb_LinkTarget_get_target,$(1)) : PCH_HEADER := $(patsubst %.cxx,%.hxx,$(2))
1965 $(call gb_LinkTarget_get_target,$(1)) : PCH_LINKTARGETMAKEFILENAME := $(4)
1967 $(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $$(DEFS)
1968 $(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(T_CXXFLAGS) $(call gb_LinkTarget__get_cxxflags,$(4)) $(gb_LinkTarget_EXCEPTIONFLAGS)
1970 $(call gb_LinkTarget_get_target,$(1)) : DEFS += -DPCH_LEVEL=$(gb_ENABLE_PCH)
1971 $(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS += -DPCH_LEVEL=$(gb_ENABLE_PCH)
1973 endef
1975 # call gb_LinkTarget__set_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1976 define gb_LinkTarget__set_precompiled_header_impl
1977 $(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_PrecompiledHeader_get_clean_target,$(3))
1978 $(call gb_PrecompiledHeader_get_target,$(3),$(4)) : $(call gb_CxxObject_get_source,$(SRCDIR),$(2))
1979 $(call gb_PrecompiledHeader_get_target,$(3),$(4)) : $(patsubst %.cxx,%.hxx,$(call gb_CxxObject_get_source,$(SRCDIR),$(2)))
1980 $(call gb_PrecompiledHeader_get_target,$(3),$(4)) : $(call gb_PrecompiledHeader_get_flags_file,$(3),$(4))
1982 $(call gb_PrecompiledHeader_get_target,$(3),$(4)) : $(call gb_LinkTarget_get_headers_target,$(1))
1984 $(call gb_PrecompiledHeader_get_target,$(3),$(4)) : VISIBILITY :=
1986 $(call gb_LinkTarget_get_pch_timestamp,$(4)) : $(call gb_PrecompiledHeader_get_target,$(3),$(4))
1988 $(call gb_LinkTarget__set_precompiled_header_variables,$(1),$(2),$(3),$(4))
1990 ifeq ($(gb_FULLDEPS),$(true))
1991 -include $(call gb_PrecompiledHeader_get_dep_target,$(3),$(4))
1992 endif
1994 endef
1996 # call gb_LinkTarget__add_precompiled_header_object,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1997 define gb_LinkTarget__add_precompiled_header_object
1998 # Clang-style
1999 ifneq ($(BUILDING_PCH_WITH_OBJ),)
2000 $(call gb_LinkTarget_add_exception_object,$(1),$(2),,$(4))
2001 $(call gb_CxxObject_get_target,$(2)) : T_PCH_EXTRA_CXXFLAGS += $(gb_PrecompiledHeader_pch_with_obj)
2002 endif
2003 # MSVC-style
2004 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJEX = $(call gb_PrecompiledHeader_get_objectfile, $(call gb_PrecompiledHeader_get_target,$(3),$(4)))
2005 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $$(PCHOBJEX)
2007 endef
2009 # 'compiler' set comes only from gb_LinkTarget_set_clang_precompiled_header
2010 # call gb_LinkTarget_set_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename,compiler
2011 define gb_LinkTarget_set_precompiled_header
2012 ifneq ($(gb_ENABLE_PCH),)
2013 $(call gb_LinkTarget__set_precompiled_header_impl,$(1),$(2),$(notdir $(2)),$(4))
2014 $(call gb_PrecompiledHeader_generate_rules,$(notdir $(2)),$(1),$(4),$(2),$(5))
2015 endif
2016 ifneq ($(gb_ENABLE_PCH)$(BLOCK_PCH),)
2017 $(call gb_LinkTarget__add_precompiled_header_object,$(1),$(2),$(notdir $(2)),$(4))
2018 endif
2020 endef
2022 # It seems complicated to forward the clang setting to the PCH rules, so use an extra
2023 # function to set it manually. This variant should be used if gb_LinkTarget_use_clang is used.
2024 # call gb_LinkTarget_set_clang_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename
2025 define gb_LinkTarget_set_clang_precompiled_header
2026 $(call gb_LinkTarget_set_precompiled_header,$(1),$(2),$(3),$(4),$(LO_CLANG_CXX))
2027 endef
2029 # call gb_LinkTarget__reuse_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2030 # Use the PCH as if it was LinkTarget's own, but do nothing with the PCH itself, just depend on it.
2031 define gb_LinkTarget__reuse_precompiled_header_impl
2032 $(call gb_LinkTarget__set_precompiled_header_variables,$(1),$(2),$(3),$(4))
2034 $(call gb_LinkTarget_get_pch_timestamp,$(4)) : $(call gb_LinkTarget_get_pch_reuse_timestamp,$(4))
2036 # We need to depend on a special for_reuse target that depends on the linktarget that owns the PCH.
2037 # Depending directly on the PCH could cause that PCH to be built with this linktarget's flags.
2038 $(call gb_LinkTarget_get_pch_reuse_timestamp,$(4)) : $(call gb_PrecompiledHeader_get_for_reuse_target,$(3),$(4))
2039 $(call gb_PrecompiledHeader_check_flags,$(4),$(2),\
2040 $(call gb_PrecompiledHeader_get_target,$(3),$(4)),\
2041 $(call gb_PrecompiledHeader_get_flags_file,$(3),$(4)),\
2042 $(gb_PrecompiledHeader_cxxflags_includes))
2043 $$(call gb_PrecompiledHeader__copy_reuse_files,$(1),$(3),$(4))
2044 mkdir -p $$(dir $$@) && touch $$@
2046 endef
2048 # call gb_LinkTarget__add_reuse_precompiled_header_object,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2049 define gb_LinkTarget__add_reuse_precompiled_header_object
2050 # Clang-style
2051 ifneq ($(BUILDING_PCH_WITH_OBJ),)
2052 # We need to link in also the PCH's object file. Again, rely on a special for_reuse target for dependencies.
2053 $(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)))))
2054 $(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2)
2055 endif
2056 # MSVC-style
2057 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJEX = $(call gb_PrecompiledHeader_get_objectfile, $(call gb_PrecompiledHeader_get_target,$(3),$(4)))
2058 $(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $$(PCHOBJEX)
2060 endef
2062 # call gb_LinkTarget__reuse_precompiled_header_workarounds,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2063 define gb_LinkTarget__reuse_precompiled_header_workarounds
2064 ifeq ($(COM_IS_CLANG),TRUE)
2065 $(call gb_LinkTarget_add_defs,$(1),$(gb_CXXFLAGS_include)$(SRCDIR)/pch/inc/clangfix.hxx)
2066 $(call gb_LinkTarget_add_defs,$(1),$(gb_CXXFLAGS_no_pch_warnings))
2067 endif
2068 $(if $(filter precompiled_system,$(3)), $(call gb_LinkTarget_add_defs,$(1),-DBOOST_ALL_NO_LIB))
2069 endef
2071 # call gb_LinkTarget_reuse_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename
2072 define gb_LinkTarget_reuse_precompiled_header
2073 ifeq ($(gb_DISABLE_PCH_REUSE),$(false))
2074 ifneq ($(gb_ENABLE_PCH),)
2075 $(call gb_LinkTarget__reuse_precompiled_header_impl,$(1),$(2),$(notdir $(2)),$(4))
2076 $(call gb_LinkTarget__reuse_precompiled_header_workarounds,$(1),$(2),$(notdir $(2)),$(4))
2077 endif
2078 ifneq ($(gb_ENABLE_PCH)$(BLOCK_PCH),)
2079 $(call gb_LinkTarget__add_reuse_precompiled_header_object,$(1),$(2),$(notdir $(2)),$(4))
2080 endif
2081 endif
2083 endef
2085 # call gb_LinkTarget_use_common_precompiled_header,linktarget,,,linktargetmakefilename
2086 define gb_LinkTarget_use_common_precompiled_header
2087 $(call gb_LinkTarget_reuse_precompiled_header,$(1),pch/inc/pch/precompiled_system,,$(4))
2089 endef
2091 # use a header package, possibly from another module
2092 # call gb_LinkTarget_use_package,linktarget,package
2093 define gb_LinkTarget_use_package
2094 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
2095 $(call gb_Package_get_target,$(strip $(2)))
2096 $(call gb_Package_get_target,$(strip $(2))): RDEPENDS += $(call gb_LinkTarget__get_workdir_linktargetname,$(1))
2098 endef
2100 # call gb_LinkTarget_use_packages,linktarget,packages
2101 define gb_LinkTarget_use_packages
2102 $(foreach package,$(2),$(call gb_LinkTarget_use_package,$(1),$(package)))
2103 endef
2105 # use a GeneratedPackage, possibly from another module
2106 # call gb_LinkTarget_use_generated_package,linktarget,package
2107 define gb_LinkTarget_use_generated_package
2108 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
2109 $(call gb_GeneratedPackage_get_target,$(strip $(2)))
2111 endef
2113 # Use sources from unpacked tarball of an external project
2114 # call gb_LinkTarget_use_unpacked,linktarget,unpackedtarget
2115 define gb_LinkTarget_use_unpacked
2116 $(call gb_LinkTarget_get_headers_target,$(1)) :| $(call gb_UnpackedTarball_get_final_target,$(2))
2118 endef
2120 # Use artifacts from ExternalProject (i. e. configure) of an external project
2121 # example in expat: StaticLibrary depends on ExternalProject outcome
2122 # call gb_LinkTarget_use_external_project,linktarget,externalproject,full-dep
2123 define gb_LinkTarget_use_external_project
2124 $(call gb_LinkTarget_get_target,$(1)) :| $(call gb_ExternalProject_get_target,$(2))
2125 $(call gb_LinkTarget_get_headers_target,$(1)) :| \
2126 $(if $(3),$(call gb_ExternalProject_get_target,$(2)),$(call gb_UnpackedTarball_get_final_target,$(2)))
2128 endef
2130 # this forwards to functions that must be defined in RepositoryExternal.mk.
2131 # Automatically forward for libmerged library too when linktarget is merged.
2133 # call gb_LinkTarget_use_external,linktarget,external
2134 define gb_LinkTarget_use_external
2135 $(if $(filter undefined,$(origin gb_LinkTarget__use_$(2))),\
2136 $(error gb_LinkTarget_use_external: unknown external: $(2)) \
2138 $(if $(gb_PARTIAL_BUILD),,$(if $(call gb_LinkTarget__is_merged,$(1)), \
2139 $(call gb_LinkTarget__use_$(2),$(call gb_Library_get_linktarget,merged)))) \
2140 $(call gb_LinkTarget__use_$(2),$(1)) \
2143 $(call gb_LinkTarget__register_type,externals,$(1),$(2))
2145 endef
2147 # $(call gb_LinkTarget_use_externals,library,externals)
2148 gb_LinkTarget_use_externals = \
2149 $(foreach external,$(2),$(call gb_LinkTarget_use_external,$(1),$(external)))
2151 # call gb_LinkTarget_set_visibility_default,linktarget
2152 define gb_LinkTarget_set_visibility_default
2153 $(call gb_LinkTarget_get_target,$(1)) : VISIBILITY := default
2154 ifneq ($(gb_ENABLE_PCH),)
2155 ifneq ($(strip $$(PCH_NAME)),)
2156 $(call gb_PrecompiledHeader_get_target,$$(PCH_NAME),$$(PCH_LINKTARGETMAKEFILENAME)) : VISIBILITY := default
2157 endif
2158 endif
2160 endef
2162 # call gb_LinkTarget_set_warnings_not_errors,linktarget
2163 define gb_LinkTarget_set_warnings_not_errors
2164 $(call gb_LinkTarget_get_target,$(1)) : WARNINGS_NOT_ERRORS := $(true)
2166 endef
2168 # call gb_LinkTarget_set_warnings_disabled,linktarget
2169 define gb_LinkTarget_set_warnings_disabled
2170 $(call gb_LinkTarget_get_target,$(1)) : WARNINGS_DISABLED := $(true)
2172 endef
2174 # call gb_LinkTarget_set_external_code,linktarget
2175 define gb_LinkTarget_set_external_code
2176 $(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_CODE := $(true)
2178 endef
2180 # Set suffix of C++ files, if different from 'cxx'
2182 # This is useful for external libraries.
2184 # call gb_LinkTarget_set_generated_cxx_suffix,linktarget,used-suffix
2185 define gb_LinkTarget_set_generated_cxx_suffix
2186 gb_LinkTarget_CXX_SUFFIX_$(call gb_LinkTarget__get_workdir_linktargetname,$(1)) := $(2)
2188 endef
2190 # C/C++ files will be build with Clang (if possible) instead of the default compiler.
2191 # call gb_LinkTarget_use_clang,linktarget,,linktargetmakefilename
2192 define gb_LinkTarget_use_clang
2193 $(call gb_LinkTarget_get_target,$(1)) : T_CC := $(LO_CLANG_CC)
2194 $(call gb_LinkTarget_get_target,$(1)) : T_CXX := $(LO_CLANG_CXX)
2195 $(call gb_LinkTarget_get_target,$(1)) : T_USE_CLANG := $(true)
2196 $(call gb_LinkTarget_get_target,$(1)) : T_USE_LD := $(or $(CLANG_USE_LD),$(USE_LD))
2197 $(call gb_LinkTarget_get_target,$(1)) : T_LTOFLAGS := $(if $(LO_CLANG_CXX),$(gb_CLANG_LTOFLAGS),$(gb_LTOFLAGS))
2198 endef
2200 # call gb_LinkTarget_use_vclmain,linktarget
2201 define gb_LinkTarget_use_vclmain
2202 $(call gb_LinkTarget_use_static_libraries,$(1),vclmain)
2204 endef # gb_LinkTarget_use_vclmain
2206 # Used by URE libraries that need to keep binary compatibility.
2207 # Reset some flags that make sense for our internal libraries but might
2208 # break public ABI.
2209 # (clang-cl's -Zc:dllexportInlines- would not only be a problem for the URE libraries themselves but
2210 # also for any libraries they depend on. While that does not appear to be a problem for -Zc:inline
2211 # for neither MSVC nor clang-cl, it should not really hurt to also switch that off not only for the
2212 # URE libraries themselves but also for their dependencies.)
2213 # call gb_LinkTarget_set_is_ure_library_or_dependency,linktarget,,linktargetmakefilename
2214 define gb_LinkTarget_set_is_ure_library_or_dependency
2215 $(call gb_LinkTarget_add_cxxflags,$(1),$(gb_CXXFLAGS_ZCINLINE_OFF))
2216 ifeq ($(HAVE_DLLEXPORTINLINES),TRUE)
2217 $(call gb_LinkTarget_add_cxxflags,$(1),-Zc:dllexportInlines)
2218 endif
2220 endef
2222 gb_LinkTarget__get_plugins_var = $(call gb_LinkTarget__get_workdir_linktargetname,$(1))<>PLUGINS
2223 gb_LinkTarget__get_plugins = $($(call gb_LinkTarget__get_plugins_var,$(1)))
2224 gb_Library__get_plugins = $($(call gb_LinkTarget__get_plugins_var,$(call gb_Library_get_linktarget,$(1))))
2226 define gb_LinkTarget__add_plugin
2227 $(call gb_LinkTarget__get_plugins_var,$(1)) += $(2)
2229 endef
2231 # Instead of setting nodep use gb_LinkTarget__set_plugin_for_nodep
2233 # call gb_LinkTarget__set_plugin_for,linktarget,loader,nodep
2234 define gb_LinkTarget__set_plugin_for
2235 ifeq (,$(filter $(1),$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library_get_linktarget,$(plugin)))))
2236 $$(eval $$(call gb_Output_error,Unknown plugin(s) '$(filter $(1),$(foreach plugin,$(gb_Library_KNOWNPLUGINS),$(call gb_Library_get_linktarget,$(plugin))))'. Plugins must be registered in Repository.mk or RepositoryExternal.mk))
2237 endif
2238 ifneq (,$(filter $(1),$(foreach lib,$(gb_MERGEDLIBS),$(call gb_Library_get_linktarget,$(lib)))))
2239 $$(eval $$(call gb_Output_error,Plugins can't be in mergelibs))
2240 endif
2241 ifeq ($(call gb_LinkTarget__is_build_tool,$(1)),$(true))
2242 $$(eval $$(call gb_Output_error,Plugin support for build tools not implemented))
2243 endif
2245 $(if $(filter $(2),$(gb_Library_KNOWNLOADERS)),,gb_Library_KNOWNLOADERS += $(2))
2246 $(if $(3),,$(call gb_LinkTarget_use_libraries,$(1),$(2),,$(4)))
2248 endef
2250 # call gb_LinkTarget__set_plugin_for_nodep,linktarget,loader
2251 gb_LinkTarget__set_plugin_for_nodep = $(call gb_LinkTarget__set_plugin_for,$(1),$(2),$(true))
2253 # call gb_LinkTarget_add_prejs,linktarget,js_file
2254 define gb_LinkTarget_add_prejs
2255 ifeq (EMSCRIPTEN,$(OS))
2256 $(call gb_LinkTarget_get_target,$(1)) : T_PREJS += $(2)
2257 $(call gb_LinkTarget_get_target,$(1)) : $(2)
2258 endif
2260 endef
2262 # vim: set noet sw=4: