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:
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)
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)))
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
:= \
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 \
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
)) \
108 define gb_ObjCObject__tool_command
109 $(call gb_Helper_abbreviate_dirs
,\
110 ICECC
=no CCACHE_DISABLE
=1 \
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
)) \
123 define gb_CxxObject__tool_command
124 $(call gb_Helper_abbreviate_dirs
,\
125 ICECC
=no CCACHE_DISABLE
=1 \
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
)) \
138 define gb_ObjCxxObject__tool_command
139 $(call gb_Helper_abbreviate_dirs
,\
140 ICECC
=no CCACHE_DISABLE
=1 \
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
)) \
153 define gb_CxxClrObject__tool_command
154 $(call gb_Helper_abbreviate_dirs
,\
155 ICECC
=no CCACHE_DISABLE
=1 \
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
)) \
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
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
184 # GenCxxObject C++ compile from | LinkTarget/headers PCH
186 # ObjCObject objective c compile | LinkTarget/headers
187 # ObjCxxObject objective c++ compile | LinkTarget/headers
188 # GenObjCObject objective c compile from | LinkTarget/headers
190 # GenObjCxxObject objective c++ compile from | LinkTarget/headers
192 # GenNasmObject nasm compile from | LinkTarget/headers
194 # CxxClrObject C++ CLR compile | LinkTarget/headers
195 # GenCxxClrObject C++ CLR compile from | LinkTarget/headers
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)
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
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
))
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
)
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
))
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
))
282 $(dir $(call gb_CObject_get_dep_target
,%)).
dir :
283 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
285 $(dir $(call gb_CObject_get_dep_target
,%))%/.
dir :
286 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
288 $(call gb_CObject_get_dep_target
,%) :
289 $(if
$(wildcard $@
),touch
$@
)
296 gb_CxxObject_get_source
= $(1)/$(2).
cxx
298 # Only enable PCH if the PCH_CXXFLAGS and the PCH_DEFS (from the linktarget)
299 # are the same as the T_CXXFLAGS and DEFS we want to use for this object. This
300 # should usually be the case. The DEFS/T_CXXFLAGS would have to be manually
301 # overridden for one object file for them to differ. PCH_CXXFLAGS/PCH_DEFS
302 # should never be overridden on an object -- they should be the same as for the
303 # whole linktarget. In general it should be cleaner to use a static library
304 # compiled with different flags and link that in rather than mixing different
305 # flags in one linktarget. If OBJECT_HAS_EXTRA_CXXFLAGS is set, the object
306 # has explicitly set additional CXXFLAGS, so in that case avoid using the PCH.
307 # T_PCH_EXTRA_CXXFLAGS is used when some object requires extra flags when using
308 # the PCH, but they are intended (gb_PrecompiledHeader_pch_with_obj).
309 define gb_CxxObject__set_pchflags
310 ifneq ($(gb_ENABLE_PCH
),)
311 ifneq ($(strip $$(PCH_NAME
)),)
312 ifeq ($(OBJECT_HAS_EXTRA_CXXFLAGS
),)
313 ifeq ($$(sort $$(PCH_CXXFLAGS
) $$(PCH_DEFS
)),$$(sort $$(T_CXXFLAGS
) $$(T_CXXFLAGS_APPEND
) $$(DEFS
)))
314 $$@
: PCHFLAGS
:= $$(call gb_PrecompiledHeader_get_enableflags
,$$(PCH_NAME
),$$(PCH_LINKTARGETMAKEFILENAME
),$$(PCH_HEADER
)) $$(T_PCH_EXTRA_CXXFLAGS
)
316 $$(warning No precompiled header available for
$$*.
cxx .
)
317 $$(info precompiled header flags
: $$(sort $$(PCH_CXXFLAGS
) $$(PCH_DEFS
)))
318 $$(info . object flags
: $$(sort $$(T_CXXFLAGS
) $$(T_CXXFLAGS_APPEND
) $$(DEFS
)))
319 $$(error Incorrect precompiled header setup or internal gbuild error.
)
327 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
328 $(call gb_CxxObject_get_target
,%) : $(call gb_CxxObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_TARGET
)
329 $(call gb_Output_announce
,$*.
cxx,$(true
),CXX
,3)
330 $(call gb_Trace_StartRange
,$*.
cxx,CXX
)
331 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CxxObject__tool_command
,$*,$<,$(COMPILER_PLUGINS
)))
332 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(if
$(COMPILER_PLUGIN_TOOL
),$(eval
$(gb_CxxObject__set_pchflags
))))
333 $(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
))))
334 $(call gb_Trace_EndRange
,$*.
cxx,CXX
)
336 $(call gb_CxxObject_get_target
,%) : $(call gb_CxxObject_get_source
,$(SRCDIR
),%)
337 $(call gb_Output_announce
,$*.
cxx,$(true
),$(if
$(COMPILER_TEST
),CPT
,CXX
),3)
338 $(call gb_Trace_StartRange
,$*.
cxx,$(if
$(COMPILER_TEST
),CPT
,CXX
))
339 $(eval
$(gb_CxxObject__set_pchflags
))
340 $(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
))
341 $(call gb_Trace_EndRange
,$*.
cxx,$(if
$(COMPILER_TEST
),CPT
,CXX
))
344 ifeq ($(gb_FULLDEPS
),$(true
))
345 $(dir $(call gb_CxxObject_get_dep_target
,%)).
dir :
346 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
348 $(dir $(call gb_CxxObject_get_dep_target
,%))%/.
dir :
349 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
351 $(call gb_CxxObject_get_dep_target
,%) :
352 $(if
$(wildcard $@
),touch
$@
)
359 gb_GenCObject_get_source
= $(WORKDIR
)/$(1).c
361 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
362 $(call gb_GenCObject_get_target
,%) : $(gb_FORCE_COMPILE_TARGET
)
363 $(call gb_Output_announce
,$*.c
,$(true
),C
,3)
364 $(call gb_Trace_StartRange
,$*.c
,C
)
365 test -f
$(call gb_GenCObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenCObject_get_source,$*)" && false
)
366 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CObject__tool_command
,$*,$(call gb_GenCObject_get_source
,$*),$(COMPILER_PLUGINS
)))
367 $(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
))))
368 $(call gb_Trace_EndRange
,$*.c
,C
)
370 $(call gb_GenCObject_get_target
,%) :
371 $(call gb_Output_announce
,$*.c
,$(true
),C
,3)
372 $(call gb_Trace_StartRange
,$*.c
,C
)
373 test -f
$(call gb_GenCObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenCObject_get_source,$*)" && false
)
374 $(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
))
375 $(call gb_Trace_EndRange
,$*.c
,C
)
378 ifeq ($(gb_FULLDEPS
),$(true
))
379 $(dir $(call gb_GenCObject_get_dep_target
,%)).
dir :
380 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
382 $(dir $(call gb_GenCObject_get_dep_target
,%))%/.
dir :
383 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
385 $(call gb_GenCObject_get_dep_target
,%) :
386 $(if
$(wildcard $@
),touch
$@
)
393 gb_GenCxxObject_get_source
= $(WORKDIR
)/$(1).
$(gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(2)))
395 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
396 $(call gb_GenCxxObject_get_target
,%) : $(gb_FORCE_COMPILE_TARGET
)
397 $(call gb_Output_announce
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),$(true
),CXX
,3)
398 $(call gb_Trace_StartRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),CXX
)
399 test -f
$(GEN_CXX_SOURCE
) ||
(echo
"Missing generated source file $(GEN_CXX_SOURCE)" && false
)
400 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CxxObject__tool_command
,$*,$(GEN_CXX_SOURCE
),$(COMPILER_PLUGINS
)))
401 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(if
$(COMPILER_PLUGIN_TOOL
),$(eval
$(gb_CxxObject__set_pchflags
))))
402 $(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
))))
403 $(call gb_Trace_EndRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),CXX
)
405 $(call gb_GenCxxObject_get_target
,%) :
406 $(call gb_Output_announce
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),$(true
),CXX
,3)
407 $(call gb_Trace_StartRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),CXX
)
408 test -f
$(GEN_CXX_SOURCE
) ||
(echo
"Missing generated source file $(GEN_CXX_SOURCE)" && false
)
409 $(eval
$(gb_CxxObject__set_pchflags
))
410 $(call gb_CObject__command_pattern
,$@
,$(T_CXXFLAGS
) $(T_CXXFLAGS_APPEND
),$(GEN_CXX_SOURCE
),$(call gb_GenCxxObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),$(T_CXX
))
411 $(call gb_Trace_EndRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),CXX
)
414 ifeq ($(gb_FULLDEPS
),$(true
))
415 $(dir $(call gb_GenCxxObject_get_dep_target
,%)).
dir :
416 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
418 $(dir $(call gb_GenCxxObject_get_dep_target
,%))%/.
dir :
419 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
421 $(call gb_GenCxxObject_get_dep_target
,%) :
422 $(if
$(wildcard $@
),touch
$@
)
427 # GenCxxClrObject class
429 gb_GenCxxClrObject_get_source
= $(WORKDIR
)/$(1).
$(gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(2)))
431 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
432 $(call gb_GenCxxClrObject_get_target
,%) : $(gb_FORCE_COMPILE_TARGET
)
433 $(call gb_Output_announce
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),$(true
),CLR
,3)
434 $(call gb_Trace_StartRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),CLR
)
435 test -f
$(GEN_CXXCLR_SOURCE
) ||
(echo
"Missing generated source file $(GEN_CXXCLR_SOURCE)" && false
)
436 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CxxClrObject__tool_command
,$*,$(GEN_CXXCLR_SOURCE
),$(COMPILER_PLUGINS
)))
437 $(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
),)))
438 $(call gb_Trace_EndRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),CLR
)
440 $(call gb_GenCxxClrObject_get_target
,%) :
441 $(call gb_Output_announce
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),$(true
),CLR
,3)
442 $(call gb_Trace_StartRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),CLR
)
443 test -f
$(GEN_CXXCLR_SOURCE
) ||
(echo
"Missing generated source file $(GEN_CXXCLR_SOURCE)" && false
)
444 $(call gb_CObject__command_pattern
,$@
,$(T_CXXCLRFLAGS
) $(T_CXXCLRFLAGS_APPEND
),$(GEN_CXXCLR_SOURCE
),$(call gb_GenCxxClrObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
445 $(call gb_Trace_EndRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),CLR
)
448 ifeq ($(gb_FULLDEPS
),$(true
))
449 $(dir $(call gb_GenCxxClrObject_get_dep_target
,%)).
dir :
450 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
452 $(dir $(call gb_GenCxxClrObject_get_dep_target
,%))%/.
dir :
453 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
455 $(call gb_GenCxxClrObject_get_dep_target
,%) :
456 $(if
$(wildcard $@
),touch
$@
)
463 # XXX: This is more complicated than necessary, but we cannot just use
464 # the generated C++ file as the main target, because we need to let the
465 # header depend on that to ensure the header is present before anything
468 gb_YaccTarget_get_source
= $(1)/$(2).y
470 .PHONY
: $(call gb_YaccTarget_get_clean_target
,%)
471 $(call gb_YaccTarget_get_clean_target
,%) :
472 $(call gb_Output_announce
,$*,$(false
),YAC
,3)
473 $(call gb_Helper_abbreviate_dirs
,\
474 rm -f
$(call gb_YaccTarget_get_grammar_target
,$*) $(call gb_YaccTarget_get_header_target
,$*) $(call gb_YaccTarget_get_target
,$*))
476 $(call gb_YaccTarget_get_target
,%) : $(call gb_YaccTarget_get_source
,$(SRCDIR
),%)
477 $(call gb_YaccTarget__command
,$<,$*,$@
,$(call gb_YaccTarget_get_header_target
,$*),$(call gb_YaccTarget_get_grammar_target
,$*))
479 # call gb_YaccTarget_YaccTarget,yacctarget
480 define gb_YaccTarget_YaccTarget
481 $(call gb_YaccTarget_get_grammar_target
,$(1)) : $(call gb_YaccTarget_get_target
,$(1))
483 $(call gb_YaccTarget_get_header_target
,$(1)) : $(call gb_YaccTarget_get_target
,$(1))
490 gb_LexTarget_get_source
= $(1)/$(2).l
492 .PHONY
: $(call gb_LexTarget_get_clean_target
,%)
493 $(call gb_LexTarget_get_clean_target
,%) :
494 $(call gb_Output_announce
,$*,$(false
),LEX
,3)
495 $(call gb_Helper_abbreviate_dirs
,\
496 rm -f
$(call gb_LexTarget_get_scanner_target
,$*) $(call gb_LexTarget_get_target
,$*))
498 $(call gb_LexTarget_get_target
,%) : $(call gb_LexTarget_get_source
,$(SRCDIR
),%)
499 $(call gb_Output_announce
,$*,$(true
),LEX
,3)
500 $(call gb_Trace_StartRange
,$*,LEX
)
501 $(call gb_LexTarget__command
,$<,$*,$@
,$(call gb_LexTarget_get_scanner_target
,$*))
502 $(call gb_Trace_EndRange
,$*,LEX
)
504 # gb_LexTarget_LexTarget(scanner-file)
505 define gb_LexTarget_LexTarget
506 $(call gb_LexTarget_get_scanner_target
,$(1)) : $(call gb_LexTarget_get_target
,$(1))
511 # gb_LexTarget__command(scanner-file, stem-for-message, done-pseudo-target, source-target)
512 define gb_LexTarget__command
513 $(call gb_Helper_abbreviate_dirs
,\
514 mkdir
-p
$(dir $(3)) && \
515 $(FLEX
) $(T_LEXFLAGS
) -o
$(4) $(1) && touch
$(3) )
522 gb_ObjCxxObject_get_source
= $(1)/$(2).mm
524 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
525 $(call gb_ObjCxxObject_get_target
,%) : $(call gb_ObjCxxObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_TARGET
)
526 $(call gb_Output_announce
,$*.mm
,$(true
),OCX
,3)
527 $(call gb_Trace_StartRange
,$*.mm
,OCX
)
528 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_ObjCxxObject__tool_command
,$*,$<,$(COMPILER_PLUGINS
)))
529 $(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
),)))
530 $(call gb_Trace_EndRange
,$*.mm
,OCX
)
532 $(call gb_ObjCxxObject_get_target
,%) : $(call gb_ObjCxxObject_get_source
,$(SRCDIR
),%)
533 $(call gb_Output_announce
,$*.mm
,$(true
),$(if
$(COMPILER_TEST
),O?X
,OCX
),3)
534 $(call gb_Trace_StartRange
,$*.mm
,$(if
$(COMPILER_TEST
),O?X
,OCX
))
535 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCXXFLAGS
) $(T_OBJCXXFLAGS_APPEND
),$<,$(call gb_ObjCxxObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
536 $(call gb_Trace_EndRange
,$*.mm
,$(if
$(COMPILER_TEST
),O?X
,OCX
))
539 ifeq ($(gb_FULLDEPS
),$(true
))
540 $(dir $(call gb_ObjCxxObject_get_dep_target
,%)).
dir :
541 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
543 $(dir $(call gb_ObjCxxObject_get_dep_target
,%))%/.
dir :
544 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
546 $(call gb_ObjCxxObject_get_dep_target
,%) :
547 $(if
$(wildcard $@
),touch
$@
)
555 gb_ObjCObject_get_source
= $(1)/$(2).m
557 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
558 $(call gb_ObjCObject_get_target
,%) : $(call gb_ObjCObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_TARGET
)
559 $(call gb_Output_announce
,$*.m
,$(true
),OCC
,3)
560 $(call gb_Trace_StartRange
,$*.m
,OCC
)
561 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_ObjCObject__tool_command
,$*,$<,$(COMPILER_PLUGINS
)))
562 $(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
),)))
563 $(call gb_Trace_EndRange
,$*.m
,OCC
)
565 $(call gb_ObjCObject_get_target
,%) : $(call gb_ObjCObject_get_source
,$(SRCDIR
),%)
566 $(call gb_Output_announce
,$*.m
,$(true
),$(if
$(COMPILER_TEST
),O?C
,OCC
),3)
567 $(call gb_Trace_StartRange
,$*.m
,$(if
$(COMPILER_TEST
),O?C
,OCC
))
568 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCFLAGS
) $(T_OBJCFLAGS_APPEND
),$<,$(call gb_ObjCObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
569 $(call gb_Trace_EndRange
,$*.m
,$(if
$(COMPILER_TEST
),O?C
,OCC
))
572 ifeq ($(gb_FULLDEPS
),$(true
))
573 $(dir $(call gb_ObjCObject_get_dep_target
,%)).
dir :
574 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
576 $(dir $(call gb_ObjCObject_get_dep_target
,%))%/.
dir :
577 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
579 $(call gb_ObjCObject_get_dep_target
,%) :
580 $(if
$(wildcard $@
),touch
$@
)
585 # GenObjCObject class
587 gb_GenObjCObject_get_source
= $(WORKDIR
)/$(1).m
589 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
590 $(call gb_GenObjCObject_get_target
,%) : $(gb_FORCE_COMPILE_TARGET
)
591 $(call gb_Output_announce
,$*.m
,$(true
),OCC
,3)
592 $(call gb_Trace_StartRange
,$*.m
,OCC
)
593 test -f
$(call gb_GenObjCObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenObjCObject_get_source,$*)" && false
)
594 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_ObjCObject__tool_command
,$*,$(call gb_GenObjCObject_get_source
,$*),$(COMPILER_PLUGINS
)))
595 $(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
),)))
596 $(call gb_Trace_EndRange
,$*.m
,OCC
)
598 $(call gb_GenObjCObject_get_target
,%) :
599 $(call gb_Output_announce
,$*.m
,$(true
),OCC
,3)
600 $(call gb_Trace_StartRange
,$*.m
,OCC
)
601 test -f
$(call gb_GenObjCObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenObjCObject_get_source,$*)" && false
)
602 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCFLAGS
) $(T_OBJCFLAGS_APPEND
),$(call gb_GenObjCObject_get_source
,$*),$(call gb_GenObjCObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
603 $(call gb_Trace_EndRange
,$*.m
,OCC
)
606 ifeq ($(gb_FULLDEPS
),$(true
))
607 $(dir $(call gb_GenObjCObject_get_dep_target
,%)).
dir :
608 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
610 $(dir $(call gb_GenObjCObject_get_dep_target
,%))%/.
dir :
611 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
613 $(call gb_GenObjCObject_get_dep_target
,%) :
614 $(if
$(wildcard $@
),touch
$@
)
619 # GenObjCxxObject class
621 gb_GenObjCxxObject_get_source
= $(WORKDIR
)/$(1).mm
623 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
624 $(call gb_GenObjCxxObject_get_target
,%) : $(gb_FORCE_COMPILE_TARGET
)
625 $(call gb_Output_announce
,$*.mm
,$(true
),OCX
,3)
626 $(call gb_Trace_StartRange
,$*.mm
,OCX
)
627 test -f
$(call gb_GenObjCxxObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenObjCxxObject_get_source,$*)" && false
)
628 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_ObjCxxObject__tool_command
,$*,$(call gb_GenObjCxxObject_get_source
,$*),$(COMPILER_PLUGINS
)))
629 $(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
),)))
630 $(call gb_Trace_EndRange
,$*.mm
,OCX
)
632 $(call gb_GenObjCxxObject_get_target
,%) :
633 $(call gb_Output_announce
,$*.mm
,$(true
),OCX
,3)
634 $(call gb_Trace_StartRange
,$*.mm
,OCX
)
635 test -f
$(call gb_GenObjCxxObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenObjCxxObject_get_source,$*)" && false
)
636 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCXXFLAGS
) $(T_OBJCXXFLAGS_APPEND
),$(call gb_GenObjCxxObject_get_source
,$*),$(call gb_GenObjCxxObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
637 $(call gb_Trace_EndRange
,$*.mm
,OCX
)
640 ifeq ($(gb_FULLDEPS
),$(true
))
641 $(dir $(call gb_GenObjCxxObject_get_dep_target
,%)).
dir :
642 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
644 $(dir $(call gb_GenObjCxxObject_get_dep_target
,%))%/.
dir :
645 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
647 $(call gb_GenObjCxxObject_get_dep_target
,%) :
648 $(if
$(wildcard $@
),touch
$@
)
652 # GenNasmObject class
654 gb_GenNasmObject_get_source
= $(WORKDIR
)/$(1)
656 $(call gb_GenNasmObject_get_target
,%) :
657 $(call gb_Output_announce
,$*,$(true
),ASM
,3)
658 $(call gb_Trace_StartRange
,$*,ASM
)
659 test -f
$(call gb_GenNasmObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenNasmObject_get_source,$*)" && false
)
660 mkdir
-p
$(dir $@
) $(dir $(call gb_GenNasmObject_get_dep_target
,$*)) && cd
$(SRCDIR
) && \
661 $(NASM
) $(T_NASMFLAGS
) $(T_NASMFLAGS_APPEND
) -I
$(dir $(call gb_GenNasmObject_get_source
,$*)) \
662 $(call gb_GenNasmObject_get_source
,$*) -o
$@
&& \
663 echo
"$@ : $(call gb_GenNasmObject_get_source,$*)" > $(call gb_GenNasmObject_get_dep_target
,$*)
664 $(call gb_Trace_EndRange
,$*,ASM
)
666 ifeq ($(gb_FULLDEPS
),$(true
))
667 $(dir $(call gb_GenNasmObject_get_dep_target
,%)).
dir :
668 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
670 $(dir $(call gb_GenNasmObject_get_dep_target
,%))%/.
dir :
671 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
673 $(call gb_GenNasmObject_get_dep_target
,%) :
674 $(if
$(wildcard $@
),touch
$@
)
682 gb_CxxClrObject_get_source
= $(1)/$(2).
cxx
684 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
685 $(call gb_CxxClrObject_get_target
,%) : $(call gb_CxxClrObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_TARGET
)
686 $(call gb_Output_announce
,$*.
cxx,$(true
),CLR
,3)
687 $(call gb_Trace_StartRange
,$*.
cxx,CLR
)
688 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CxxClrObject__tool_command
,$*,$<,$(COMPILER_PLUGINS
)))
689 $(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
),)))
690 $(call gb_Trace_EndRange
,$*.
cxx,CLR
)
692 $(call gb_CxxClrObject_get_target
,%) : $(call gb_CxxClrObject_get_source
,$(SRCDIR
),%)
693 $(call gb_Output_announce
,$*.
cxx,$(true
),$(if
$(COMPILER_TEST
),C?R
,CLR
),3)
694 $(call gb_Trace_StartRange
,$*.
cxx,$(if
$(COMPILER_TEST
),C?R
,CLR
))
695 $(call gb_CObject__command_pattern
,$@
,$(T_CXXCLRFLAGS
) $(T_CXXCLRFLAGS_APPEND
),$<,$(call gb_CxxClrObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
696 $(call gb_Trace_EndRange
,$*.
cxx,$(if
$(COMPILER_TEST
),C?R
,CLR
))
699 ifeq ($(gb_FULLDEPS
),$(true
))
700 $(dir $(call gb_CxxClrObject_get_dep_target
,%)).
dir :
701 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
703 $(dir $(call gb_CxxClrObject_get_dep_target
,%))%/.
dir :
704 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
706 $(call gb_CxxClrObject_get_dep_target
,%) :
707 $(if
$(wildcard $@
),touch
$@
)
714 $(call gb_AsmObject_get_target
,%) : $(call gb_AsmObject_get_source
,$(SRCDIR
),%)
715 $(call gb_AsmObject__command
,$@
,$*,$<,$(call gb_AsmObject_get_dep_target
,$*))
717 ifeq ($(gb_FULLDEPS
),$(true
))
718 $(dir $(call gb_AsmObject_get_dep_target
,%)).
dir :
719 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
721 $(dir $(call gb_AsmObject_get_dep_target
,%))%/.
dir :
722 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
724 $(call gb_AsmObject_get_dep_target
,%) :
725 $(if
$(wildcard $@
),touch
$@
)
732 gb_LinkTarget_DEFAULTDEFS
:= $(gb_GLOBALDEFS
)
734 .PHONY
: $(WORKDIR
)/Clean
/LinkTarget
/%
735 $(WORKDIR
)/Clean
/LinkTarget
/% :
736 $(call gb_Output_announce
,$(LINKTARGETMAKEFILENAME
),$(false
),LNK
,4)
737 RESPONSEFILE
=$(call gb_var2file
,$(shell $(gb_MKTEMP
)),\
738 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
739 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dep_target
,$(object
))) \
740 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dwo_target
,$(object
))) \
741 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
742 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dep_target
,$(object
))) \
743 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dwo_target
,$(object
))) \
744 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_target
,$(object
))) \
745 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dep_target
,$(object
))) \
746 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dwo_target
,$(object
))) \
747 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_target
,$(object
))) \
748 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dep_target
,$(object
))) \
749 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dwo_target
,$(object
))) \
750 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_target
,$(object
))) \
751 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_dep_target
,$(object
))) \
752 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_dwo_target
,$(object
))) \
753 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
754 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dep_target
,$(object
))) \
755 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dwo_target
,$(object
))) \
756 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
757 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dep_target
,$(object
))) \
758 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dwo_target
,$(object
))) \
759 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
760 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dep_target
,$(object
))) \
761 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dwo_target
,$(object
))) \
762 $(foreach object
,$(GENOBJCOBJECTS
),$(call gb_GenObjCObject_get_target
,$(object
))) \
763 $(foreach object
,$(GENOBJCOBJECTS
),$(call gb_GenObjCObject_get_dep_target
,$(object
))) \
764 $(foreach object
,$(GENOBJCOBJECTS
),$(call gb_GenObjCObject_get_dwo_target
,$(object
))) \
765 $(foreach object
,$(GENOBJCXXOBJECTS
),$(call gb_GenObjCxxObject_get_target
,$(object
))) \
766 $(foreach object
,$(GENOBJCXXOBJECTS
),$(call gb_GenObjCxxObject_get_dep_target
,$(object
))) \
767 $(foreach object
,$(GENOBJCXXOBJECTS
),$(call gb_GenObjCxxObject_get_dwo_target
,$(object
))) \
768 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_target
,$(object
))) \
769 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_dep_target
,$(object
))) \
770 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_dwo_target
,$(object
))) \
771 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_target
,$(object
))) \
772 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_dep_target
,$(object
))) \
773 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_dwo_target
,$(object
))) \
774 $(call gb_LinkTarget_get_target
,$(LINKTARGET
)) \
775 $(call gb_LinkTarget_get_dep_target
,$(LINKTARGET
)) \
776 $(if
$(gb_PARTIAL_BUILD
),, \
777 $(call gb_LinkTarget_get_dep_libraries_target
,$(LINKTARGET
)) \
778 $(call gb_LinkTarget_get_dep_externals_target
,$(LINKTARGET
)) \
779 $(call gb_LinkTarget_get_dep_statics_target
,$(LINKTARGET
)) \
781 $(call gb_LinkTarget_get_headers_target
,$(LINKTARGET
)) \
782 $(call gb_LinkTarget_get_objects_list
,$(LINKTARGET
)) \
783 $(call gb_LinkTarget_get_pch_timestamp
,$(LINKTARGETMAKEFILENAME
)) \
784 $(call gb_LinkTarget_get_pch_reuse_timestamp
,$(LINKTARGETMAKEFILENAME
)) \
787 cat
$${RESPONSEFILE} /dev
/null |
$(if
$(filter WNT
,$(OS
)),env
-i PATH
="$$PATH") xargs
-n
200 rm -fr
&& \
788 rm -f
$${RESPONSEFILE}
791 # cat the deps of all objects in one file, then we need only open that one file
792 # call gb_LinkTarget__command_dep,dep_target,linktargetname
793 define gb_LinkTarget__command_dep
794 $(call gb_Output_announce
,LNK
:$(2).d
,$(true
),DEP
,1)
795 $(call gb_Trace_StartRange
,LNK
:$(2),DEP
)
796 $(call gb_Helper_abbreviate_dirs
,\
797 mkdir
-p
$(dir $(1)) && \
798 RESPONSEFILE
=$(call gb_var2file
,$(shell $(gb_MKTEMP
)),\
799 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dep_target
,$(object
))) \
800 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dep_target
,$(object
))) \
801 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dep_target
,$(object
)))\
802 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dep_target
,$(object
)))\
803 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_dep_target
,$(object
)))\
804 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dep_target
,$(object
)))\
805 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dep_target
,$(object
))) \
806 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dep_target
,$(object
))) \
807 $(foreach object
,$(GENOBJCOBJECTS
),$(call gb_GenObjCObject_get_dep_target
,$(object
))) \
808 $(foreach object
,$(GENOBJCXXOBJECTS
),$(call gb_GenObjCxxObject_get_dep_target
,$(object
))) \
809 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_dep_target
,$(object
))) \
810 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_dep_target
,$(object
))) \
812 SYSTEM_BOOST
="$(SYSTEM_BOOST)" $(call gb_Executable_get_command
,concat-deps
) $${RESPONSEFILE} > $(1)) && \
813 rm -f
$${RESPONSEFILE}
814 $(call gb_Trace_EndRange
,LNK
:$(2),DEP
)
818 # call gb_LinkTarget__command_objectlist,linktarget
819 define gb_LinkTarget__command_objectlist
821 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
822 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
823 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_target
,$(object
))) \
824 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_target
,$(object
))) \
825 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_target
,$(object
))) \
826 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
827 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
828 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
829 $(foreach object
,$(GENOBJCOBJECTS
),$(call gb_GenObjCObject_get_target
,$(object
))) \
830 $(foreach object
,$(GENOBJCXXOBJECTS
),$(call gb_GenObjCxxObject_get_target
,$(object
))) \
831 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_target
,$(object
))) \
832 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_target
,$(object
))) \
834 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),$(shell cat
$(extraobjectlist
))))
838 $(WORKDIR
)/LinkTarget
/%/.
dir :
839 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
841 # Target for the .exports of the shared library, to speed up incremental build.
842 # This deliberately does nothing if the file exists; the file is actually
843 # written in gb_LinkTarget__command_dynamiclink.
844 # Put this pattern rule here so it overrides the one below.
845 # (this is rather ugly: because of % the functions cannot be used)
846 $(WORKDIR
)/LinkTarget
/Library
/%.exports
:
847 $(if
$(wildcard $@
),,mkdir
-p
$(dir $@
) && touch
$@
)
849 # This recipe actually also builds the dep-target as a side-effect, which
850 # is an optimization to reduce incremental build time.
851 # (with exception for concat-dep executable itself which does not exist yet...)
852 $(WORKDIR
)/LinkTarget
/% : $(gb_Helper_MISCDUMMY
)
853 $(call gb_LinkTarget__command_impl
,$@
,$*)
855 # call gb_LinkTarget__make_installed_rule,linktarget
856 define gb_LinkTarget__make_installed_rule
857 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_LinkTarget_get_headers_target
,$(1))
858 $$(call gb_LinkTarget__command_impl
,$(call gb_LinkTarget_get_target
,$(1)),$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)))
862 define gb_LinkTarget__add_linked_libs
863 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
+= $(2)
867 # it's not possible to use a pattern rule for files in INSTDIR because
868 # it would inevitably conflict with the pattern rule for Package
869 # (especially since external libraries are delivered via Package)
870 # call gb_LinkTarget__command_impl,linktargettarget,linktargetname
871 define gb_LinkTarget__command_impl
873 $(if
$(ENABLE_CUSTOMTARGET_COMPONENTS
),$(if
$(gb_PARTIAL_BUILD
),,
874 $(call gb_LinkTarget__command_dep_libraries
,$(call gb_LinkTarget_get_dep_libraries_target
,$(2)).tmp
,$(2))
875 mv
$(call gb_LinkTarget_get_dep_libraries_target
,$(2)).tmp
$(call gb_LinkTarget_get_dep_libraries_target
,$(2))
876 $(call gb_LinkTarget__command_dep_externals
,$(call gb_LinkTarget_get_dep_externals_target
,$(2)).tmp
,$(2))
877 mv
$(call gb_LinkTarget_get_dep_externals_target
,$(2)).tmp
$(call gb_LinkTarget_get_dep_externals_target
,$(2))
878 $(call gb_LinkTarget__command_dep_statics
,$(call gb_LinkTarget_get_dep_statics_target
,$(2)).tmp
,$(2))
879 mv
$(call gb_LinkTarget_get_dep_statics_target
,$(2)).tmp
$(call gb_LinkTarget_get_dep_statics_target
,$(2))))
880 $(if
$(findstring concat-deps
,$(2)),,
881 $(call gb_LinkTarget__command_dep
,$(call gb_LinkTarget_get_dep_target
,$(2)).tmp
,$(2))
882 mv
$(call gb_LinkTarget_get_dep_target
,$(2)).tmp
$(call gb_LinkTarget_get_dep_target
,$(2))))
883 $(if
$(filter $(2),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library__get_workdir_linktargetname
,$(lib
)))),
884 $(if
$(filter $(true
),$(call gb_LinkTarget__is_build_lib
,$(2))),
885 $(call gb_LinkTarget__command
,$(1),$(2)),
886 mkdir
-p
$(dir $(1)) && echo invalid
- merged lib
> $(1)
887 $(if
$(SOVERSIONSCRIPT
),&& echo invalid
- merged lib
> $(WORKDIR
)/LinkTarget
/$(2))),
888 $(if
$(filter-out CompilerTest
,$(TARGETTYPE
)),
889 $(call gb_LinkTarget__command
,$(1),$(2))))
890 $(call gb_LinkTarget__command_objectlist
,$(WORKDIR
)/LinkTarget
/$(2).objectlist
)
893 ifeq ($(gb_FULLDEPS
),$(true
))
894 $(call gb_LinkTarget_get_dep_target
,%) : $(call gb_Executable_get_runtime_dependencies
,concat-deps
)
895 $(call gb_LinkTarget__command_dep
,$@
,$*)
897 $(dir $(call gb_LinkTarget_get_dep_target
,%))/.
dir :
898 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
900 ifeq ($(ENABLE_CUSTOMTARGET_COMPONENTS
),TRUE
)
901 ifeq (,$(gb_PARTIAL_BUILD
))
903 define gb_LinkTarget__static_dep_x_template
905 define gb_LinkTarget__command_dep_
$(1)
906 $$(call gb_Output_announce
,LNK
:$$(2).d.
$(1),$$(true
),DEP
,1)
907 $$(shell mkdir
-p
$$(dir $$(1)))
908 $$(file
>$$(1).tmp
,$$(call gb_LinkTarget__get_all_
$(1),$$(2)))
909 $$(call gb_Helper_replace_if_different_and_touch
,$$(1).tmp
,$$(1))
913 $$(call gb_LinkTarget_get_dep_
$(1)_target
,%) : ;
914 $$(call gb_LinkTarget__command_dep_
$(1),$$@
,$$*)
916 endef # gb_LinkTarget__static_dep_x_template
918 $(eval
$(call gb_LinkTarget__static_dep_x_template
,libraries
))
919 $(eval
$(call gb_LinkTarget__static_dep_x_template
,externals
))
920 $(eval
$(call gb_LinkTarget__static_dep_x_template
,statics
))
922 endif # !gb_PARTIAL_BUILD
923 endif # ENABLE_CUSTOMTARGET_COMPONENTS
926 # Ok, this is some dark voodoo: When declaring a linktarget with
927 # gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the
928 # target. When the rule for the headertarget is executed and SELF does not
929 # match the target name, we are depending on a linktarget that was never
930 # declared. In a full build exclusively in gbuild that should never happen.
931 define gb_LinkTarget__get_headers_check
933 $$(eval
$$(call gb_Output_error
,used LinkTarget
$$* not defined
))
935 $$@
: COMMAND
:= $$(call gb_Helper_abbreviate_dirs
, touch
$$@
)
939 $(WORKDIR
)/Headers
/%/.
dir :
940 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
942 # sadly because of the subdirectories can't have pattern deps on .dir here
943 $(WORKDIR
)/Headers
/% :
944 $(eval
$(gb_LinkTarget__get_headers_check
))
947 # Explanation of some of the targets:
948 # - gb_LinkTarget_get_headers_target is the target that guarantees all headers
949 # from the linked against libraries and the linktargets own generated headers
951 # - gb_LinkTarget_get_target links the objects into a file in WORKDIR.
952 # gb_LinkTarget_get_target depends on gb_LinkTarget_get_headers_target.
953 # gb_LinkTarget_get_target depends additionally on the objects, which in turn
954 # depend build-order only on the gb_LinkTarget_get_headers_target. The build
955 # order-only dependency ensures all headers to be there for compiling and
956 # dependency generation without causing all objects to be rebuild when one
957 # header changes. Only the ones with an explicit dependency in their generated
958 # dependency file will be rebuild.
960 # gb_LinkTarget_get_target is the target that links the objects into a file in
962 # Explanation of some of the variables:
963 # - AUXTARGETS are the additionally generated files that need to be cleaned out
965 # - PCH_CXXFLAGS and PCH_DEFS are the flags that the precompiled headers will
966 # be compiled with. They should never be overridden in a single object
968 # - TARGETTYPE is the type of linktarget as some platforms need very different
969 # command to link different targettypes.
970 # - LIBRARY_X64 is only relevant for building a x64 library on windows.
971 # - PE_X86 is only relevant for building a x86 binaries on Windows.
973 # Since most variables are set on the linktarget and not on the object, the
974 # object learns about these setting via GNU makes scoping of target variables.
975 # Therefore it is important that objects are only directly depended on by the
976 # linktarget. This for example means that you cannot build a single object
977 # alone, because then you would directly depend on the object.
979 # A note about flags: because the overriding the global variables with a target
980 # local variable of the same name is considered obscure, the target local
981 # variables have a T_ prefix.
983 # call gb_LinkTarget_LinkTarget,linktarget,linktargetmakefilename,layer
984 define gb_LinkTarget_LinkTarget
985 $(call gb_LinkTarget_get_clean_target
,$(1)) : LINKTARGET
:= $(1)
986 $(call gb_LinkTarget_get_clean_target
,$(1)) : LINKTARGETMAKEFILENAME
:= $(2)
987 $(call gb_LinkTarget_get_clean_target
,$(1)) : AUXTARGETS
:=
988 $(call gb_LinkTarget_get_headers_target
,$(1)) : SELF
:= $(call gb_LinkTarget__get_workdir_linktargetname
,$(1))
989 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
990 |
$(dir $(call gb_LinkTarget_get_headers_target
,$(1))).
dir \
991 $(dir $(call gb_LinkTarget_get_target
,$(1))).
dir \
992 $(dir $(WORKDIR
)/LinkTarget
/$(call gb_LinkTarget__get_workdir_linktargetname
,$(1))).
dir
993 $(call gb_LinkTarget_get_target
,$(1)) : ILIBTARGET
:=
994 $(call gb_LinkTarget_get_clean_target
,$(1)) \
995 $(call gb_LinkTarget_get_target
,$(1)) : COBJECTS
:=
996 $(call gb_LinkTarget_get_clean_target
,$(1)) \
997 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
:=
998 $(call gb_LinkTarget_get_clean_target
,$(1)) \
999 $(call gb_LinkTarget_get_target
,$(1)) : YACCOBJECT
:=
1000 $(call gb_LinkTarget_get_target
,$(1)) : T_YACCFLAGS
:= $$(gb_LinkTarget_YYACFLAGS
) $(YACCFLAGS
)
1001 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1002 $(call gb_LinkTarget_get_target
,$(1)) : LEXOBJECT
:=
1003 $(call gb_LinkTarget_get_target
,$(1)) : T_LEXFLAGS
:= $$(gb_LinkTarget_LEXFLAGS
) $(LEXFLAGS
)
1004 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1005 $(call gb_LinkTarget_get_target
,$(1)) : OBJCOBJECTS
:=
1006 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1007 $(call gb_LinkTarget_get_target
,$(1)) : OBJCXXOBJECTS
:=
1008 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1009 $(call gb_LinkTarget_get_target
,$(1)) : CXXCLROBJECTS
:=
1010 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1011 $(call gb_LinkTarget_get_target
,$(1)) : ASMOBJECTS
:=
1012 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1013 $(call gb_LinkTarget_get_target
,$(1)) : GENCOBJECTS
:=
1014 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1015 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXOBJECTS
:=
1016 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1017 $(call gb_LinkTarget_get_target
,$(1)) : GENOBJCOBJECTS
:=
1018 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1019 $(call gb_LinkTarget_get_target
,$(1)) : GENNASMOBJECTS
:=
1020 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1021 $(call gb_LinkTarget_get_target
,$(1)) : GENOBJCXXOBJECTS
:=
1022 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1023 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXCLROBJECTS
:=
1024 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS
:= $$(gb_LinkTarget_CFLAGS
)
1025 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS_APPEND
:=
1026 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS
:= $$(gb_LinkTarget_CXXFLAGS
)
1027 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS_APPEND
:=
1028 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
:= $$(gb_LinkTarget_CXXFLAGS
)
1029 $(call gb_LinkTarget_get_target
,$(1)) : OBJECT_HAS_EXTRA_CXXFLAGS
:=
1030 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS
:= $$(gb_LinkTarget_OBJCXXFLAGS
)
1031 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS_APPEND
:=
1032 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS
:= $$(gb_LinkTarget_OBJCFLAGS
)
1033 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS_APPEND
:=
1034 $(call gb_LinkTarget_get_target
,$(1)) : T_NASMFLAGS
:= $$(NAFLAGS
)
1035 $(call gb_LinkTarget_get_target
,$(1)) : T_NASMFLAGS_APPEND
:=
1036 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXCLRFLAGS
:= $$(gb_LinkTarget_CXXCLRFLAGS
)
1037 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXCLRFLAGS_APPEND
:=
1038 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
:= $$(gb_LinkTarget_DEFAULTDEFS
) $(CPPFLAGS
)
1039 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
:= $$(gb_LinkTarget_DEFAULTDEFS
) $(CPPFLAGS
)
1040 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
:= -I
$$(SRCDIR
)/include $$(gb_LinkTarget_INCLUDE
)
1041 $(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))
1042 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
:=
1043 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_STATIC_LIBS
:=
1044 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
:=
1045 $(call gb_LinkTarget_get_target
,$(1)) : T_STDLIBS_CXX
:= $(gb_STDLIBS_CXX
)
1046 $(call gb_LinkTarget_get_target
,$(1)) : TARGETTYPE
:=
1047 $(call gb_LinkTarget_get_target
,$(1)) : LIBRARY_X64
:=
1048 $(call gb_LinkTarget_get_target
,$(1)) : PCH_NAME
:=
1049 $(call gb_LinkTarget_get_target
,$(1)) : PCH_HEADER
:=
1050 $(call gb_LinkTarget_get_target
,$(1)) : PCH_LINKTARGETMAKEFILENAME
:=
1051 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
:=
1052 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
:=
1053 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJNOEX
:=
1054 $(call gb_LinkTarget_get_target
,$(1)) : T_PCH_EXTRA_CXXFLAGS
:=
1055 $(call gb_LinkTarget_get_target
,$(1)) : PE_X86
:=
1056 $(call gb_LinkTarget_get_target
,$(1)) : PDBFILE
:=
1057 $(call gb_LinkTarget_get_target
,$(1)) : TARGETGUI
:=
1058 $(call gb_LinkTarget_get_target
,$(1)) : EXTRAOBJECTLISTS
:=
1059 $(call gb_LinkTarget_get_target
,$(1)) : NATIVERES
:=
1060 $(call gb_LinkTarget_get_target
,$(1)) : VISIBILITY
:=
1061 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_NOT_ERRORS
:=
1062 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_DISABLED
:=
1063 $(call gb_LinkTarget_get_target
,$(1)) : PLUGIN_WARNINGS_AS_ERRORS
:=
1064 $(call gb_LinkTarget_get_target
,$(1)) : EXTERNAL_CODE
:=
1065 $(call gb_LinkTarget_get_target
,$(1)) : SOVERSIONSCRIPT
:=
1066 $(call gb_LinkTarget_get_target
,$(1)) : COMPILER_TEST
:=
1067 $(call gb_LinkTarget_get_target
,$(1)) : T_SYMBOLS
:= $(if
$(call gb_target_symbols_enabled
,$(2)),$(true
),$(false
))
1068 $(call gb_LinkTarget_get_target
,$(1)) : T_FORCE_COMPILE
:= $(if
$(call gb_LinkTarget__force_compile
,$(2)),$(true
),$(false
))
1069 $(call gb_LinkTarget_get_target
,$(1)) : T_CC
:=
1070 $(call gb_LinkTarget_get_target
,$(1)) : T_CXX
:=
1071 $(call gb_LinkTarget_get_target
,$(1)) : T_USE_LD
:= $(USE_LD
)
1072 $(call gb_LinkTarget_get_target
,$(1)) : T_LTOFLAGS
:= $(gb_LTOFLAGS
)
1073 $(call gb_LinkTarget_get_target
,$(1)) : T_PREJS
:=
1075 ifeq ($(gb_FULLDEPS
),$(true
))
1076 ifeq (depcache
:,$(filter depcache
,$(.FEATURES
)):$(gb_PARTIAL_BUILD
))
1077 -includedepcache
$(call gb_LinkTarget_get_dep_target
,$(1))
1079 -include $(call gb_LinkTarget_get_dep_target
,$(1))
1081 $(call gb_LinkTarget_get_dep_target
,$(1)) : COBJECTS
:=
1082 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXOBJECTS
:=
1083 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCOBJECTS
:=
1084 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCXXOBJECTS
:=
1085 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXCLROBJECTS
:=
1086 $(call gb_LinkTarget_get_dep_target
,$(1)) : ASMOBJECTS
:=
1087 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCOBJECTS
:=
1088 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXOBJECTS
:=
1089 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENOBJCOBJECTS
:=
1090 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENOBJCXXOBJECTS
:=
1091 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENNASMOBJECTS
:=
1092 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXCLROBJECTS
:=
1093 $(call gb_LinkTarget_get_dep_target
,$(1)) : YACCOBJECTS
:=
1096 gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)) := cxx
1098 # installed linktargets need a rule to build!
1099 $(if
$(findstring $(INSTDIR
),$(1)),$(call gb_LinkTarget__make_installed_rule
,$(1)))
1101 $(call gb_PrecompiledHeader_generate_timestamp_rule
,$(2))
1103 endef # gb_LinkTarget_LinkTarget
1105 # call gb_LinkTarget_set_soversion_script,linktarget,soversionscript
1106 define gb_LinkTarget_set_soversion_script
1107 $(call gb_LinkTarget_get_target
,$(1)) : $(2)
1108 $(call gb_LinkTarget_get_target
,$(1)) : SOVERSIONSCRIPT
:= $(2)
1112 # call gb_LinkTarget_add_defs,linktarget,defines
1113 define gb_LinkTarget_add_defs
1114 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
+= $(2)
1115 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
+= $(2)
1118 # call gb_LinkTarget_add_cflags,linktarget,cflags
1119 define gb_LinkTarget_add_cflags
1120 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS_APPEND
+= $(2)
1123 # call gb_LinkTarget_add_cxxflags,linktarget,cxxflags
1124 define gb_LinkTarget_add_cxxflags
1125 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS_APPEND
+= $(2)
1126 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
+= $(2)
1129 # call gb_LinkTarget_add_objcxxflags,linktarget,objcxxflags
1130 define gb_LinkTarget_add_objcxxflags
1131 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS_APPEND
+= $(2)
1134 # call gb_LinkTarget_add_objcflags,linktarget,objcflags
1135 define gb_LinkTarget_add_objcflags
1136 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS_APPEND
+= $(2)
1140 # call gb_LinkTarget_add_nasmflags,linktarget,nasmflags
1141 define gb_LinkTarget_add_nasmflags
1142 $(call gb_LinkTarget_get_target
,$(1)) : T_NASMFLAGS_APPEND
+= $(2)
1145 # call gb_LinkTarget_add_cxxclrflags,linktarget,cxxclrflags
1146 define gb_LinkTarget_add_cxxclrflags
1147 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXCLRFLAGS_APPEND
+= $(2)
1150 # call gb_LinkTarget__add_include,linktarget,includes
1151 define gb_LinkTarget__add_include
1152 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
+= -I
$(2)
1156 # call gb_LinkTarget__check_srcdir_paths,linktarget,includepaths
1157 define gb_LinkTarget__check_srcdir_paths
1158 $(if
$(filter-out $(wildcard $(2)),$(2)),\
1159 $(call gb_Output_error
,gb_LinkTarget_set_include
: include paths
$(filter-out $(wildcard $(2)),$(2)) do not exist
) \
1163 # call gb_LinkTarget_set_include,linktarget,includes
1164 define gb_LinkTarget_set_include
1165 $(call gb_LinkTarget__check_srcdir_paths
,$(1),\
1166 $(patsubst -I
%,%,$(filter -I
$(SRCDIR
)/%,$(filter-out -I
$(INSTDIR
)/% -I
$(WORKDIR
)/%,$(2)))))
1167 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
:= $(2)
1171 # call gb_LinkTarget_add_ldflags,linktarget,ldflags
1172 define gb_LinkTarget_add_ldflags
1173 $(call gb_LinkTarget_get_target
,$(1)) : T_LDFLAGS
+= $(2)
1177 # real use in RepositoryExternal.mk
1178 # call gb_LinkTarget_set_ldflags,linktarget,ldflags
1179 define gb_LinkTarget_set_ldflags
1180 $(call gb_LinkTarget_get_target
,$(1)) : T_LDFLAGS
:= $(2)
1184 # call gb_LinkTarget_add_libs,linktarget,libs
1185 define gb_LinkTarget_add_libs
1186 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
+= $(2)
1187 $(if
$(call gb_LinkTarget__is_merged
,$(1)),\
1188 $(call gb_Library_get_linktarget_target
,merged
) : T_LIBS
+= $(2))
1189 ifeq ($(ENABLE_CUSTOMTARGET_COMPONENTS
),TRUE
)
1190 $(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)))))
1191 $$(eval
$$(call gb_LinkTarget__get_all_libraries_var
,$(1)) += $(filter-out $(call gb_LinkTarget__get_all_libraries
,$(1)),$(patsubst %,$(gb_LinkTarget__syslib
),$(2))))
1192 ifeq (,$(gb_PARTIAL_BUILD
))
1193 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
+= $(filter-out $(call gb_LinkTarget__get_all_libraries
,$(1)),$(patsubst %,$(gb_LinkTarget__syslib
),$(2)))
1199 # remove platform specific standard libraries for linktarget $(1)
1200 # assumption is that adding these standard libs is always useful, but in very
1201 # exceptional cases this disable method may be used
1202 # call gb_LinkTarget_disable_standard_system_libs,linktarget
1203 define gb_LinkTarget_disable_standard_system_libs
1204 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
:= $$(filter-out $$(gb_STDLIBS
),$$(T_LIBS
))
1205 $(call gb_LinkTarget_get_target
,$(1)) : T_STDLIBS_CXX
:=
1209 # call gb_LinkTarget__use_api,linktarget,api
1210 define gb_LinkTarget__use_api
1211 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(call gb_UnoApiHeadersTarget_get_target
,$(2))
1212 $(call gb_LinkTarget__add_include
,$(1),$(call gb_UnoApiHeadersTarget_get_dir
,$(2)))
1216 # call gb_LinkTarget_use_api,linktarget,apis
1217 define gb_LinkTarget_use_api
1218 $(foreach api
,$(2),$(call gb_LinkTarget__use_api
,$(1),$(api
)))
1222 # call gb_LinkTarget_use_udk_api,linktarget
1223 define gb_LinkTarget_use_udk_api
1224 $(call gb_LinkTarget__use_api
,$(1),udkapi
)
1227 # call gb_LinkTarget_use_sdk_api,linktarget
1228 define gb_LinkTarget_use_sdk_api
1229 $(call gb_LinkTarget__use_api
,$(1),udkapi
)
1230 $(call gb_LinkTarget__use_api
,$(1),offapi
)
1233 # call gb_LinkTarget__use_internal_api_one,linktarget,api,apiprefix
1234 define gb_LinkTarget__use_internal_api_one
1235 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
1236 $(call gb_UnoApiHeadersTarget_get_
$(3)target
,$(2))
1237 $(call gb_LinkTarget__add_include
,$(1),$(call gb_UnoApiHeadersTarget_get_
$(3)dir,$(2)))
1241 # call gb_LinkTarget__use_internal_api,linktarget,apis,apiprefix
1242 define gb_LinkTarget__use_internal_api
1243 $(foreach api
,$(2),$(call gb_LinkTarget__use_internal_api_one
,$(1),$(api
),$(3)))
1247 # call gb_LinkTarget_use_internal_api,linktarget,api
1248 define gb_LinkTarget_use_internal_api
1249 $(call gb_LinkTarget__use_internal_api
,$(1),$(2))
1253 # call gb_LinkTarget_use_internal_bootstrap_api,linktarget,api
1254 define gb_LinkTarget_use_internal_bootstrap_api
1255 $(call gb_LinkTarget__use_internal_api
,$(1),$(2),bootstrap_
)
1259 # call gb_LinkTarget_use_internal_comprehensive_api,linktarget,api
1260 define gb_LinkTarget_use_internal_comprehensive_api
1261 $(call gb_LinkTarget__use_internal_api
,$(1),$(2),comprehensive_
)
1265 define gb_PrintDeps_info
1266 $(info LibraryDep
: $(1) links against
$(2))
1269 # returns $(true), if the target class really calls a linker.
1270 # call gb_LinkTarget_does_real_link,linktarget
1271 gb_LinkTarget_does_real_link
= $(if
$(filter Executable CppunitTest
$(if
$(DISABLE_DYNLOADING
),,Library
), \
1272 $(call gb_LinkTarget__get_workdir_linktargetclass
,$(1))),$(true
))
1274 # avoid problem when a module is built partially but other modules that define
1275 # needed libraries is not yet built: prevent invocation of pattern rule
1276 # for library with invalid parameters by depending on the header target
1277 define gb_LinkTarget__lib_dummy_depend
1278 $(call gb_Library_get_target
,$(1)) :|
$(call gb_Library_get_headers_target
,$(1))
1282 define gb_LinkTarget__generate_all_x_accessors
1283 gb_LinkTarget__get_all_
$(1)_var
= $$(call gb_LinkTarget__get_workdir_linktargetname
,$$(1))<>ALL_
$(2)
1284 gb_LinkTarget__get_all_
$(1) = $$($$(call gb_LinkTarget__get_all_
$(1)_var
,$$(1)))
1285 gb_Library__get_all_
$(1) = $$($$(call gb_LinkTarget__get_all_
$(1)_var
,$$(call gb_Library_get_linktarget
,$$(1))))
1286 gb_Executable__get_all_
$(1) = $$($$(call gb_LinkTarget__get_all_
$(1)_var
,$$(call gb_Executable_get_linktarget
,$$(1))))
1287 gb_ExternalProject__get_all_
$(1) = $$($$(call gb_LinkTarget__get_all_
$(1)_var
,$$(call gb_ExternalProject__get_workdir_linktargetname
,$$(1))))
1288 gb_CppunitTest__get_all_
$(1) = $$($$(call gb_LinkTarget__get_all_
$(1)_var
,$$(call gb_CppunitTest__get_workdir_linktargetname
,$$(1))))
1292 $(eval
$(call gb_LinkTarget__generate_all_x_accessors
,libraries
,LIBRARIES
))
1293 gb_LinkTarget__filter_lo_libraries
= $(filter-out $(gb_LinkTarget__syslib
),$(1))
1294 gb_LinkTarget__get_all_lo_libraries
= $(call gb_LinkTarget__filter_lo_libraries
,$(call gb_LinkTarget__get_all_libraries
,$(1)))
1295 gb_LinkTarget__filter_sys_libraries
= $(filter $(gb_LinkTarget__syslib
),$(1))
1296 gb_LinkTarget__get_all_sys_libraries
= $(call gb_LinkTarget__filter_sys_libraries
,$(call gb_LinkTarget__get_all_libraries
,$(1)))
1297 $(eval
$(call gb_LinkTarget__generate_all_x_accessors
,externals
,EXTERNALS
))
1298 $(eval
$(call gb_LinkTarget__generate_all_x_accessors
,statics
,STATICS
))
1300 # call gb_LinkTarget__register_type,type,linktarget,type list
1301 define gb_LinkTarget__register_type
1302 ifeq ($(ENABLE_CUSTOMTARGET_COMPONENTS
),TRUE
)
1303 ifeq (,$(DISABLE_DYNLOADING
))
1304 $$(error ENABLE_CUSTOMTARGET_COMPONENTS just works with DISABLE_DYNLOADING
)
1306 $(foreach type
,$(3),$(if
$(filter $(type
),$(call gb_LinkTarget__get_all_
$(1),$(2))),, \
1307 $(if
$(gb_DEBUG_STATIC
),$$(info $(call gb_LinkTarget__get_all_
$(1)_var
,$(2)) += $(type
))) \
1308 $$(eval
$(call gb_LinkTarget__get_all_
$(1)_var
,$(2)) += $(type
)) \
1314 # call gb_LinkTarget__use_libraries,linktarget,requestedlibs,actuallibs,linktargetmakefilename
1315 define gb_LinkTarget__use_libraries
1317 # used by bin/module-deps.pl
1318 ifneq ($(ENABLE_PRINT_DEPS
),)
1319 # exclude libraries in Library_merged
1320 ifeq ($(filter $(1),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library_get_linktarget
,$(lib
)))),)
1321 $$(eval
$$(call gb_PrintDeps_info
,$(4),$(3)))
1325 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
+= $(3)
1327 ifeq (,$(DISABLE_DYNLOADING
))
1328 # depend on the exports of the library, not on the library itself
1329 # for faster incremental builds when the ABI is unchanged.
1330 # export files are created from the library, so this also ensures the library exists.
1331 $(foreach lib
,$(call gb_LinkTarget__filter_lo_libraries
,$(3)),$(if
$(filter $(lib
),$(gb_Library_KNOWNLIBS
)), \
1332 $$(eval
$(call gb_LinkTarget_get_target
,$(1)) : $(call gb_Library_get_exports_target
,$(lib
))) \
1335 else # DISABLE_DYNLOADING
1336 # depend on the now-static libraries themself, but only if the target actually links to it
1337 ifneq (,$(call gb_LinkTarget_does_real_link
,$(1)))
1338 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
+= $(call gb_LinkTarget__filter_sys_libraries
,$(3))
1339 $(if
$(filter-out Library
,gb_LinkTarget__get_workdir_linktargetclass
,$(1)), \
1340 $(foreach lib
,$(call gb_LinkTarget__filter_lo_libraries
,$(3)),$(if
$(filter $(lib
),$(gb_Library_KNOWNLIBS
)), \
1341 $$(eval
$(call gb_LinkTarget_get_target
,$(1)) : $(call gb_Library_get_linktarget_target
,$(lib
))) \
1344 endif # DISABLE_DYNLOADING
1346 $(call gb_LinkTarget__register_type
,libraries
,$(1),$(3))
1348 $(foreach lib
,$(call gb_LinkTarget__filter_lo_libraries
,$(2)),$(if
$(filter $(lib
),$(gb_Library_KNOWNLIBS
)), \
1349 $(eval
$(call gb_LinkTarget_get_headers_target
,$(1)) : $(call gb_Library_get_headers_target
,$(lib
))) \
1350 $(call gb_LinkTarget__lib_dummy_depend
,$(lib
)) \
1353 endef # gb_LinkTarget__use_libraries
1355 # libraries which are merged but need to be built for gb_BUILD_HELPER_TOOLS
1356 gb_BUILD_HELPER_LIBS
:= $(foreach lib
, \
1371 , $(call gb_Library__get_workdir_linktargetname
,$(lib
)))
1373 # tools libmerged depends on, so they link against gb_BUILD_HELPER_LIBS
1374 gb_BUILD_HELPER_TOOLS
:= $(foreach exe
,\
1379 , $(call gb_Executable__get_workdir_linktargetname
,$(exe
)))
1381 # call gb_LinkTarget__is_build_lib,linktargetname
1382 define gb_LinkTarget__is_build_lib
1383 $(if
$(filter $(call gb_LinkTarget__get_workdir_linktargetname
,$(1)),$(call gb_BUILD_HELPER_LIBS
)),$(true
))
1386 # call gb_LinkTarget__is_build_tool,linktargetname
1387 define gb_LinkTarget__is_build_tool
1388 $(if
$(filter $(call gb_LinkTarget__get_workdir_linktargetname
,$(1)),$(call gb_BUILD_HELPER_TOOLS
)),$(true
))
1391 define gb_LinkTarget__is_merged
1392 $(filter $(1),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library_get_linktarget
,$(lib
))))
1395 # call gb_LinkTarget_use_libraries,linktarget,libs
1396 define gb_LinkTarget_use_libraries
1397 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS
) $(gb_LinkTarget__syslib
),$(2)))
1398 $$(eval
$$(call gb_Output_info
,currently known libraries are
: $(sort $(gb_Library_KNOWNLIBS
)),ALL
))
1399 $$(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
))
1401 ifneq (,$$(filter $(2),$(gb_Library_KNOWNPLUGINS
)))
1402 ifneq (,$$(filter $(1),$$(foreach plugin
,$(gb_Library_KNOWNPLUGINS
),$(call gb_Library__get_workdir_linktargetname
,$(plugin
)))))
1403 $$(eval
$$(call gb_Output_error
,Cannot link against plugin library
/libraries
'$$(filter $(2),$(gb_Library_KNOWNPLUGINS))'. Only plugins are allowed to do that.
))
1407 ifeq ($(call gb_LinkTarget__is_build_tool
,$(1))$(call gb_LinkTarget__is_build_lib
,$(1)),$(true
))
1408 $(call gb_LinkTarget__use_libraries
,$(1),$(2),$(2),$(4))
1410 # $$(3) = Always just depend on non-merged libs. If any dependency is merged, but you aren't, also depend on "merged".
1411 $(call gb_LinkTarget__use_libraries
,$(1),$(2),$(strip \
1412 $(filter-out $(gb_MERGEDLIBS
),$(2)) \
1413 $(if
$(filter $(gb_MERGEDLIBS
),$(2)),$(if
$(call gb_LinkTarget__is_merged
,$(1)),,merged
)) \
1419 # avoid problem when a module is built partially but other modules that define
1420 # needed static libraries is not yet built: prevent invocation of pattern rule
1421 # for static library with invalid parameters by depending on the header target
1422 define gb_LinkTarget__static_lib_dummy_depend
1423 $(call gb_StaticLibrary_get_target
,$(1)) :| \
1424 $(call gb_StaticLibrary_get_headers_target
,$(1))
1428 # for a StaticLibrary, dependent libraries are not actually linked in
1429 # call gb_LinkTarget_use_static_libraries,linktarget,staticlibs
1430 define gb_LinkTarget_use_static_libraries
1431 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_STATIC_LIBS
+= $$(if
$$(filter-out StaticLibrary
,$$(TARGETTYPE
)),$(2))
1432 $(if
$(call gb_LinkTarget__is_merged
,$(1)),\
1433 $(call gb_Library_get_linktarget_target
,merged
) : \
1434 LINKED_STATIC_LIBS
+= $$(if
$$(filter-out StaticLibrary
,$$(TARGETTYPE
)),$(2)))
1436 # depend on the static libraries, but only if the target actually links to it
1437 ifneq (,$(call gb_LinkTarget_does_real_link
,$(1)))
1438 # make has a size limit for the prerequisites string, which will be exceeded for some larger static links,
1439 # like soffice.bin, but there seems to be no limit for makefile lines...
1440 $(foreach lib
,$(2), \
1441 $$(eval
$(call gb_LinkTarget_get_target
,$(1)): $(call gb_StaticLibrary_get_linktarget_target
,$(lib
))))
1444 $(call gb_LinkTarget__register_type
,statics
,$(1),$(2))
1446 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
1447 $(foreach lib
,$(2),$(call gb_StaticLibrary_get_headers_target
,$(lib
)))
1448 $(foreach lib
,$(2),$(call gb_LinkTarget__static_lib_dummy_depend
,$(lib
)))
1450 endef # gb_LinkTarget_use_static_libraries
1452 # call gb_LinkTarget_add_cobject,linktarget,sourcefile,cflags,linktargetmakefilename
1453 define gb_LinkTarget_add_cobject
1454 $(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)))))
1455 $(call gb_LinkTarget_get_target
,$(1)) : COBJECTS
+= $(2)
1456 $(call gb_LinkTarget_get_clean_target
,$(1)) : COBJECTS
+= $(2)
1458 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CObject_get_target
,$(2))
1459 $(call gb_CObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1460 $(call gb_CObject_get_target
,$(2)) : T_CFLAGS
+= $(call gb_LinkTarget__get_cflags
,$(4)) $(3)
1461 $(call gb_CObject_get_target
,$(2)) : \
1462 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1464 ifeq ($(gb_FULLDEPS
),$(true
))
1465 $(call gb_LinkTarget_get_dep_target
,$(1)) : COBJECTS
+= $(2)
1466 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CObject_get_dep_target
,$(2))
1467 $(call gb_CObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CObject_get_dep_target
,$(2))).
dir
1468 $(call gb_CObject_get_target
,$(2)) :|
$(dir $(call gb_CObject_get_dep_target
,$(2))).
dir
1473 # call gb_LinkTarget_add_cxxobject_internal,linktarget,sourcefile,cxxflags,linktargetmakefilename,exceptionflags
1474 # The purpose of the exceptionflags extra argument is to differentiate between usage that just needs
1475 # exception flags and usage that adds other flags. Using a PCH requires the same cxxflags as the ones used
1476 # to create the PCH, so non-empty cxxflags here mean the object cannot use the PCH, and the add_exception_cxxobject
1477 # variant passes the necessary flags by setting the extra argument.
1478 define gb_LinkTarget_add_cxxobject_internal
1479 $(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)))))
1480 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
+= $(2)
1481 $(call gb_LinkTarget_get_clean_target
,$(1)) : CXXOBJECTS
+= $(2)
1483 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CxxObject_get_target
,$(2))
1484 $(call gb_CxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1485 $(call gb_CxxObject_get_target
,$(2)) : T_CXXFLAGS
+= $(call gb_LinkTarget__get_cxxflags
,$(4)) $(3) $(5)
1486 $(call gb_CxxObject_get_target
,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS
:= $(if
$(strip $(3)),1)
1487 $(call gb_CxxObject_get_target
,$(2)) : \
1488 OBJECTOWNER
:= $(if
$(6),,$(call gb_Object__owner
,$(2),$(1)))
1489 ifneq ($(gb_ENABLE_PCH
),)
1491 $(call gb_CxxObject_get_target
,$(2)) : $(call gb_LinkTarget_get_pch_timestamp
,$(4))
1495 ifeq ($(gb_FULLDEPS
),$(true
))
1496 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXOBJECTS
+= $(2)
1497 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CxxObject_get_dep_target
,$(2))
1498 $(call gb_CxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CxxObject_get_dep_target
,$(2))).
dir
1499 $(call gb_CxxObject_get_target
,$(2)) :|
$(dir $(call gb_CxxObject_get_dep_target
,$(2))).
dir
1504 # call gb_LinkTarget_add_cxxobject,linktarget,sourcefile,cxxflags,linktargetmakefilename
1505 define gb_LinkTarget_add_cxxobject
1506 $(call gb_LinkTarget_add_cxxobject_internal
,$(1),$(2),$(3),$(4))
1509 # call gb_LinkTarget_add_objcobject,linktarget,sourcefile,objcflags,linktargetmakefilename
1510 define gb_LinkTarget_add_objcobject
1511 $(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)))))
1512 $(call gb_LinkTarget_get_target
,$(1)) : OBJCOBJECTS
+= $(2)
1513 $(call gb_LinkTarget_get_clean_target
,$(1)) : OBJCOBJECTS
+= $(2)
1515 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_ObjCObject_get_target
,$(2))
1516 $(call gb_ObjCObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1517 $(call gb_ObjCObject_get_target
,$(2)) : T_OBJCFLAGS
+= $(call gb_LinkTarget__get_objcflags
,$(4)) $(3)
1518 $(call gb_ObjCObject_get_target
,$(2)) : \
1519 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1521 ifeq ($(gb_FULLDEPS
),$(true
))
1522 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCOBJECTS
+= $(2)
1523 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_ObjCObject_get_dep_target
,$(2))
1524 $(call gb_ObjCObject_get_dep_target
,$(2)) :|
$(dir $(call gb_ObjCObject_get_dep_target
,$(2))).
dir
1525 $(call gb_ObjCObject_get_target
,$(2)) :|
$(dir $(call gb_ObjCObject_get_dep_target
,$(2))).
dir
1530 # call gb_LinkTarget_add_objcxxobject,linktarget,sourcefile,objcxxflags,linktargetmakefilename
1531 define gb_LinkTarget_add_objcxxobject
1532 $(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)))))
1533 $(call gb_LinkTarget_get_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
1534 $(call gb_LinkTarget_get_clean_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
1536 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_ObjCxxObject_get_target
,$(2))
1537 $(call gb_ObjCxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1538 $(call gb_ObjCxxObject_get_target
,$(2)) : T_OBJCXXFLAGS
+= $(call gb_LinkTarget__get_objcxxflags
,$(4)) $(3)
1539 $(call gb_ObjCxxObject_get_target
,$(2)) : \
1540 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1542 ifeq ($(gb_FULLDEPS
),$(true
))
1543 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
1544 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_ObjCxxObject_get_dep_target
,$(2))
1545 $(call gb_ObjCxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_ObjCxxObject_get_dep_target
,$(2))).
dir
1546 $(call gb_ObjCxxObject_get_target
,$(2)) :|
$(dir $(call gb_ObjCxxObject_get_dep_target
,$(2))).
dir
1551 # call gb_LinkTarget_add_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
1552 define gb_LinkTarget_add_cxxclrobject
1553 $(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)))))
1554 $(call gb_LinkTarget_get_target
,$(1)) : CXXCLROBJECTS
+= $(2)
1555 $(call gb_LinkTarget_get_clean_target
,$(1)) : CXXCLROBJECTS
+= $(2)
1557 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CxxClrObject_get_target
,$(2))
1558 $(call gb_CxxClrObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1559 $(call gb_CxxClrObject_get_target
,$(2)) : T_CXXCLRFLAGS
+= $(call gb_LinkTarget__get_cxxclrflags
,$(4)) $(3)
1560 $(call gb_CxxClrObject_get_target
,$(2)) : \
1561 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1563 ifeq ($(gb_FULLDEPS
),$(true
))
1564 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXCLROBJECTS
+= $(2)
1565 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CxxClrObject_get_dep_target
,$(2))
1566 $(call gb_CxxClrObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CxxClrObject_get_dep_target
,$(2))).
dir
1567 $(call gb_CxxClrObject_get_target
,$(2)) :|
$(dir $(call gb_CxxClrObject_get_dep_target
,$(2))).
dir
1572 # call gb_LinkTarget_add_asmobject,linktarget,sourcefile
1573 define gb_LinkTarget_add_asmobject
1574 $(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)))))
1575 $(call gb_LinkTarget_get_target
,$(1)) : ASMOBJECTS
+= $(2)
1576 $(call gb_LinkTarget_get_clean_target
,$(1)) : ASMOBJECTS
+= $(2)
1578 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_AsmObject_get_target
,$(2))
1579 $(call gb_AsmObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1580 $(call gb_AsmObject_get_target
,$(2)) : \
1581 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1583 ifeq ($(gb_FULLDEPS
),$(true
))
1584 $(call gb_LinkTarget_get_dep_target
,$(1)) : ASMOBJECTS
+= $(2)
1585 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_AsmObject_get_dep_target
,$(2))
1586 $(call gb_AsmObject_get_dep_target
,$(2)) :|
$(dir $(call gb_AsmObject_get_dep_target
,$(2))).
dir
1587 $(call gb_AsmObject_get_target
,$(2)) :|
$(dir $(call gb_AsmObject_get_dep_target
,$(2))).
dir
1592 # call gb_LinkTarget_add_generated_c_object,linktarget,sourcefile,cflags,linktargetmakefilename
1593 define gb_LinkTarget_add_generated_c_object
1594 $(call gb_LinkTarget_get_target
,$(1)) : GENCOBJECTS
+= $(2)
1595 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCOBJECTS
+= $(2)
1597 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCObject_get_target
,$(2))
1598 $(call gb_GenCObject_get_target
,$(2)) : $(call gb_GenCObject_get_source
,$(2))
1599 # Often gb_GenCObject_get_source does not have its own rule and is only a byproduct.
1600 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1601 $(call gb_GenCObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1602 $(call gb_GenCObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1603 $(call gb_GenCObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1604 $(call gb_GenCObject_get_target
,$(2)) : T_CFLAGS
+= $(call gb_LinkTarget__get_cflags
,$(4)) $(3)
1605 $(call gb_GenCObject_get_target
,$(2)) : \
1606 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1608 ifeq ($(gb_FULLDEPS
),$(true
))
1609 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCOBJECTS
+= $(2)
1610 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCObject_get_dep_target
,$(2))
1611 $(call gb_GenCObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCObject_get_dep_target
,$(2))).
dir
1612 $(call gb_GenCObject_get_target
,$(2)) :|
$(dir $(call gb_GenCObject_get_dep_target
,$(2))).
dir
1617 # call gb_LinkTarget_add_generated_cxx_object_internal,linktarget,sourcefile,cxxflags,linktargetmakefilename,exceptionflags
1618 define gb_LinkTarget_add_generated_cxx_object_internal
1619 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1620 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1622 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCxxObject_get_target
,$(2))
1623 $(call gb_GenCxxObject_get_target
,$(2)) : $(call gb_GenCxxObject_get_source
,$(2),$(1))
1624 # Often gb_GenCxxObject_get_source does not have its own rule and is only a byproduct.
1625 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1626 $(call gb_GenCxxObject_get_source
,$(2),$(1)) : |
$(gb_Helper_MISCDUMMY
)
1627 $(call gb_GenCxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1628 $(call gb_GenCxxObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1629 $(call gb_GenCxxObject_get_target
,$(2)) : T_CXXFLAGS
+= $(call gb_LinkTarget__get_cxxflags
,$(4)) $(3) $(5)
1630 $(call gb_GenCxxObject_get_target
,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS
:= $(if
$(strip $(3)),1)
1631 $(call gb_GenCxxObject_get_target
,$(2)) : \
1632 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1633 $(call gb_GenCxxObject_get_target
,$(2)) : GEN_CXX_SOURCE
:= $(call gb_GenCxxObject_get_source
,$(2),$(1))
1634 ifneq ($(gb_ENABLE_PCH
),)
1635 $(call gb_GenCxxObject_get_target
,$(2)) : $(call gb_LinkTarget_get_pch_timestamp
,$(4))
1638 ifeq ($(gb_FULLDEPS
),$(true
))
1639 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1640 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCxxObject_get_dep_target
,$(2))
1641 $(call gb_GenCxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCxxObject_get_dep_target
,$(2))).
dir
1642 $(call gb_GenCxxObject_get_target
,$(2)) :|
$(dir $(call gb_GenCxxObject_get_dep_target
,$(2))).
dir
1647 # call gb_LinkTarget_add_generated_cxx_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1648 define gb_LinkTarget_add_generated_cxx_object
1649 $(call gb_LinkTarget_add_generated_cxx_object_internal
,$(1),$(2),$(3),$(4))
1652 # call gb_LinkTarget_add_generated_objc_object,linktarget,sourcefile,cflags,linktargetmakefilename
1653 define gb_LinkTarget_add_generated_objc_object
1654 $(call gb_LinkTarget_get_target
,$(1)) : GENOBJCOBJECTS
+= $(2)
1655 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENOBJCOBJECTS
+= $(2)
1657 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenObjCObject_get_target
,$(2))
1658 $(call gb_GenObjCObject_get_target
,$(2)) : $(call gb_GenObjCObject_get_source
,$(2))
1659 # Often gb_GenObjCObject_get_source does not have its own rule and is only a byproduct.
1660 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1661 $(call gb_GenObjCObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1662 $(call gb_GenObjCObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1663 $(call gb_GenObjCObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1664 $(call gb_GenObjCObject_get_target
,$(2)) : T_OBJCFLAGS
+= $(call gb_LinkTarget__get_objcflags
,$(4)) $(3)
1665 $(call gb_GenObjCObject_get_target
,$(2)) : \
1666 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1668 ifeq ($(gb_FULLDEPS
),$(true
))
1669 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENOBJCOBJECTS
+= $(2)
1670 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenObjCObject_get_dep_target
,$(2))
1671 $(call gb_GenObjCObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenObjCObject_get_dep_target
,$(2))).
dir
1672 $(call gb_GenObjCObject_get_target
,$(2)) :|
$(dir $(call gb_GenObjCObject_get_dep_target
,$(2))).
dir
1677 # call gb_LinkTarget_add_generated_nasm_object,linktarget,sourcefile,nasmflags,linktargetmakefilename
1678 define gb_LinkTarget_add_generated_nasm_object
1679 $(call gb_LinkTarget_get_target
,$(1)) : GENNASMOBJECTS
+= $(2)
1680 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENNASMOBJECTS
+= $(2)
1682 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenNasmObject_get_target
,$(2))
1683 $(call gb_GenNasmObject_get_target
,$(2)) : $(call gb_GenNasmObject_get_source
,$(2))
1684 # Often gb_GenNasmObject_get_source does not have its own rule and is only a byproduct.
1685 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1686 $(call gb_GenNasmObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1687 $(call gb_GenNasmObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1688 $(call gb_GenNasmObject_get_target
,$(2)) : T_NASMFLAGS
+= $(call gb_LinkTarget__get_nasmflags
,$(4)) $(3)
1689 $(call gb_GenNasmObject_get_target
,$(2)) : \
1690 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1692 ifeq ($(gb_FULLDEPS
),$(true
))
1693 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENNASMOBJECTS
+= $(2)
1694 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenNasmObject_get_dep_target
,$(2))
1695 $(call gb_GenNasmObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenNasmObject_get_dep_target
,$(2))).
dir
1696 $(call gb_GenNasmObject_get_target
,$(2)) :|
$(dir $(call gb_GenNasmObject_get_dep_target
,$(2))).
dir
1701 # call gb_LinkTarget_add_generated_objcxx_object,linktarget,sourcefile,cflags,linktargetmakefilename
1702 define gb_LinkTarget_add_generated_objcxx_object
1703 $(call gb_LinkTarget_get_target
,$(1)) : GENOBJCXXOBJECTS
+= $(2)
1704 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENOBJCXXOBJECTS
+= $(2)
1706 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenObjCxxObject_get_target
,$(2))
1707 $(call gb_GenObjCxxObject_get_target
,$(2)) : $(call gb_GenObjCxxObject_get_source
,$(2))
1708 # Often gb_GenObjCxxObject_get_source does not have its own rule and is only a byproduct.
1709 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1710 $(call gb_GenObjCxxObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1711 $(call gb_GenObjCxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1712 $(call gb_GenObjCxxObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1713 $(call gb_GenObjCxxObject_get_target
,$(2)) : T_OBJCXXFLAGS
+= $(call gb_LinkTarget__get_objcxxflags
,$(4)) $(3)
1714 $(call gb_GenObjCxxObject_get_target
,$(2)) : \
1715 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1717 ifeq ($(gb_FULLDEPS
),$(true
))
1718 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENOBJCXXOBJECTS
+= $(2)
1719 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenObjCxxObject_get_dep_target
,$(2))
1720 $(call gb_GenObjCxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenObjCxxObject_get_dep_target
,$(2))).
dir
1721 $(call gb_GenObjCxxObject_get_target
,$(2)) :|
$(dir $(call gb_GenObjCxxObject_get_dep_target
,$(2))).
dir
1726 # call gb_LinkTarget_add_generated_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
1727 define gb_LinkTarget_add_generated_cxxclrobject
1728 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXCLROBJECTS
+= $(2)
1729 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCXXCLROBJECTS
+= $(2)
1731 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCxxClrObject_get_target
,$(2))
1732 $(call gb_GenCxxClrObject_get_target
,$(2)) : $(call gb_GenCxxClrObject_get_source
,$(2),$(1))
1733 $(call gb_GenCxxClrObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1734 $(call gb_GenCxxClrObject_get_target
,$(2)) : T_CXXCLRFLAGS
+= $(call gb_LinkTarget__get_cxxclrflags
,$(4)) $(3)
1735 $(call gb_GenCxxClrObject_get_target
,$(2)) : \
1736 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1737 $(call gb_GenCxxClrObject_get_target
,$(2)) : GEN_CXXCLR_SOURCE
:= $(call gb_GenCxxClrObject_get_source
,$(2),$(1))
1739 ifeq ($(gb_FULLDEPS
),$(true
))
1740 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXCLROBJECTS
+= $(2)
1741 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCxxClrObject_get_dep_target
,$(2))
1742 $(call gb_GenCxxClrObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCxxClrObject_get_dep_target
,$(2))).
dir
1743 $(call gb_GenCxxClrObject_get_target
,$(2)) :|
$(dir $(call gb_GenCxxClrObject_get_dep_target
,$(2))).
dir
1748 # Add a bison grammar to the build.
1749 # call gb_LinkTarget_add_grammar,linktarget,yaccfile,cxxflags,linktargetmakefilename
1750 define gb_LinkTarget_add_grammar
1751 $(call gb_YaccTarget_YaccTarget
,$(2))
1752 $(call gb_LinkTarget_add_generated_exception_object
,$(1),YaccTarget
/$(2),$(3) $(if
$(filter GCC
,$(COM
)),-Wno-unused-macros
),$(4))
1753 $(call gb_GenCxxObject_get_target
,YaccTarget
/$(2)): PLUGIN_WARNINGS_AS_ERRORS
:= $(true
)
1754 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_YaccTarget_get_clean_target
,$(2))
1755 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(call gb_YaccTarget_get_header_target
,$(2))
1756 $(call gb_LinkTarget__add_include
,$(1),$(dir $(call gb_YaccTarget_get_header_target
,$(2))))
1760 # Add bison grammars to the build.
1761 # call gb_LinkTarget_add_grammars,linktarget,yaccfiles,cxxflags,linktargetmakefilename
1762 define gb_LinkTarget_add_grammars
1763 $(foreach grammar
,$(2),$(call gb_LinkTarget_add_grammar
,$(1),$(grammar
),$(3),$(4)))
1766 # Add a flex scanner to the build.
1767 # call gb_LinkTarget_add_scanner,linktarget,lexfile,cxxflags,linktargetmakefilename
1768 define gb_LinkTarget_add_scanner
1769 $(call gb_LexTarget_LexTarget
,$(2))
1770 $(call gb_LinkTarget_add_generated_exception_object
,$(1),LexTarget
/$(2),$(3) $(if
$(filter GCC
,$(COM
)),-Wno-unused-macros
),$(4))
1771 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_LexTarget_get_clean_target
,$(2))
1775 # Add flex scanners to the build.
1776 # call gb_LinkTarget_add_scanners,linktarget,lexfiles,cxxflags,linktargetmakefilename
1777 define gb_LinkTarget_add_scanners
1778 $(foreach scanner
,$(2),$(call gb_LinkTarget_add_scanner
,$(1),$(scanner
),$(3),$(4)))
1782 # call gb_LinkTarget_add_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1783 define gb_LinkTarget_add_exception_object
1784 $(call gb_LinkTarget_add_cxxobject_internal
,$(1),$(2),$(3),$(4),$(gb_LinkTarget_EXCEPTIONFLAGS
))
1787 # call gb_LinkTarget__use_linktarget_objects,linktarget,linktargets
1788 define gb_LinkTarget__use_linktarget_objects
1789 $(call gb_LinkTarget_get_target
,$(1)) : $(foreach linktarget
,$(2),$(call gb_LinkTarget_get_target
,$(linktarget
)))
1791 $(call gb_LinkTarget_get_target
,$(1)) : EXTRAOBJECTLISTS
+= $(foreach linktarget
,$(2),$(call gb_LinkTarget_get_objects_list
,$(linktarget
)))
1796 # call gb_LinkTarget_use_library_objects,linktarget,libs
1797 define gb_LinkTarget_use_library_objects
1798 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS
),$(2)))
1799 $$(eval
$$(call gb_Output_info
,currently known libraries are
: $(sort $(gb_Library_KNOWNLIBS
)),ALL
))
1800 $$(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
))
1802 $(call gb_LinkTarget__use_linktarget_objects
,$(1),$(foreach lib
,$(2),$(call gb_Library_get_linktarget
,$(lib
))))
1803 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
1804 $(foreach lib
,$(2),$(call gb_Library_get_headers_target
,$(lib
)))
1808 # call gb_LinkTarget_use_executable_objects,linktarget,exes
1809 define gb_LinkTarget_use_executable_objects
1810 $(call gb_LinkTarget__use_linktarget_objects
,$(1),$(foreach exe
,$(2),$(call gb_Executable_get_linktarget
,$(exe
))))
1814 # call gb_LinkTarget_add_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1815 define gb_LinkTarget_add_cobjects
1816 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cobject
,$(1),$(obj
),$(3),$(4)))
1819 # call gb_LinkTarget_add_cxxobjects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1820 define gb_LinkTarget_add_cxxobjects
1821 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cxxobject
,$(1),$(obj
),$(3),$(4)))
1824 # call gb_LinkTarget_add_objcobjects,linktarget,sourcefiles,objcflags,linktargetmakefilename
1825 define gb_LinkTarget_add_objcobjects
1826 $(foreach obj
,$(2),$(call gb_LinkTarget_add_objcobject
,$(1),$(obj
),$(3),$(4)))
1829 # call gb_LinkTarget_add_objcxxobjects,linktarget,sourcefiles,objcxxflags,linktargetmakefilename
1830 define gb_LinkTarget_add_objcxxobjects
1831 $(foreach obj
,$(2),$(call gb_LinkTarget_add_objcxxobject
,$(1),$(obj
),$(3),$(4)))
1834 # call gb_LinkTarget_add_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename
1835 define gb_LinkTarget_add_cxxclrobjects
1836 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cxxclrobject
,$(1),$(obj
),$(3),$(4)))
1839 # call gb_LinkTarget_add_asmobjects,linktarget,sourcefiles,asmflags,linktargetmakefilename
1840 define gb_LinkTarget_add_asmobjects
1841 $(foreach obj
,$(2),$(call gb_LinkTarget_add_asmobject
,$(1),$(obj
),$(3),$(4)))
1844 # call gb_LinkTarget_add_exception_objects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1845 define gb_LinkTarget_add_exception_objects
1846 $(foreach obj
,$(2),$(call gb_LinkTarget_add_exception_object
,$(1),$(obj
),$(3),$(4)))
1849 #only useful for building x64 libraries on windows
1850 # call gb_LinkTarget_add_x64_generated_exception_objects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1851 define gb_LinkTarget_add_x64_generated_exception_objects
1852 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_exception_object
,$(1),$(obj
),$(3),$(4)))
1853 $(foreach obj
,$(2),$(eval
$(call gb_GenCxxObject_get_target
,$(obj
)) : CXXOBJECT_X64
:= YES
))
1856 # call gb_LinkTarget_add_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1857 define gb_LinkTarget_add_generated_cobjects
1858 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_c_object
,$(1),$(obj
),$(3),$(4)))
1861 #only useful for building x64 libraries on windows
1862 # call gb_LinkTarget_add_x64_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1863 define gb_LinkTarget_add_x64_generated_cobjects
1864 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_c_object
,$(1),$(obj
),$(3),$(4)))
1867 # call gb_LinkTarget_add_generated_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1868 define gb_LinkTarget_add_generated_exception_object
1869 $(call gb_LinkTarget_add_generated_cxx_object_internal
,$(1),$(2),$(3),$(4),$(gb_LinkTarget_EXCEPTIONFLAGS
))
1872 # call gb_LinkTarget_add_generated_exception_objects,linktarget,sourcefile,cxxflags,linktargetmakefilename
1873 define gb_LinkTarget_add_generated_exception_objects
1874 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_exception_object
,$(1),$(obj
),$(3),$(4)))
1877 # call gb_LinkTarget_add_generated_objcobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1878 define gb_LinkTarget_add_generated_objcobjects
1879 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_objc_object
,$(1),$(obj
),$(3),$(4)))
1882 # call gb_LinkTarget_add_generated_objcxxobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1883 define gb_LinkTarget_add_generated_objcxxobjects
1884 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_objcxx_object
,$(1),$(obj
),$(3),$(4)))
1887 # call gb_LinkTarget_add_generated_nasmobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1888 define gb_LinkTarget_add_generated_nasmobjects
1889 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_nasm_object
,$(1),$(obj
),$(3),$(4)))
1892 # call gb_LinkTarget_add_generated_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename
1893 define gb_LinkTarget_add_generated_cxxclrobjects
1894 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_cxxclrobject
,$(1),$(obj
),$(3),$(4)))
1897 # call gb_LinkTarget_set_targettype,linktarget,targettype
1898 define gb_LinkTarget_set_targettype
1899 $(call gb_LinkTarget_get_target
,$(1)) : TARGETTYPE
:= $(2)
1903 # call gb_LinkTarget_set_x64,linktarget,boolean
1904 define gb_LinkTarget_set_x64
1905 $(call gb_LinkTarget_get_target
,$(1)) : LIBRARY_X64
:= $(2)
1909 # call gb_LinkTarget_set_x86,linktarget,boolean
1910 define gb_LinkTarget_set_x86
1911 $(call gb_LinkTarget_get_target
,$(1)) : PE_X86
:= $(2)
1915 # call gb_LinkTarget_set_ilibtarget,linktarget,ilibfilename
1916 define gb_LinkTarget_set_ilibtarget
1917 ifeq (,$(DISABLE_DYNLOADING
))
1918 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1919 $(call gb_LinkTarget_get_target
,$(1)) : ILIBTARGET
:= $(2)
1924 # Add a file that is built by the LinkTarget command and define
1925 # a dummy touch rule for it so it can be tracked via dependencies.
1926 # The assumption is that the file is created by linking; in case it does not
1927 # exist there is some problem. This can be caused on WNT by re-naming DLL
1928 # files (which are aux-targets) but not the import .lib files (which
1929 # are the LinkTargets) and doing an incremental build.
1930 # call gb_LinkTarget_add_auxtarget,linktarget,auxtarget
1931 define gb_LinkTarget_add_auxtarget
1932 $(2) : $(call gb_LinkTarget_get_target
,$(1))
1933 if
test -e
$$@
; then \
1937 echo
"ERROR: aux-target $$@ missing, library deleted, please try running make again"; \
1941 $(call gb_LinkTarget_get_clean_target
,$(1)) : AUXTARGETS
+= $(2)
1945 # call gb_LinkTarget_add_auxtargets,linktarget,auxtargets
1946 define gb_LinkTarget_add_auxtargets
1947 $(foreach aux
,$(2),$(call gb_LinkTarget_add_auxtarget
,$(1),$(aux
)))
1951 # call gb_LinkTarget__use_custom_headers,linktarget,customtarget
1952 define gb_LinkTarget__use_custom_headers
1953 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
1954 $(call gb_CustomTarget_get_target
,$(2))
1955 $(call gb_LinkTarget__add_include
,$(1),$(call gb_CustomTarget_get_workdir
,$(2)))
1959 # call gb_LinkTarget_use_custom_headers,linktarget,customtargets
1960 define gb_LinkTarget_use_custom_headers
1961 $(foreach customtarget
,$(2),$(call gb_LinkTarget__use_custom_headers
,$(1),$(customtarget
)))
1965 # add SDI (svidl) headers
1966 # call gb_LinkTarget_add_sdi_headers,linktarget,sditargets
1967 define gb_LinkTarget_add_sdi_headers
1968 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(foreach sdi
,$(2),$(call gb_SdiTarget_get_target
,$(sdi
)))
1969 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(foreach sdi
,$(2),$(call gb_SdiTarget_get_clean_target
,$(sdi
)))
1973 # call gb_LinkTarget__set_precompiled_header_variables,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1974 define gb_LinkTarget__set_precompiled_header_variables
1975 $(call gb_LinkTarget_get_target
,$(1)) : PCH_NAME
:= $(3)
1976 $(call gb_LinkTarget_get_target
,$(1)) : PCH_HEADER
:= $(patsubst %.
cxx,%.hxx
,$(2))
1977 $(call gb_LinkTarget_get_target
,$(1)) : PCH_LINKTARGETMAKEFILENAME
:= $(4)
1979 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
:= $$(DEFS
)
1980 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
:= $$(T_CXXFLAGS
) $(call gb_LinkTarget__get_cxxflags
,$(4)) $(gb_LinkTarget_EXCEPTIONFLAGS
)
1982 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
+= -DPCH_LEVEL
=$(gb_ENABLE_PCH
)
1983 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
+= -DPCH_LEVEL
=$(gb_ENABLE_PCH
)
1987 # call gb_LinkTarget__set_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1988 define gb_LinkTarget__set_precompiled_header_impl
1989 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_PrecompiledHeader_get_clean_target
,$(3))
1990 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : $(call gb_CxxObject_get_source
,$(SRCDIR
),$(2))
1991 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : $(patsubst %.
cxx,%.hxx
,$(call gb_CxxObject_get_source
,$(SRCDIR
),$(2)))
1992 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : $(call gb_PrecompiledHeader_get_flags_file
,$(3),$(4))
1994 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : $(call gb_LinkTarget_get_headers_target
,$(1))
1996 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : VISIBILITY
:=
1998 $(call gb_LinkTarget_get_pch_timestamp
,$(4)) : $(call gb_PrecompiledHeader_get_target
,$(3),$(4))
2000 $(call gb_LinkTarget__set_precompiled_header_variables
,$(1),$(2),$(3),$(4))
2002 ifeq ($(gb_FULLDEPS
),$(true
))
2003 -include $(call gb_PrecompiledHeader_get_dep_target
,$(3),$(4))
2008 # call gb_LinkTarget__add_precompiled_header_object,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2009 define gb_LinkTarget__add_precompiled_header_object
2011 ifneq ($(BUILDING_PCH_WITH_OBJ
),)
2012 $(call gb_LinkTarget_add_exception_object
,$(1),$(2),,$(4))
2013 $(call gb_CxxObject_get_target
,$(2)) : T_PCH_EXTRA_CXXFLAGS
+= $(gb_PrecompiledHeader_pch_with_obj
)
2016 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
= $(call gb_PrecompiledHeader_get_objectfile
, $(call gb_PrecompiledHeader_get_target
,$(3),$(4)))
2017 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
= $$(PCHOBJEX
)
2021 # 'compiler' set comes only from gb_LinkTarget_set_clang_precompiled_header
2022 # call gb_LinkTarget_set_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename,compiler
2023 define gb_LinkTarget_set_precompiled_header
2024 ifneq ($(gb_ENABLE_PCH
),)
2025 $(call gb_LinkTarget__set_precompiled_header_impl
,$(1),$(2),$(notdir $(2)),$(4))
2026 $(call gb_PrecompiledHeader_generate_rules
,$(notdir $(2)),$(1),$(4),$(2),$(5))
2028 ifneq ($(gb_ENABLE_PCH
)$(BLOCK_PCH
),)
2029 $(call gb_LinkTarget__add_precompiled_header_object
,$(1),$(2),$(notdir $(2)),$(4))
2034 # It seems complicated to forward the clang setting to the PCH rules, so use an extra
2035 # function to set it manually. This variant should be used if gb_LinkTarget_use_clang is used.
2036 # call gb_LinkTarget_set_clang_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename
2037 define gb_LinkTarget_set_clang_precompiled_header
2038 $(call gb_LinkTarget_set_precompiled_header
,$(1),$(2),$(3),$(4),$(LO_CLANG_CXX
))
2041 # call gb_LinkTarget__reuse_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2042 # Use the PCH as if it was LinkTarget's own, but do nothing with the PCH itself, just depend on it.
2043 define gb_LinkTarget__reuse_precompiled_header_impl
2044 $(call gb_LinkTarget__set_precompiled_header_variables
,$(1),$(2),$(3),$(4))
2046 $(call gb_LinkTarget_get_pch_timestamp
,$(4)) : $(call gb_LinkTarget_get_pch_reuse_timestamp
,$(4))
2048 # We need to depend on a special for_reuse target that depends on the linktarget that owns the PCH.
2049 # Depending directly on the PCH could cause that PCH to be built with this linktarget's flags.
2050 $(call gb_LinkTarget_get_pch_reuse_timestamp
,$(4)) : $(call gb_PrecompiledHeader_get_for_reuse_target
,$(3),$(4))
2051 $(call gb_PrecompiledHeader_check_flags
,$(4),$(2),\
2052 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)),\
2053 $(call gb_PrecompiledHeader_get_flags_file
,$(3),$(4)),\
2054 $(gb_PrecompiledHeader_cxxflags_includes
))
2055 $$(call gb_PrecompiledHeader__copy_reuse_files
,$(1),$(3),$(4))
2056 mkdir
-p
$$(dir $$@
) && touch
$$@
2060 # call gb_LinkTarget__add_reuse_precompiled_header_object,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2061 define gb_LinkTarget__add_reuse_precompiled_header_object
2063 ifneq ($(BUILDING_PCH_WITH_OBJ
),)
2064 # We need to link in also the PCH's object file. Again, rely on a special for_reuse target for dependencies.
2065 $(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)))))
2066 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
+= $(2)
2069 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
= $(call gb_PrecompiledHeader_get_objectfile
, $(call gb_PrecompiledHeader_get_target
,$(3),$(4)))
2070 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
= $$(PCHOBJEX
)
2074 # call gb_LinkTarget__reuse_precompiled_header_workarounds,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2075 define gb_LinkTarget__reuse_precompiled_header_workarounds
2076 ifeq ($(COM_IS_CLANG
),TRUE
)
2077 $(call gb_LinkTarget_add_defs
,$(1),$(gb_CXXFLAGS_include
)$(SRCDIR
)/pch
/inc
/clangfix.hxx
)
2078 $(call gb_LinkTarget_add_defs
,$(1),$(gb_CXXFLAGS_no_pch_warnings
))
2080 $(if
$(filter precompiled_system
,$(3)), $(call gb_LinkTarget_add_defs
,$(1),-DBOOST_ALL_NO_LIB
))
2083 # call gb_LinkTarget_reuse_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename
2084 define gb_LinkTarget_reuse_precompiled_header
2085 ifeq ($(gb_DISABLE_PCH_REUSE
),$(false
))
2086 ifneq ($(gb_ENABLE_PCH
),)
2087 $(call gb_LinkTarget__reuse_precompiled_header_impl
,$(1),$(2),$(notdir $(2)),$(4))
2088 $(call gb_LinkTarget__reuse_precompiled_header_workarounds
,$(1),$(2),$(notdir $(2)),$(4))
2090 ifneq ($(gb_ENABLE_PCH
)$(BLOCK_PCH
),)
2091 $(call gb_LinkTarget__add_reuse_precompiled_header_object
,$(1),$(2),$(notdir $(2)),$(4))
2097 # call gb_LinkTarget_use_common_precompiled_header,linktarget,,,linktargetmakefilename
2098 define gb_LinkTarget_use_common_precompiled_header
2099 $(call gb_LinkTarget_reuse_precompiled_header
,$(1),pch
/inc
/pch
/precompiled_system
,,$(4))
2103 # use a header package, possibly from another module
2104 # call gb_LinkTarget_use_package,linktarget,package
2105 define gb_LinkTarget_use_package
2106 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
2107 $(call gb_Package_get_target
,$(strip $(2)))
2108 $(call gb_Package_get_target
,$(strip $(2))): RDEPENDS
+= $(call gb_LinkTarget__get_workdir_linktargetname
,$(1))
2112 # call gb_LinkTarget_use_packages,linktarget,packages
2113 define gb_LinkTarget_use_packages
2114 $(foreach package
,$(2),$(call gb_LinkTarget_use_package
,$(1),$(package
)))
2117 # use a GeneratedPackage, possibly from another module
2118 # call gb_LinkTarget_use_generated_package,linktarget,package
2119 define gb_LinkTarget_use_generated_package
2120 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
2121 $(call gb_GeneratedPackage_get_target
,$(strip $(2)))
2125 # Use sources from unpacked tarball of an external project
2126 # call gb_LinkTarget_use_unpacked,linktarget,unpackedtarget
2127 define gb_LinkTarget_use_unpacked
2128 $(call gb_LinkTarget_get_headers_target
,$(1)) :|
$(call gb_UnpackedTarball_get_final_target
,$(2))
2132 # Use artifacts from ExternalProject (i. e. configure) of an external project
2133 # example in expat: StaticLibrary depends on ExternalProject outcome
2134 # call gb_LinkTarget_use_external_project,linktarget,externalproject,full-dep
2135 define gb_LinkTarget_use_external_project
2136 $(call gb_LinkTarget_get_target
,$(1)) :|
$(call gb_ExternalProject_get_target
,$(2))
2137 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
2138 $(if
$(3),$(call gb_ExternalProject_get_target
,$(2)),$(call gb_UnpackedTarball_get_final_target
,$(2)))
2142 # this forwards to functions that must be defined in RepositoryExternal.mk.
2143 # Automatically forward for libmerged library too when linktarget is merged.
2145 # call gb_LinkTarget_use_external,linktarget,external
2146 define gb_LinkTarget_use_external
2147 $(if
$(filter undefined
,$(origin gb_LinkTarget__use_
$(2))),\
2148 $(error gb_LinkTarget_use_external
: unknown external
: $(2)) \
2150 $(if
$(gb_PARTIAL_BUILD
),,$(if
$(call gb_LinkTarget__is_merged
,$(1)), \
2151 $(call gb_LinkTarget__use_
$(2),$(call gb_Library_get_linktarget
,merged
)))) \
2152 $(call gb_LinkTarget__use_
$(2),$(1)) \
2155 $(call gb_LinkTarget__register_type
,externals
,$(1),$(2))
2159 # $(call gb_LinkTarget_use_externals,library,externals)
2160 gb_LinkTarget_use_externals
= \
2161 $(foreach external
,$(2),$(call gb_LinkTarget_use_external
,$(1),$(external
)))
2163 # call gb_LinkTarget_set_visibility_default,linktarget
2164 define gb_LinkTarget_set_visibility_default
2165 $(call gb_LinkTarget_get_target
,$(1)) : VISIBILITY
:= default
2166 ifneq ($(gb_ENABLE_PCH
),)
2167 ifneq ($(strip $$(PCH_NAME
)),)
2168 $(call gb_PrecompiledHeader_get_target
,$$(PCH_NAME
),$$(PCH_LINKTARGETMAKEFILENAME
)) : VISIBILITY
:= default
2174 # call gb_LinkTarget_set_warnings_not_errors,linktarget
2175 define gb_LinkTarget_set_warnings_not_errors
2176 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_NOT_ERRORS
:= $(true
)
2180 # call gb_LinkTarget_set_warnings_disabled,linktarget
2181 define gb_LinkTarget_set_warnings_disabled
2182 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_DISABLED
:= $(true
)
2186 # call gb_LinkTarget_set_external_code,linktarget
2187 define gb_LinkTarget_set_external_code
2188 $(call gb_LinkTarget_get_target
,$(1)) : EXTERNAL_CODE
:= $(true
)
2192 # Set suffix of C++ files, if different from 'cxx'
2194 # This is useful for external libraries.
2196 # call gb_LinkTarget_set_generated_cxx_suffix,linktarget,used-suffix
2197 define gb_LinkTarget_set_generated_cxx_suffix
2198 gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)) := $(2)
2202 # C/C++ files will be build with Clang (if possible) instead of the default compiler.
2203 # call gb_LinkTarget_use_clang,linktarget,,linktargetmakefilename
2204 define gb_LinkTarget_use_clang
2205 $(call gb_LinkTarget_get_target
,$(1)) : T_CC
:= $(LO_CLANG_CC
)
2206 $(call gb_LinkTarget_get_target
,$(1)) : T_CXX
:= $(LO_CLANG_CXX
)
2207 $(call gb_LinkTarget_get_target
,$(1)) : T_USE_CLANG
:= $(true
)
2208 $(call gb_LinkTarget_get_target
,$(1)) : T_USE_LD
:= $(or
$(CLANG_USE_LD
),$(USE_LD
))
2209 $(call gb_LinkTarget_get_target
,$(1)) : T_LTOFLAGS
:= $(if
$(LO_CLANG_CXX
),$(gb_CLANG_LTOFLAGS
),$(gb_LTOFLAGS
))
2212 # call gb_LinkTarget_use_vclmain,linktarget
2213 define gb_LinkTarget_use_vclmain
2214 $(call gb_LinkTarget_use_static_libraries
,$(1),vclmain
)
2216 endef # gb_LinkTarget_use_vclmain
2218 # Used by URE libraries that need to keep binary compatibility.
2219 # Reset some flags that make sense for our internal libraries but might
2221 # (clang-cl's -Zc:dllexportInlines- would not only be a problem for the URE libraries themselves but
2222 # also for any libraries they depend on. While that does not appear to be a problem for -Zc:inline
2223 # for neither MSVC nor clang-cl, it should not really hurt to also switch that off not only for the
2224 # URE libraries themselves but also for their dependencies.)
2225 # call gb_LinkTarget_set_is_ure_library_or_dependency,linktarget,,linktargetmakefilename
2226 define gb_LinkTarget_set_is_ure_library_or_dependency
2227 $(call gb_LinkTarget_add_cxxflags
,$(1),$(gb_CXXFLAGS_ZCINLINE_OFF
))
2228 ifeq ($(HAVE_DLLEXPORTINLINES
),TRUE
)
2229 $(call gb_LinkTarget_add_cxxflags
,$(1),-Zc
:dllexportInlines
)
2234 gb_LinkTarget__get_plugins_var
= $(call gb_LinkTarget__get_workdir_linktargetname
,$(1))<>PLUGINS
2235 gb_LinkTarget__get_plugins
= $($(call gb_LinkTarget__get_plugins_var
,$(1)))
2236 gb_Library__get_plugins
= $($(call gb_LinkTarget__get_plugins_var
,$(call gb_Library_get_linktarget
,$(1))))
2238 define gb_LinkTarget__add_plugin
2239 $(call gb_LinkTarget__get_plugins_var
,$(1)) += $(2)
2243 # Instead of setting nodep use gb_LinkTarget__set_plugin_for_nodep
2245 # call gb_LinkTarget__set_plugin_for,linktarget,loader,nodep
2246 define gb_LinkTarget__set_plugin_for
2247 ifeq (,$(filter $(1),$(foreach plugin
,$(gb_Library_KNOWNPLUGINS
),$(call gb_Library_get_linktarget
,$(plugin
)))))
2248 $$(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
))
2250 ifneq (,$(filter $(1),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library_get_linktarget
,$(lib
)))))
2251 $$(eval
$$(call gb_Output_error
,Plugins can
't be in mergelibs))
2253 ifeq ($(call gb_LinkTarget__is_build_tool,$(1)),$(true))
2254 $$(eval $$(call gb_Output_error,Plugin support for build tools not implemented))
2257 $(if $(filter $(2),$(gb_Library_KNOWNLOADERS)),,gb_Library_KNOWNLOADERS += $(2))
2258 $(if $(3),,$(call gb_LinkTarget_use_libraries,$(1),$(2),,$(4)))
2262 # call gb_LinkTarget__set_plugin_for_nodep,linktarget,loader
2263 gb_LinkTarget__set_plugin_for_nodep = $(call gb_LinkTarget__set_plugin_for,$(1),$(2),$(true))
2265 # call gb_LinkTarget_add_prejs,linktarget,js_file
2266 define gb_LinkTarget_add_prejs
2267 ifeq (EMSCRIPTEN,$(OS))
2268 $(call gb_LinkTarget_get_target,$(1)) : T_PREJS += $(2)
2269 $(call gb_LinkTarget_get_target,$(1)) : $(2)
2274 # vim: set noet sw=4: