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 GenAsmObject 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 GenAsmObject/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 # GenAsmObject asm compile from | LinkTarget/headers
194 # GenNasmObject nasm compile from | LinkTarget/headers
196 # CxxClrObject C++ CLR compile | LinkTarget/headers
197 # GenCxxClrObject C++ CLR compile from | LinkTarget/headers
200 # AsmObject asm compile | LinkTarget
202 # CObject/dep dependencies these targets generate empty dep files
203 # CxxObject/dep dependencies that are populated upon compile
204 # GenCObject/dep dependencies
205 # GenCxxObject/dep dependencies
206 # ObjCObject/dep dependencies
207 # ObjCxxObject/dep dependencies
208 # GenObjCObject/dep dependencies
209 # GenObjCxxObject/dep dependencies
210 # GenAsmObject/dep dependencies
211 # GenNasmObject/dep dependencies
212 # CxxClrObject/dep dependencies
213 # GenCxxClrObject/dep dependencies
214 # AsmObject/dep dependencies
216 # LinkTarget/headers means gb_LinkTarget_get_headers_target etc.
217 # dependencies prefixed with | are build-order only dependencies
220 # check that objects are only linked into one link target:
221 # multiple linking may cause problems because different link targets may
222 # require different compiler flags
223 define gb_Object__owner
224 $$(if
$$(OBJECTOWNER
),\
225 $$(call gb_Output_error
,fdo
#47246: $(1) is linked in by $$(OBJECTOWNER) $(2)))$(2)
228 # For every object there is a dep file (if gb_FULLDEPS is active).
229 # The dep file depends on the object: the Object__command also updates the
230 # dep file as a side effect.
231 # In the dep file rule just touch it so it's newer than the object.
233 # Setting FORCE_COMPILE allows forcing compilation for specific sources,
234 # usually used to force running a tool on the sources (see compilerplugins/README).
235 # If set, it'll force all considered sources for rebuild. But it's possible
236 # to explicitly specify gbuild build targets where running of the tool will be skipped
237 # (where 'all' means everything, '-' prepended means to not enable, '/' appended means
238 # everything in the directory; there is no ordering, more specific overrides
239 # more general, and disabling takes precedence).
240 # Example: FORCE_COMPILE="all -sw/ -Library_sc"
242 # Detect whether forced compile should be used for the given gbuild target.
243 # enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined]
244 # call gb_LinkTarget__force_compile,linktargetmakefilename
245 gb_LinkTarget__force_compile
= \
246 $(and
$(if
$(filter -$(1),$(FORCE_COMPILE
)),,$(true
)),\
247 $(or
$(gb_Module_CURRENTMODULE_FORCE_COMPILE
),\
248 $(filter $(1),$(FORCE_COMPILE
))))
250 # This one only exists to force .c/.cxx "rebuilds" when running a compiler tool.
251 .PHONY
: force_compile_target
252 force_compile_target
:
253 ifneq ($(FORCE_COMPILE
),)
254 gb_FORCE_COMPILE_TARGET
:= force_compile_target
257 # A tool is run either if FORCE_COMPILE is not set (in that case it's always run,
258 # because the target is not up to date), or if FORCE_COMPILE is set then
259 # the tool is run only if the value of FORCE_COMPILE includes the target.
260 gb_LinkTarget__tool_compile_enabled
= \
261 $(if
$(FORCE_COMPILE
),$(T_FORCE_COMPILE
),$(true
))
265 gb_CObject_get_source
= $(1)/$(2).c
267 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
268 $(call gb_CObject_get_target
,%) : $(call gb_CObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_TARGET
)
269 $(call gb_Output_announce
,$*.c
,$(true
),C
,3)
270 $(call gb_Trace_StartRange
,$*.c
,C
)
271 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CObject__tool_command
,$*,$<,$(COMPILER_PLUGINS
)))
272 $(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
))))
273 $(call gb_Trace_EndRange
,$*.c
,C
)
275 $(call gb_CObject_get_target
,%) : $(call gb_CObject_get_source
,$(SRCDIR
),%)
276 $(call gb_Output_announce
,$*.c
,$(true
),$(if
$(COMPILER_TEST
),C?
,C
),3)
277 $(call gb_Trace_StartRange
,$*.c
,$(if
$(COMPILER_TEST
),C?
,C
))
278 $(call gb_CObject__command_pattern
,$@
,$(T_CFLAGS
) $(T_CFLAGS_APPEND
),$<,$(call gb_CObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),$(T_CC
))
279 $(call gb_Trace_EndRange
,$*.c
,$(if
$(COMPILER_TEST
),C?
,C
))
282 # Note: if the *Object_dep_target does not exist it will be created by
283 # concat-deps as PHONY
284 ifeq ($(gb_FULLDEPS
),$(true
))
286 $(call gb_CObject_get_dep_target
,%) :
287 $(if
$(wildcard $@
),touch
$@
)
294 gb_CxxObject_get_source
= $(1)/$(2).
cxx
296 # Only enable PCH if the PCH_CXXFLAGS and the PCH_DEFS (from the linktarget)
297 # are the same as the T_CXXFLAGS and DEFS we want to use for this object. This
298 # should usually be the case. The DEFS/T_CXXFLAGS would have to be manually
299 # overridden for one object file for them to differ. PCH_CXXFLAGS/PCH_DEFS
300 # should never be overridden on an object -- they should be the same as for the
301 # whole linktarget. In general it should be cleaner to use a static library
302 # compiled with different flags and link that in rather than mixing different
303 # flags in one linktarget. If OBJECT_HAS_EXTRA_CXXFLAGS is set, the object
304 # has explicitly set additional CXXFLAGS, so in that case avoid using the PCH.
305 # T_PCH_EXTRA_CXXFLAGS is used when some object requires extra flags when using
306 # the PCH, but they are intended (gb_PrecompiledHeader_pch_with_obj).
307 define gb_CxxObject__set_pchflags
308 ifneq ($(gb_ENABLE_PCH
),)
309 ifneq ($(strip $$(PCH_NAME
)),)
310 ifeq ($(OBJECT_HAS_EXTRA_CXXFLAGS
),)
311 ifeq ($$(sort $$(PCH_CXXFLAGS
) $$(PCH_DEFS
)),$$(sort $$(T_CXXFLAGS
) $$(T_CXXFLAGS_APPEND
) $$(DEFS
)))
312 $$@
: PCHFLAGS
:= $$(call gb_PrecompiledHeader_get_enableflags
,$$(PCH_NAME
),$$(PCH_LINKTARGETMAKEFILENAME
),$$(PCH_HEADER
)) $$(T_PCH_EXTRA_CXXFLAGS
)
314 $$(warning No precompiled header available for
$$*.
cxx .
)
315 $$(info precompiled header flags
: $$(sort $$(PCH_CXXFLAGS
) $$(PCH_DEFS
)))
316 $$(info . object flags
: $$(sort $$(T_CXXFLAGS
) $$(T_CXXFLAGS_APPEND
) $$(DEFS
)))
317 $$(error Incorrect precompiled header setup or internal gbuild error.
)
325 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
326 $(call gb_CxxObject_get_target
,%) : $(call gb_CxxObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_TARGET
)
327 $(call gb_Output_announce
,$*.
cxx,$(true
),CXX
,3)
328 $(call gb_Trace_StartRange
,$*.
cxx,CXX
)
329 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CxxObject__tool_command
,$*,$<,$(COMPILER_PLUGINS
)))
330 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(if
$(COMPILER_PLUGIN_TOOL
),$(eval
$(gb_CxxObject__set_pchflags
))))
331 $(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
))))
332 $(call gb_Trace_EndRange
,$*.
cxx,CXX
)
334 $(call gb_CxxObject_get_target
,%) : $(call gb_CxxObject_get_source
,$(SRCDIR
),%)
335 $(call gb_Output_announce
,$*.
cxx,$(true
),$(if
$(COMPILER_TEST
),CPT
,CXX
),3)
336 $(call gb_Trace_StartRange
,$*.
cxx,$(if
$(COMPILER_TEST
),CPT
,CXX
))
337 $(eval
$(gb_CxxObject__set_pchflags
))
338 $(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
))
339 $(call gb_Trace_EndRange
,$*.
cxx,$(if
$(COMPILER_TEST
),CPT
,CXX
))
342 ifeq ($(gb_FULLDEPS
),$(true
))
343 $(call gb_CxxObject_get_dep_target
,%) :
344 $(if
$(wildcard $@
),touch
$@
)
351 gb_GenCObject_get_source
= $(WORKDIR
)/$(1).c
353 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
354 $(call gb_GenCObject_get_target
,%) : $(gb_FORCE_COMPILE_TARGET
)
355 $(call gb_Output_announce
,$*.c
,$(true
),C
,3)
356 $(call gb_Trace_StartRange
,$*.c
,C
)
357 test -f
$(call gb_GenCObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenCObject_get_source,$*)" && false
)
358 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CObject__tool_command
,$*,$(call gb_GenCObject_get_source
,$*),$(COMPILER_PLUGINS
)))
359 $(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
))))
360 $(call gb_Trace_EndRange
,$*.c
,C
)
362 $(call gb_GenCObject_get_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 $(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
))
367 $(call gb_Trace_EndRange
,$*.c
,C
)
370 ifeq ($(gb_FULLDEPS
),$(true
))
371 $(dir $(call gb_GenCObject_get_dep_target
,%)).
dir :
372 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
374 $(dir $(call gb_GenCObject_get_dep_target
,%))%/.
dir :
375 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
377 $(call gb_GenCObject_get_dep_target
,%) :
378 $(if
$(wildcard $@
),touch
$@
)
385 gb_GenCxxObject_get_source
= $(WORKDIR
)/$(1).
$(gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(2)))
387 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
388 $(call gb_GenCxxObject_get_target
,%) : $(gb_FORCE_COMPILE_TARGET
)
389 $(call gb_Output_announce
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),$(true
),CXX
,3)
390 $(call gb_Trace_StartRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),CXX
)
391 test -f
$(GEN_CXX_SOURCE
) ||
(echo
"Missing generated source file $(GEN_CXX_SOURCE)" && false
)
392 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CxxObject__tool_command
,$*,$(GEN_CXX_SOURCE
),$(COMPILER_PLUGINS
)))
393 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(if
$(COMPILER_PLUGIN_TOOL
),$(eval
$(gb_CxxObject__set_pchflags
))))
394 $(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
))))
395 $(call gb_Trace_EndRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),CXX
)
397 $(call gb_GenCxxObject_get_target
,%) :
398 $(call gb_Output_announce
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),$(true
),CXX
,3)
399 $(call gb_Trace_StartRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),CXX
)
400 test -f
$(GEN_CXX_SOURCE
) ||
(echo
"Missing generated source file $(GEN_CXX_SOURCE)" && false
)
401 $(eval
$(gb_CxxObject__set_pchflags
))
402 $(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
)
406 ifeq ($(gb_FULLDEPS
),$(true
))
407 $(dir $(call gb_GenCxxObject_get_dep_target
,%)).
dir :
408 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
410 $(dir $(call gb_GenCxxObject_get_dep_target
,%))%/.
dir :
411 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
413 $(call gb_GenCxxObject_get_dep_target
,%) :
414 $(if
$(wildcard $@
),touch
$@
)
419 # GenCxxClrObject class
421 gb_GenCxxClrObject_get_source
= $(WORKDIR
)/$(1).
$(gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(2)))
423 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
424 $(call gb_GenCxxClrObject_get_target
,%) : $(gb_FORCE_COMPILE_TARGET
)
425 $(call gb_Output_announce
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),$(true
),CLR
,3)
426 $(call gb_Trace_StartRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),CLR
)
427 test -f
$(GEN_CXXCLR_SOURCE
) ||
(echo
"Missing generated source file $(GEN_CXXCLR_SOURCE)" && false
)
428 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CxxClrObject__tool_command
,$*,$(GEN_CXXCLR_SOURCE
),$(COMPILER_PLUGINS
)))
429 $(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
),)))
430 $(call gb_Trace_EndRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),CLR
)
432 $(call gb_GenCxxClrObject_get_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 $(call gb_CObject__command_pattern
,$@
,$(T_CXXCLRFLAGS
) $(T_CXXCLRFLAGS_APPEND
),$(GEN_CXXCLR_SOURCE
),$(call gb_GenCxxClrObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
437 $(call gb_Trace_EndRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),CLR
)
440 ifeq ($(gb_FULLDEPS
),$(true
))
441 $(dir $(call gb_GenCxxClrObject_get_dep_target
,%)).
dir :
442 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
444 $(dir $(call gb_GenCxxClrObject_get_dep_target
,%))%/.
dir :
445 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
447 $(call gb_GenCxxClrObject_get_dep_target
,%) :
448 $(if
$(wildcard $@
),touch
$@
)
455 # XXX: This is more complicated than necessary, but we cannot just use
456 # the generated C++ file as the main target, because we need to let the
457 # header depend on that to ensure the header is present before anything
460 gb_YaccTarget_get_source
= $(1)/$(2).y
462 .PHONY
: $(call gb_YaccTarget_get_clean_target
,%)
463 $(call gb_YaccTarget_get_clean_target
,%) :
464 $(call gb_Output_announce
,$*,$(false
),YAC
,3)
465 $(call gb_Helper_abbreviate_dirs
,\
466 rm -f
$(call gb_YaccTarget_get_grammar_target
,$*) $(call gb_YaccTarget_get_header_target
,$*) $(call gb_YaccTarget_get_target
,$*))
468 $(call gb_YaccTarget_get_target
,%) : $(call gb_YaccTarget_get_source
,$(SRCDIR
),%)
469 $(call gb_YaccTarget__command
,$<,$*,$@
,$(call gb_YaccTarget_get_header_target
,$*),$(call gb_YaccTarget_get_grammar_target
,$*))
471 # call gb_YaccTarget_YaccTarget,yacctarget
472 define gb_YaccTarget_YaccTarget
473 $(call gb_YaccTarget_get_grammar_target
,$(1)) : $(call gb_YaccTarget_get_target
,$(1))
475 $(call gb_YaccTarget_get_header_target
,$(1)) : $(call gb_YaccTarget_get_target
,$(1))
482 gb_LexTarget_get_source
= $(1)/$(2).l
484 .PHONY
: $(call gb_LexTarget_get_clean_target
,%)
485 $(call gb_LexTarget_get_clean_target
,%) :
486 $(call gb_Output_announce
,$*,$(false
),LEX
,3)
487 $(call gb_Helper_abbreviate_dirs
,\
488 rm -f
$(call gb_LexTarget_get_scanner_target
,$*) $(call gb_LexTarget_get_target
,$*))
490 $(call gb_LexTarget_get_target
,%) : $(call gb_LexTarget_get_source
,$(SRCDIR
),%)
491 $(call gb_Output_announce
,$*,$(true
),LEX
,3)
492 $(call gb_Trace_StartRange
,$*,LEX
)
493 $(call gb_LexTarget__command
,$<,$*,$@
,$(call gb_LexTarget_get_scanner_target
,$*))
494 $(call gb_Trace_EndRange
,$*,LEX
)
496 # gb_LexTarget_LexTarget(scanner-file)
497 define gb_LexTarget_LexTarget
498 $(call gb_LexTarget_get_scanner_target
,$(1)) : $(call gb_LexTarget_get_target
,$(1))
503 # gb_LexTarget__command(scanner-file, stem-for-message, done-pseudo-target, source-target)
504 define gb_LexTarget__command
505 mkdir
-p
$(dir $(3)) && \
506 $(call gb_Helper_wsl_path
,$(FLEX
) $(T_LEXFLAGS
) -o
$(4) $(1)) && touch
$(3)
513 gb_ObjCxxObject_get_source
= $(1)/$(2).mm
515 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
516 $(call gb_ObjCxxObject_get_target
,%) : $(call gb_ObjCxxObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_TARGET
)
517 $(call gb_Output_announce
,$*.mm
,$(true
),OCX
,3)
518 $(call gb_Trace_StartRange
,$*.mm
,OCX
)
519 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_ObjCxxObject__tool_command
,$*,$<,$(COMPILER_PLUGINS
)))
520 $(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
),)))
521 $(call gb_Trace_EndRange
,$*.mm
,OCX
)
523 $(call gb_ObjCxxObject_get_target
,%) : $(call gb_ObjCxxObject_get_source
,$(SRCDIR
),%)
524 $(call gb_Output_announce
,$*.mm
,$(true
),$(if
$(COMPILER_TEST
),O?X
,OCX
),3)
525 $(call gb_Trace_StartRange
,$*.mm
,$(if
$(COMPILER_TEST
),O?X
,OCX
))
526 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCXXFLAGS
) $(T_OBJCXXFLAGS_APPEND
),$<,$(call gb_ObjCxxObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
527 $(call gb_Trace_EndRange
,$*.mm
,$(if
$(COMPILER_TEST
),O?X
,OCX
))
530 ifeq ($(gb_FULLDEPS
),$(true
))
531 $(dir $(call gb_ObjCxxObject_get_dep_target
,%)).
dir :
532 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
534 $(dir $(call gb_ObjCxxObject_get_dep_target
,%))%/.
dir :
535 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
537 $(call gb_ObjCxxObject_get_dep_target
,%) :
538 $(if
$(wildcard $@
),touch
$@
)
546 gb_ObjCObject_get_source
= $(1)/$(2).m
548 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
549 $(call gb_ObjCObject_get_target
,%) : $(call gb_ObjCObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_TARGET
)
550 $(call gb_Output_announce
,$*.m
,$(true
),OCC
,3)
551 $(call gb_Trace_StartRange
,$*.m
,OCC
)
552 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_ObjCObject__tool_command
,$*,$<,$(COMPILER_PLUGINS
)))
553 $(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
),)))
554 $(call gb_Trace_EndRange
,$*.m
,OCC
)
556 $(call gb_ObjCObject_get_target
,%) : $(call gb_ObjCObject_get_source
,$(SRCDIR
),%)
557 $(call gb_Output_announce
,$*.m
,$(true
),$(if
$(COMPILER_TEST
),O?C
,OCC
),3)
558 $(call gb_Trace_StartRange
,$*.m
,$(if
$(COMPILER_TEST
),O?C
,OCC
))
559 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCFLAGS
) $(T_OBJCFLAGS_APPEND
),$<,$(call gb_ObjCObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
560 $(call gb_Trace_EndRange
,$*.m
,$(if
$(COMPILER_TEST
),O?C
,OCC
))
563 ifeq ($(gb_FULLDEPS
),$(true
))
564 $(dir $(call gb_ObjCObject_get_dep_target
,%)).
dir :
565 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
567 $(dir $(call gb_ObjCObject_get_dep_target
,%))%/.
dir :
568 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
570 $(call gb_ObjCObject_get_dep_target
,%) :
571 $(if
$(wildcard $@
),touch
$@
)
576 # GenObjCObject class
578 gb_GenObjCObject_get_source
= $(WORKDIR
)/$(1).m
580 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
581 $(call gb_GenObjCObject_get_target
,%) : $(gb_FORCE_COMPILE_TARGET
)
582 $(call gb_Output_announce
,$*.m
,$(true
),OCC
,3)
583 $(call gb_Trace_StartRange
,$*.m
,OCC
)
584 test -f
$(call gb_GenObjCObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenObjCObject_get_source,$*)" && false
)
585 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_ObjCObject__tool_command
,$*,$(call gb_GenObjCObject_get_source
,$*),$(COMPILER_PLUGINS
)))
586 $(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
),)))
587 $(call gb_Trace_EndRange
,$*.m
,OCC
)
589 $(call gb_GenObjCObject_get_target
,%) :
590 $(call gb_Output_announce
,$*.m
,$(true
),OCC
,3)
591 $(call gb_Trace_StartRange
,$*.m
,OCC
)
592 test -f
$(call gb_GenObjCObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenObjCObject_get_source,$*)" && false
)
593 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCFLAGS
) $(T_OBJCFLAGS_APPEND
),$(call gb_GenObjCObject_get_source
,$*),$(call gb_GenObjCObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
594 $(call gb_Trace_EndRange
,$*.m
,OCC
)
597 ifeq ($(gb_FULLDEPS
),$(true
))
598 $(dir $(call gb_GenObjCObject_get_dep_target
,%)).
dir :
599 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
601 $(dir $(call gb_GenObjCObject_get_dep_target
,%))%/.
dir :
602 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
604 $(call gb_GenObjCObject_get_dep_target
,%) :
605 $(if
$(wildcard $@
),touch
$@
)
610 # GenObjCxxObject class
612 gb_GenObjCxxObject_get_source
= $(WORKDIR
)/$(1).mm
614 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
615 $(call gb_GenObjCxxObject_get_target
,%) : $(gb_FORCE_COMPILE_TARGET
)
616 $(call gb_Output_announce
,$*.mm
,$(true
),OCX
,3)
617 $(call gb_Trace_StartRange
,$*.mm
,OCX
)
618 test -f
$(call gb_GenObjCxxObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenObjCxxObject_get_source,$*)" && false
)
619 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_ObjCxxObject__tool_command
,$*,$(call gb_GenObjCxxObject_get_source
,$*),$(COMPILER_PLUGINS
)))
620 $(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
),)))
621 $(call gb_Trace_EndRange
,$*.mm
,OCX
)
623 $(call gb_GenObjCxxObject_get_target
,%) :
624 $(call gb_Output_announce
,$*.mm
,$(true
),OCX
,3)
625 $(call gb_Trace_StartRange
,$*.mm
,OCX
)
626 test -f
$(call gb_GenObjCxxObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenObjCxxObject_get_source,$*)" && false
)
627 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCXXFLAGS
) $(T_OBJCXXFLAGS_APPEND
),$(call gb_GenObjCxxObject_get_source
,$*),$(call gb_GenObjCxxObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
628 $(call gb_Trace_EndRange
,$*.mm
,OCX
)
631 ifeq ($(gb_FULLDEPS
),$(true
))
632 $(dir $(call gb_GenObjCxxObject_get_dep_target
,%)).
dir :
633 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
635 $(dir $(call gb_GenObjCxxObject_get_dep_target
,%))%/.
dir :
636 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
638 $(call gb_GenObjCxxObject_get_dep_target
,%) :
639 $(if
$(wildcard $@
),touch
$@
)
645 gb_GenAsmObject_get_source
= $(call gb_AsmObject_get_source
,$(WORKDIR
),$(1))
647 $(call gb_GenAsmObject_get_target
,%) :
648 $(call gb_AsmObject__command
,$@
,$*,$<,$(call gb_GenAsmObject_get_dep_target
,$*))
650 ifeq ($(gb_FULLDEPS
),$(true
))
651 $(dir $(call gb_GenAsmObject_get_dep_target
,%)).
dir :
652 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
654 $(dir $(call gb_GenAsmObject_get_dep_target
,%))%/.
dir :
655 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
657 $(call gb_GenAsmObject_get_dep_target
,%) :
658 $(if
$(wildcard $@
),touch
$@
)
662 # GenNasmObject class
664 gb_GenNasmObject_get_source
= $(WORKDIR
)/$(1)
666 $(call gb_GenNasmObject_get_target
,%) :
667 $(call gb_Output_announce
,$*,$(true
),ASM
,3)
668 $(call gb_Trace_StartRange
,$*,ASM
)
669 test -f
$(call gb_GenNasmObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenNasmObject_get_source,$*)" && false
)
670 mkdir
-p
$(dir $@
) $(dir $(call gb_GenNasmObject_get_dep_target
,$*)) && cd
$(SRCDIR
) && \
671 $(call gb_Helper_wsl_path
,$(NASM
) $(T_NASMFLAGS
) $(T_NASMFLAGS_APPEND
) -I
$(dir $(call gb_GenNasmObject_get_source
,$*)) \
672 $(call gb_GenNasmObject_get_source
,$*) -o
$@
) && \
673 echo
"$@ : $(call gb_GenNasmObject_get_source,$*)" > $(call gb_GenNasmObject_get_dep_target
,$*)
674 $(call gb_Trace_EndRange
,$*,ASM
)
676 ifeq ($(gb_FULLDEPS
),$(true
))
677 $(dir $(call gb_GenNasmObject_get_dep_target
,%)).
dir :
678 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
680 $(dir $(call gb_GenNasmObject_get_dep_target
,%))%/.
dir :
681 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
683 $(call gb_GenNasmObject_get_dep_target
,%) :
684 $(if
$(wildcard $@
),touch
$@
)
692 gb_CxxClrObject_get_source
= $(1)/$(2).
cxx
694 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
695 $(call gb_CxxClrObject_get_target
,%) : $(call gb_CxxClrObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_TARGET
)
696 $(call gb_Output_announce
,$*.
cxx,$(true
),CLR
,3)
697 $(call gb_Trace_StartRange
,$*.
cxx,CLR
)
698 $(if
$(call gb_LinkTarget__tool_compile_enabled
),$(call gb_CxxClrObject__tool_command
,$*,$<,$(COMPILER_PLUGINS
)))
699 $(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
),)))
700 $(call gb_Trace_EndRange
,$*.
cxx,CLR
)
702 $(call gb_CxxClrObject_get_target
,%) : $(call gb_CxxClrObject_get_source
,$(SRCDIR
),%)
703 $(call gb_Output_announce
,$*.
cxx,$(true
),$(if
$(COMPILER_TEST
),C?R
,CLR
),3)
704 $(call gb_Trace_StartRange
,$*.
cxx,$(if
$(COMPILER_TEST
),C?R
,CLR
))
705 $(call gb_CObject__command_pattern
,$@
,$(T_CXXCLRFLAGS
) $(T_CXXCLRFLAGS_APPEND
),$<,$(call gb_CxxClrObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),)
706 $(call gb_Trace_EndRange
,$*.
cxx,$(if
$(COMPILER_TEST
),C?R
,CLR
))
709 ifeq ($(gb_FULLDEPS
),$(true
))
710 $(dir $(call gb_CxxClrObject_get_dep_target
,%)).
dir :
711 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
713 $(dir $(call gb_CxxClrObject_get_dep_target
,%))%/.
dir :
714 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
716 $(call gb_CxxClrObject_get_dep_target
,%) :
717 $(if
$(wildcard $@
),touch
$@
)
724 $(call gb_AsmObject_get_target
,%) : $(call gb_AsmObject_get_source
,$(SRCDIR
),%)
725 $(call gb_AsmObject__command
,$@
,$*,$<,$(call gb_AsmObject_get_dep_target
,$*))
727 ifeq ($(gb_FULLDEPS
),$(true
))
728 $(dir $(call gb_AsmObject_get_dep_target
,%)).
dir :
729 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
731 $(dir $(call gb_AsmObject_get_dep_target
,%))%/.
dir :
732 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
734 $(call gb_AsmObject_get_dep_target
,%) :
735 $(if
$(wildcard $@
),touch
$@
)
742 gb_LinkTarget_DEFAULTDEFS
:= $(gb_GLOBALDEFS
)
744 .PHONY
: $(WORKDIR
)/Clean
/LinkTarget
/%
745 $(WORKDIR
)/Clean
/LinkTarget
/% :
746 $(call gb_Output_announce
,$(LINKTARGETMAKEFILENAME
),$(false
),LNK
,4)
747 RESPONSEFILE
=$(call gb_var2file
,$(shell $(gb_MKTEMP
)),\
748 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
749 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dep_target
,$(object
))) \
750 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dwo_target
,$(object
))) \
751 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
752 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dep_target
,$(object
))) \
753 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dwo_target
,$(object
))) \
754 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_target
,$(object
))) \
755 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dep_target
,$(object
))) \
756 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dwo_target
,$(object
))) \
757 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_target
,$(object
))) \
758 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dep_target
,$(object
))) \
759 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dwo_target
,$(object
))) \
760 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_target
,$(object
))) \
761 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_dep_target
,$(object
))) \
762 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_dwo_target
,$(object
))) \
763 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
764 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dep_target
,$(object
))) \
765 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dwo_target
,$(object
))) \
766 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
767 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dep_target
,$(object
))) \
768 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dwo_target
,$(object
))) \
769 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
770 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dep_target
,$(object
))) \
771 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dwo_target
,$(object
))) \
772 $(foreach object
,$(GENOBJCOBJECTS
),$(call gb_GenObjCObject_get_target
,$(object
))) \
773 $(foreach object
,$(GENOBJCOBJECTS
),$(call gb_GenObjCObject_get_dep_target
,$(object
))) \
774 $(foreach object
,$(GENOBJCOBJECTS
),$(call gb_GenObjCObject_get_dwo_target
,$(object
))) \
775 $(foreach object
,$(GENOBJCXXOBJECTS
),$(call gb_GenObjCxxObject_get_target
,$(object
))) \
776 $(foreach object
,$(GENOBJCXXOBJECTS
),$(call gb_GenObjCxxObject_get_dep_target
,$(object
))) \
777 $(foreach object
,$(GENOBJCXXOBJECTS
),$(call gb_GenObjCxxObject_get_dwo_target
,$(object
))) \
778 $(foreach object
,$(GENASMOBJECTS
),$(call gb_GenAsmObject_get_target
,$(object
))) \
779 $(foreach object
,$(GENASMOBJECTS
),$(call gb_GenAsmObject_get_dep_target
,$(object
))) \
780 $(foreach object
,$(GENASMOBJECTS
),$(call gb_GenAsmObject_get_dwo_target
,$(object
))) \
781 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_target
,$(object
))) \
782 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_dep_target
,$(object
))) \
783 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_dwo_target
,$(object
))) \
784 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_target
,$(object
))) \
785 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_dep_target
,$(object
))) \
786 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_dwo_target
,$(object
))) \
787 $(call gb_LinkTarget_get_target
,$(LINKTARGET
)) \
788 $(call gb_LinkTarget_get_dep_target
,$(LINKTARGET
)) \
789 $(if
$(gb_PARTIAL_BUILD
),, \
790 $(call gb_LinkTarget_get_dep_libraries_target
,$(LINKTARGET
)) \
791 $(call gb_LinkTarget_get_dep_externals_target
,$(LINKTARGET
)) \
792 $(call gb_LinkTarget_get_dep_statics_target
,$(LINKTARGET
)) \
794 $(call gb_LinkTarget_get_headers_target
,$(LINKTARGET
)) \
795 $(call gb_LinkTarget_get_objects_list
,$(LINKTARGET
)) \
796 $(call gb_LinkTarget_get_pch_timestamp
,$(LINKTARGETMAKEFILENAME
)) \
797 $(call gb_LinkTarget_get_pch_reuse_timestamp
,$(LINKTARGETMAKEFILENAME
)) \
800 cat
$${RESPONSEFILE} /dev
/null |
$(if
$(filter WNT
,$(OS
)),env
-i PATH
="$$PATH") xargs
-n
200 rm -fr
&& \
801 rm -f
$${RESPONSEFILE}
804 # cat the deps of all objects in one file, then we need only open that one file
805 # call gb_LinkTarget__command_dep,dep_target,linktargetname
806 define gb_LinkTarget__command_dep
807 $(call gb_Output_announce
,LNK
:$(2).d
,$(true
),DEP
,1)
808 $(call gb_Trace_StartRange
,LNK
:$(2),DEP
)
809 $(call gb_Helper_abbreviate_dirs
,\
810 mkdir
-p
$(dir $(1)) && \
811 RESPONSEFILE
=$(call gb_var2file
,$(shell $(gb_MKTEMP
)),\
812 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dep_target
,$(object
))) \
813 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dep_target
,$(object
))) \
814 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dep_target
,$(object
)))\
815 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dep_target
,$(object
)))\
816 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_dep_target
,$(object
)))\
817 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dep_target
,$(object
)))\
818 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dep_target
,$(object
))) \
819 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dep_target
,$(object
))) \
820 $(foreach object
,$(GENOBJCOBJECTS
),$(call gb_GenObjCObject_get_dep_target
,$(object
))) \
821 $(foreach object
,$(GENOBJCXXOBJECTS
),$(call gb_GenObjCxxObject_get_dep_target
,$(object
))) \
822 $(foreach object
,$(GENASMOBJECTS
),$(call gb_GenAsmObject_get_dep_target
,$(object
))) \
823 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_dep_target
,$(object
))) \
824 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_dep_target
,$(object
))) \
826 SYSTEM_BOOST
="$(SYSTEM_BOOST)" $(call gb_Executable_get_command
,concat-deps
) $${RESPONSEFILE} > $(1)) && \
827 rm -f
$${RESPONSEFILE}
828 $(call gb_Trace_EndRange
,LNK
:$(2),DEP
)
832 # call gb_LinkTarget__command_objectlist,linktarget
833 define gb_LinkTarget__command_objectlist
835 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
836 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
837 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_target
,$(object
))) \
838 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_target
,$(object
))) \
839 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_target
,$(object
))) \
840 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
841 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
842 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
843 $(foreach object
,$(GENOBJCOBJECTS
),$(call gb_GenObjCObject_get_target
,$(object
))) \
844 $(foreach object
,$(GENOBJCXXOBJECTS
),$(call gb_GenObjCxxObject_get_target
,$(object
))) \
845 $(foreach object
,$(GENASMOBJECTS
),$(call gb_GenAsmObject_get_target
,$(object
))) \
846 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_target
,$(object
))) \
847 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_target
,$(object
))) \
849 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),$(shell cat
$(extraobjectlist
))))
853 $(WORKDIR
)/LinkTarget
/%/.
dir :
854 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
856 # Target for the .exports of the shared library, to speed up incremental build.
857 # This deliberately does nothing if the file exists; the file is actually
858 # written in gb_LinkTarget__command_dynamiclink.
859 # Put this pattern rule here so it overrides the one below.
860 # (this is rather ugly: because of % the functions cannot be used)
861 $(WORKDIR
)/LinkTarget
/Library
/%.exports
:
862 $(if
$(wildcard $@
),,mkdir
-p
$(dir $@
) && touch
$@
)
864 # This recipe actually also builds the dep-target as a side-effect, which
865 # is an optimization to reduce incremental build time.
866 # (with exception for concat-dep executable itself which does not exist yet...)
867 $(WORKDIR
)/LinkTarget
/% : $(gb_Helper_MISCDUMMY
)
868 $(call gb_LinkTarget__command_impl
,$@
,$*)
870 # call gb_LinkTarget__make_installed_rule,linktarget
871 define gb_LinkTarget__make_installed_rule
872 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_LinkTarget_get_headers_target
,$(1))
873 $$(call gb_LinkTarget__command_impl
,$(call gb_LinkTarget_get_target
,$(1)),$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)))
877 define gb_LinkTarget__add_linked_libs
878 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
+= $(2)
882 # it's not possible to use a pattern rule for files in INSTDIR because
883 # it would inevitably conflict with the pattern rule for Package
884 # (especially since external libraries are delivered via Package)
885 # call gb_LinkTarget__command_impl,linktargettarget,linktargetname
886 define gb_LinkTarget__command_impl
888 $(if
$(ENABLE_CUSTOMTARGET_COMPONENTS
),$(if
$(gb_PARTIAL_BUILD
),,
889 $(call gb_LinkTarget__command_dep_libraries
,$(call gb_LinkTarget_get_dep_libraries_target
,$(2)).tmp
,$(2))
890 mv
$(call gb_LinkTarget_get_dep_libraries_target
,$(2)).tmp
$(call gb_LinkTarget_get_dep_libraries_target
,$(2))
891 $(call gb_LinkTarget__command_dep_externals
,$(call gb_LinkTarget_get_dep_externals_target
,$(2)).tmp
,$(2))
892 mv
$(call gb_LinkTarget_get_dep_externals_target
,$(2)).tmp
$(call gb_LinkTarget_get_dep_externals_target
,$(2))
893 $(call gb_LinkTarget__command_dep_statics
,$(call gb_LinkTarget_get_dep_statics_target
,$(2)).tmp
,$(2))
894 mv
$(call gb_LinkTarget_get_dep_statics_target
,$(2)).tmp
$(call gb_LinkTarget_get_dep_statics_target
,$(2))))
895 $(if
$(findstring concat-deps
,$(2)),,
896 $(call gb_LinkTarget__command_dep
,$(call gb_LinkTarget_get_dep_target
,$(2)).tmp
,$(2))
897 mv
$(call gb_LinkTarget_get_dep_target
,$(2)).tmp
$(call gb_LinkTarget_get_dep_target
,$(2))))
898 $(if
$(filter $(2),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library__get_workdir_linktargetname
,$(lib
)))),
899 $(if
$(filter $(true
),$(call gb_LinkTarget__is_build_lib
,$(2))),
900 $(call gb_LinkTarget__command
,$(1),$(2)),
901 mkdir
-p
$(dir $(1)) && echo invalid
- merged lib
> $(1)
902 $(if
$(SOVERSIONSCRIPT
),&& echo invalid
- merged lib
> $(WORKDIR
)/LinkTarget
/$(2))),
903 $(if
$(filter-out CompilerTest
,$(TARGETTYPE
)),
904 $(call gb_LinkTarget__command
,$(1),$(2))))
905 $(call gb_LinkTarget__command_objectlist
,$(WORKDIR
)/LinkTarget
/$(2).objectlist
)
908 ifeq ($(gb_FULLDEPS
),$(true
))
909 $(call gb_LinkTarget_get_dep_target
,%) : $(call gb_Executable_get_runtime_dependencies
,concat-deps
)
910 $(call gb_LinkTarget__command_dep
,$@
,$*)
912 $(dir $(call gb_LinkTarget_get_dep_target
,%))/.
dir :
913 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
915 ifeq ($(ENABLE_CUSTOMTARGET_COMPONENTS
),TRUE
)
916 ifeq (,$(gb_PARTIAL_BUILD
))
918 define gb_LinkTarget__static_dep_x_template
920 define gb_LinkTarget__command_dep_
$(1)
921 $$(call gb_Output_announce
,LNK
:$$(2).d.
$(1),$$(true
),DEP
,1)
922 $$(shell mkdir
-p
$$(dir $$(1)))
923 $$(file
>$$(1).tmp
,$$(call gb_LinkTarget__get_all_
$(1),$$(2)))
924 $$(call gb_Helper_replace_if_different_and_touch
,$$(1).tmp
,$$(1))
928 $$(call gb_LinkTarget_get_dep_
$(1)_target
,%) : ;
929 $$(call gb_LinkTarget__command_dep_
$(1),$$@
,$$*)
931 endef # gb_LinkTarget__static_dep_x_template
933 $(eval
$(call gb_LinkTarget__static_dep_x_template
,libraries
))
934 $(eval
$(call gb_LinkTarget__static_dep_x_template
,externals
))
935 $(eval
$(call gb_LinkTarget__static_dep_x_template
,statics
))
937 endif # !gb_PARTIAL_BUILD
938 endif # ENABLE_CUSTOMTARGET_COMPONENTS
941 # Ok, this is some dark voodoo: When declaring a linktarget with
942 # gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the
943 # target. When the rule for the headertarget is executed and SELF does not
944 # match the target name, we are depending on a linktarget that was never
945 # declared. In a full build exclusively in gbuild that should never happen.
946 define gb_LinkTarget__get_headers_check
948 $$(eval
$$(call gb_Output_error
,used LinkTarget
$$* not defined
))
950 $$@
: COMMAND
:= $$(call gb_Helper_abbreviate_dirs
, touch
$$@
)
954 $(WORKDIR
)/Headers
/%/.
dir :
955 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
957 # sadly because of the subdirectories can't have pattern deps on .dir here
958 $(WORKDIR
)/Headers
/% :
959 $(eval
$(gb_LinkTarget__get_headers_check
))
962 # Explanation of some of the targets:
963 # - gb_LinkTarget_get_headers_target is the target that guarantees all headers
964 # from the linked against libraries and the linktargets own generated headers
966 # - gb_LinkTarget_get_target links the objects into a file in WORKDIR.
967 # gb_LinkTarget_get_target depends on gb_LinkTarget_get_headers_target.
968 # gb_LinkTarget_get_target depends additionally on the objects, which in turn
969 # depend build-order only on the gb_LinkTarget_get_headers_target. The build
970 # order-only dependency ensures all headers to be there for compiling and
971 # dependency generation without causing all objects to be rebuild when one
972 # header changes. Only the ones with an explicit dependency in their generated
973 # dependency file will be rebuild.
975 # gb_LinkTarget_get_target is the target that links the objects into a file in
977 # Explanation of some of the variables:
978 # - AUXTARGETS are the additionally generated files that need to be cleaned out
980 # - PCH_CXXFLAGS and PCH_DEFS are the flags that the precompiled headers will
981 # be compiled with. They should never be overridden in a single object
983 # - TARGETTYPE is the type of linktarget as some platforms need very different
984 # command to link different targettypes.
985 # - LIBRARY_X64 is only relevant for building a x64 library on windows.
986 # - PE_X86 is only relevant for building a x86 binaries on Windows.
988 # Since most variables are set on the linktarget and not on the object, the
989 # object learns about these setting via GNU makes scoping of target variables.
990 # Therefore it is important that objects are only directly depended on by the
991 # linktarget. This for example means that you cannot build a single object
992 # alone, because then you would directly depend on the object.
994 # A note about flags: because the overriding the global variables with a target
995 # local variable of the same name is considered obscure, the target local
996 # variables have a T_ prefix.
998 # call gb_LinkTarget_LinkTarget,linktarget,linktargetmakefilename,layer
999 define gb_LinkTarget_LinkTarget
1000 $(call gb_LinkTarget_get_clean_target
,$(1)) : LINKTARGET
:= $(1)
1001 $(call gb_LinkTarget_get_clean_target
,$(1)) : LINKTARGETMAKEFILENAME
:= $(2)
1002 $(call gb_LinkTarget_get_clean_target
,$(1)) : AUXTARGETS
:=
1003 $(call gb_LinkTarget_get_headers_target
,$(1)) : SELF
:= $(call gb_LinkTarget__get_workdir_linktargetname
,$(1))
1004 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
1005 |
$(dir $(call gb_LinkTarget_get_headers_target
,$(1))).
dir \
1006 $(dir $(call gb_LinkTarget_get_target
,$(1))).
dir \
1007 $(dir $(WORKDIR
)/LinkTarget
/$(call gb_LinkTarget__get_workdir_linktargetname
,$(1))).
dir
1008 $(call gb_LinkTarget_get_target
,$(1)) : ILIBTARGET
:=
1009 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1010 $(call gb_LinkTarget_get_target
,$(1)) : COBJECTS
:=
1011 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1012 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
:=
1013 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1014 $(call gb_LinkTarget_get_target
,$(1)) : YACCOBJECT
:=
1015 $(call gb_LinkTarget_get_target
,$(1)) : T_YACCFLAGS
:= $$(gb_LinkTarget_YYACFLAGS
) $(YACCFLAGS
)
1016 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1017 $(call gb_LinkTarget_get_target
,$(1)) : LEXOBJECT
:=
1018 $(call gb_LinkTarget_get_target
,$(1)) : T_LEXFLAGS
:= $$(gb_LinkTarget_LEXFLAGS
) $(LEXFLAGS
)
1019 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1020 $(call gb_LinkTarget_get_target
,$(1)) : OBJCOBJECTS
:=
1021 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1022 $(call gb_LinkTarget_get_target
,$(1)) : OBJCXXOBJECTS
:=
1023 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1024 $(call gb_LinkTarget_get_target
,$(1)) : CXXCLROBJECTS
:=
1025 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1026 $(call gb_LinkTarget_get_target
,$(1)) : ASMOBJECTS
:=
1027 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1028 $(call gb_LinkTarget_get_target
,$(1)) : GENCOBJECTS
:=
1029 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1030 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXOBJECTS
:=
1031 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1032 $(call gb_LinkTarget_get_target
,$(1)) : GENOBJCOBJECTS
:=
1033 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1034 $(call gb_LinkTarget_get_target
,$(1)) : GENASMOBJECTS
:=
1035 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1036 $(call gb_LinkTarget_get_target
,$(1)) : GENNASMOBJECTS
:=
1037 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1038 $(call gb_LinkTarget_get_target
,$(1)) : GENOBJCXXOBJECTS
:=
1039 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1040 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXCLROBJECTS
:=
1041 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS
:= $$(gb_LinkTarget_CFLAGS
)
1042 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS_APPEND
:=
1043 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS
:= $$(gb_LinkTarget_CXXFLAGS
)
1044 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS_APPEND
:=
1045 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
:= $$(gb_LinkTarget_CXXFLAGS
)
1046 $(call gb_LinkTarget_get_target
,$(1)) : OBJECT_HAS_EXTRA_CXXFLAGS
:=
1047 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS
:= $$(gb_LinkTarget_OBJCXXFLAGS
)
1048 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS_APPEND
:=
1049 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS
:= $$(gb_LinkTarget_OBJCFLAGS
)
1050 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS_APPEND
:=
1051 $(call gb_LinkTarget_get_target
,$(1)) : T_NASMFLAGS
:= $$(NAFLAGS
)
1052 $(call gb_LinkTarget_get_target
,$(1)) : T_NASMFLAGS_APPEND
:=
1053 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXCLRFLAGS
:= $$(gb_LinkTarget_CXXCLRFLAGS
)
1054 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXCLRFLAGS_APPEND
:=
1055 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
:= $$(gb_LinkTarget_DEFAULTDEFS
) $(CPPFLAGS
)
1056 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
:= $$(gb_LinkTarget_DEFAULTDEFS
) $(CPPFLAGS
)
1057 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
:= -I
$$(SRCDIR
)/include $$(gb_LinkTarget_INCLUDE
)
1058 $(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))
1059 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
:=
1060 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_STATIC_LIBS
:=
1061 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
:=
1062 $(call gb_LinkTarget_get_target
,$(1)) : T_STDLIBS_CXX
:= $(gb_STDLIBS_CXX
)
1063 $(call gb_LinkTarget_get_target
,$(1)) : TARGETTYPE
:=
1064 $(call gb_LinkTarget_get_target
,$(1)) : LIBRARY_X64
:=
1065 $(call gb_LinkTarget_get_target
,$(1)) : PCH_NAME
:=
1066 $(call gb_LinkTarget_get_target
,$(1)) : PCH_HEADER
:=
1067 $(call gb_LinkTarget_get_target
,$(1)) : PCH_LINKTARGETMAKEFILENAME
:=
1068 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
:=
1069 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
:=
1070 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJNOEX
:=
1071 $(call gb_LinkTarget_get_target
,$(1)) : T_PCH_EXTRA_CXXFLAGS
:=
1072 $(call gb_LinkTarget_get_target
,$(1)) : PE_X86
:=
1073 $(call gb_LinkTarget_get_target
,$(1)) : PDBFILE
:=
1074 $(call gb_LinkTarget_get_target
,$(1)) : TARGETGUI
:=
1075 $(call gb_LinkTarget_get_target
,$(1)) : EXTRAOBJECTLISTS
:=
1076 $(call gb_LinkTarget_get_target
,$(1)) : NATIVERES
:=
1077 $(call gb_LinkTarget_get_target
,$(1)) : VISIBILITY
:=
1078 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_NOT_ERRORS
:=
1079 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_DISABLED
:=
1080 $(call gb_LinkTarget_get_target
,$(1)) : PLUGIN_WARNINGS_AS_ERRORS
:=
1081 $(call gb_LinkTarget_get_target
,$(1)) : EXTERNAL_CODE
:=
1082 $(call gb_LinkTarget_get_target
,$(1)) : SOVERSIONSCRIPT
:=
1083 $(call gb_LinkTarget_get_target
,$(1)) : COMPILER_TEST
:=
1084 $(call gb_LinkTarget_get_target
,$(1)) : T_SYMBOLS
:= $(if
$(call gb_target_symbols_enabled
,$(2)),$(true
),$(false
))
1085 $(call gb_LinkTarget_get_target
,$(1)) : T_FORCE_COMPILE
:= $(if
$(call gb_LinkTarget__force_compile
,$(2)),$(true
),$(false
))
1086 $(call gb_LinkTarget_get_target
,$(1)) : T_CC
:=
1087 $(call gb_LinkTarget_get_target
,$(1)) : T_CXX
:=
1088 $(call gb_LinkTarget_get_target
,$(1)) : T_USE_LD
:= $(USE_LD
)
1089 $(call gb_LinkTarget_get_target
,$(1)) : T_LTOFLAGS
:= $(gb_LTOFLAGS
)
1090 $(call gb_LinkTarget_get_target
,$(1)) : T_PREJS
:=
1092 ifeq ($(gb_FULLDEPS
),$(true
))
1093 ifeq (depcache
:,$(filter depcache
,$(.FEATURES
)):$(gb_PARTIAL_BUILD
))
1094 -includedepcache
$(call gb_LinkTarget_get_dep_target
,$(1))
1096 -include $(call gb_LinkTarget_get_dep_target
,$(1))
1098 $(call gb_LinkTarget_get_dep_target
,$(1)) : COBJECTS
:=
1099 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXOBJECTS
:=
1100 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCOBJECTS
:=
1101 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCXXOBJECTS
:=
1102 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXCLROBJECTS
:=
1103 $(call gb_LinkTarget_get_dep_target
,$(1)) : ASMOBJECTS
:=
1104 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCOBJECTS
:=
1105 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXOBJECTS
:=
1106 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENOBJCOBJECTS
:=
1107 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENOBJCXXOBJECTS
:=
1108 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENASMOBJECTS
:=
1109 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENNASMOBJECTS
:=
1110 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXCLROBJECTS
:=
1111 $(call gb_LinkTarget_get_dep_target
,$(1)) : YACCOBJECTS
:=
1114 gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)) := cxx
1116 # installed linktargets need a rule to build!
1117 $(if
$(findstring $(INSTDIR
),$(1)),$(call gb_LinkTarget__make_installed_rule
,$(1)))
1119 $(call gb_PrecompiledHeader_generate_timestamp_rule
,$(2))
1121 endef # gb_LinkTarget_LinkTarget
1123 # call gb_LinkTarget_set_soversion_script,linktarget,soversionscript
1124 define gb_LinkTarget_set_soversion_script
1125 $(call gb_LinkTarget_get_target
,$(1)) : $(2)
1126 $(call gb_LinkTarget_get_target
,$(1)) : SOVERSIONSCRIPT
:= $(2)
1130 # call gb_LinkTarget_add_defs,linktarget,defines
1131 define gb_LinkTarget_add_defs
1132 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
+= $(2)
1133 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
+= $(2)
1136 # call gb_LinkTarget_add_cflags,linktarget,cflags
1137 define gb_LinkTarget_add_cflags
1138 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS_APPEND
+= $(2)
1141 # call gb_LinkTarget_add_cxxflags,linktarget,cxxflags
1142 define gb_LinkTarget_add_cxxflags
1143 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS_APPEND
+= $(2)
1144 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
+= $(2)
1147 # call gb_LinkTarget_add_objcxxflags,linktarget,objcxxflags
1148 define gb_LinkTarget_add_objcxxflags
1149 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS_APPEND
+= $(2)
1152 # call gb_LinkTarget_add_objcflags,linktarget,objcflags
1153 define gb_LinkTarget_add_objcflags
1154 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS_APPEND
+= $(2)
1158 # call gb_LinkTarget_add_nasmflags,linktarget,nasmflags
1159 define gb_LinkTarget_add_nasmflags
1160 $(call gb_LinkTarget_get_target
,$(1)) : T_NASMFLAGS_APPEND
+= $(2)
1163 # call gb_LinkTarget_add_cxxclrflags,linktarget,cxxclrflags
1164 define gb_LinkTarget_add_cxxclrflags
1165 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXCLRFLAGS_APPEND
+= $(2)
1168 # call gb_LinkTarget__add_include,linktarget,includes
1169 define gb_LinkTarget__add_include
1170 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
+= -I
$(2)
1174 # call gb_LinkTarget__check_srcdir_paths,linktarget,includepaths
1175 define gb_LinkTarget__check_srcdir_paths
1176 $(if
$(filter-out $(wildcard $(2)),$(2)),\
1177 $(call gb_Output_error
,gb_LinkTarget_set_include
: include paths
$(filter-out $(wildcard $(2)),$(2)) do not exist
) \
1181 # call gb_LinkTarget_set_include,linktarget,includes
1182 define gb_LinkTarget_set_include
1183 $(call gb_LinkTarget__check_srcdir_paths
,$(1),\
1184 $(patsubst -I
%,%,$(filter -I
$(SRCDIR
)/%,$(filter-out -I
$(INSTDIR
)/% -I
$(WORKDIR
)/%,$(2)))))
1185 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
:= $(2)
1189 # call gb_LinkTarget_add_ldflags,linktarget,ldflags
1190 define gb_LinkTarget_add_ldflags
1191 $(call gb_LinkTarget_get_target
,$(1)) : T_LDFLAGS
+= $(2)
1195 # real use in RepositoryExternal.mk
1196 # call gb_LinkTarget_set_ldflags,linktarget,ldflags
1197 define gb_LinkTarget_set_ldflags
1198 $(call gb_LinkTarget_get_target
,$(1)) : T_LDFLAGS
:= $(2)
1202 # call gb_LinkTarget_add_libs,linktarget,libs
1203 define gb_LinkTarget_add_libs
1204 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
+= $(2)
1205 $(if
$(call gb_LinkTarget__is_merged
,$(1)),\
1206 $(call gb_Library_get_linktarget_target
,merged
) : T_LIBS
+= $(2))
1207 ifeq ($(ENABLE_CUSTOMTARGET_COMPONENTS
),TRUE
)
1208 $(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)))))
1209 $$(eval
$$(call gb_LinkTarget__get_all_libraries_var
,$(1)) += $(filter-out $(call gb_LinkTarget__get_all_libraries
,$(1)),$(patsubst %,$(gb_LinkTarget__syslib
),$(2))))
1210 ifeq (,$(gb_PARTIAL_BUILD
))
1211 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
+= $(filter-out $(call gb_LinkTarget__get_all_libraries
,$(1)),$(patsubst %,$(gb_LinkTarget__syslib
),$(2)))
1217 # remove platform specific standard libraries for linktarget $(1)
1218 # assumption is that adding these standard libs is always useful, but in very
1219 # exceptional cases this disable method may be used
1220 # call gb_LinkTarget_disable_standard_system_libs,linktarget
1221 define gb_LinkTarget_disable_standard_system_libs
1222 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
:= $$(filter-out $$(gb_STDLIBS
),$$(T_LIBS
))
1223 $(call gb_LinkTarget_get_target
,$(1)) : T_STDLIBS_CXX
:=
1227 # call gb_LinkTarget__use_api,linktarget,api
1228 define gb_LinkTarget__use_api
1229 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(call gb_UnoApiHeadersTarget_get_target
,$(2))
1230 $(call gb_LinkTarget__add_include
,$(1),$(call gb_UnoApiHeadersTarget_get_dir
,$(2)))
1234 # call gb_LinkTarget_use_api,linktarget,apis
1235 define gb_LinkTarget_use_api
1236 $(foreach api
,$(2),$(call gb_LinkTarget__use_api
,$(1),$(api
)))
1240 # call gb_LinkTarget_use_udk_api,linktarget
1241 define gb_LinkTarget_use_udk_api
1242 $(call gb_LinkTarget__use_api
,$(1),udkapi
)
1245 # call gb_LinkTarget_use_sdk_api,linktarget
1246 define gb_LinkTarget_use_sdk_api
1247 $(call gb_LinkTarget__use_api
,$(1),udkapi
)
1248 $(call gb_LinkTarget__use_api
,$(1),offapi
)
1251 # call gb_LinkTarget__use_internal_api_one,linktarget,api,apiprefix
1252 define gb_LinkTarget__use_internal_api_one
1253 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
1254 $(call gb_UnoApiHeadersTarget_get_
$(3)target
,$(2))
1255 $(call gb_LinkTarget__add_include
,$(1),$(call gb_UnoApiHeadersTarget_get_
$(3)dir,$(2)))
1259 # call gb_LinkTarget__use_internal_api,linktarget,apis,apiprefix
1260 define gb_LinkTarget__use_internal_api
1261 $(foreach api
,$(2),$(call gb_LinkTarget__use_internal_api_one
,$(1),$(api
),$(3)))
1265 # call gb_LinkTarget_use_internal_api,linktarget,api
1266 define gb_LinkTarget_use_internal_api
1267 $(call gb_LinkTarget__use_internal_api
,$(1),$(2))
1271 # call gb_LinkTarget_use_internal_bootstrap_api,linktarget,api
1272 define gb_LinkTarget_use_internal_bootstrap_api
1273 $(call gb_LinkTarget__use_internal_api
,$(1),$(2),bootstrap_
)
1277 # call gb_LinkTarget_use_internal_comprehensive_api,linktarget,api
1278 define gb_LinkTarget_use_internal_comprehensive_api
1279 $(call gb_LinkTarget__use_internal_api
,$(1),$(2),comprehensive_
)
1283 define gb_PrintDeps_info
1284 $(info LibraryDep
: $(1) links against
$(2))
1287 # returns $(true), if the target class really calls a linker.
1288 # call gb_LinkTarget_does_real_link,linktarget
1289 gb_LinkTarget_does_real_link
= $(if
$(filter Executable CppunitTest
$(if
$(DISABLE_DYNLOADING
),,Library
), \
1290 $(call gb_LinkTarget__get_workdir_linktargetclass
,$(1))),$(true
))
1292 # avoid problem when a module is built partially but other modules that define
1293 # needed libraries is not yet built: prevent invocation of pattern rule
1294 # for library with invalid parameters by depending on the header target
1295 define gb_LinkTarget__lib_dummy_depend
1296 $(call gb_Library_get_target
,$(1)) :|
$(call gb_Library_get_headers_target
,$(1))
1300 define gb_LinkTarget__generate_all_x_accessors
1301 gb_LinkTarget__get_all_
$(1)_var
= $$(call gb_LinkTarget__get_workdir_linktargetname
,$$(1))<>ALL_
$(2)
1302 gb_LinkTarget__get_all_
$(1) = $$($$(call gb_LinkTarget__get_all_
$(1)_var
,$$(1)))
1303 gb_Library__get_all_
$(1) = $$($$(call gb_LinkTarget__get_all_
$(1)_var
,$$(call gb_Library_get_linktarget
,$$(1))))
1304 gb_Executable__get_all_
$(1) = $$($$(call gb_LinkTarget__get_all_
$(1)_var
,$$(call gb_Executable_get_linktarget
,$$(1))))
1305 gb_ExternalProject__get_all_
$(1) = $$($$(call gb_LinkTarget__get_all_
$(1)_var
,$$(call gb_ExternalProject__get_workdir_linktargetname
,$$(1))))
1306 gb_CppunitTest__get_all_
$(1) = $$($$(call gb_LinkTarget__get_all_
$(1)_var
,$$(call gb_CppunitTest__get_workdir_linktargetname
,$$(1))))
1310 $(eval
$(call gb_LinkTarget__generate_all_x_accessors
,libraries
,LIBRARIES
))
1311 gb_LinkTarget__filter_lo_libraries
= $(filter-out $(gb_LinkTarget__syslib
),$(1))
1312 gb_LinkTarget__get_all_lo_libraries
= $(call gb_LinkTarget__filter_lo_libraries
,$(call gb_LinkTarget__get_all_libraries
,$(1)))
1313 gb_LinkTarget__filter_sys_libraries
= $(filter $(gb_LinkTarget__syslib
),$(1))
1314 gb_LinkTarget__get_all_sys_libraries
= $(call gb_LinkTarget__filter_sys_libraries
,$(call gb_LinkTarget__get_all_libraries
,$(1)))
1315 $(eval
$(call gb_LinkTarget__generate_all_x_accessors
,externals
,EXTERNALS
))
1316 $(eval
$(call gb_LinkTarget__generate_all_x_accessors
,statics
,STATICS
))
1318 # call gb_LinkTarget__register_type,type,linktarget,type list
1319 define gb_LinkTarget__register_type
1320 ifeq ($(ENABLE_CUSTOMTARGET_COMPONENTS
),TRUE
)
1321 ifeq (,$(DISABLE_DYNLOADING
))
1322 $$(error ENABLE_CUSTOMTARGET_COMPONENTS just works with DISABLE_DYNLOADING
)
1324 $(foreach type
,$(3),$(if
$(filter $(type
),$(call gb_LinkTarget__get_all_
$(1),$(2))),, \
1325 $(if
$(gb_DEBUG_STATIC
),$$(info $(call gb_LinkTarget__get_all_
$(1)_var
,$(2)) += $(type
))) \
1326 $$(eval
$(call gb_LinkTarget__get_all_
$(1)_var
,$(2)) += $(type
)) \
1332 # call gb_LinkTarget__use_libraries,linktarget,requestedlibs,actuallibs,linktargetmakefilename
1333 define gb_LinkTarget__use_libraries
1335 # used by bin/module-deps.pl
1336 ifneq ($(ENABLE_PRINT_DEPS
),)
1337 # exclude libraries in Library_merged
1338 ifeq ($(filter $(1),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library_get_linktarget
,$(lib
)))),)
1339 $$(eval
$$(call gb_PrintDeps_info
,$(4),$(3)))
1343 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
+= $(3)
1345 ifeq (,$(DISABLE_DYNLOADING
))
1346 # depend on the exports of the library, not on the library itself
1347 # for faster incremental builds when the ABI is unchanged.
1348 # export files are created from the library, so this also ensures the library exists.
1349 $(foreach lib
,$(call gb_LinkTarget__filter_lo_libraries
,$(3)),$(if
$(filter $(lib
),$(gb_Library_KNOWNLIBS
)), \
1350 $$(eval
$(call gb_LinkTarget_get_target
,$(1)) : $(call gb_Library_get_exports_target
,$(lib
))) \
1353 else # DISABLE_DYNLOADING
1354 # depend on the now-static libraries themself, but only if the target actually links to it
1355 ifneq (,$(call gb_LinkTarget_does_real_link
,$(1)))
1356 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
+= $(call gb_LinkTarget__filter_sys_libraries
,$(3))
1357 $(if
$(filter-out Library
,gb_LinkTarget__get_workdir_linktargetclass
,$(1)), \
1358 $(foreach lib
,$(call gb_LinkTarget__filter_lo_libraries
,$(3)),$(if
$(filter $(lib
),$(gb_Library_KNOWNLIBS
)), \
1359 $$(eval
$(call gb_LinkTarget_get_target
,$(1)) : $(call gb_Library_get_linktarget_target
,$(lib
))) \
1362 endif # DISABLE_DYNLOADING
1364 $(call gb_LinkTarget__register_type
,libraries
,$(1),$(3))
1366 $(foreach lib
,$(call gb_LinkTarget__filter_lo_libraries
,$(2)),$(if
$(filter $(lib
),$(gb_Library_KNOWNLIBS
)), \
1367 $(eval
$(call gb_LinkTarget_get_headers_target
,$(1)) : $(call gb_Library_get_headers_target
,$(lib
))) \
1368 $(call gb_LinkTarget__lib_dummy_depend
,$(lib
)) \
1371 endef # gb_LinkTarget__use_libraries
1373 # libraries which are merged but need to be built for gb_BUILD_HELPER_TOOLS
1374 gb_BUILD_HELPER_LIBS
:= $(foreach lib
, \
1389 , $(call gb_Library__get_workdir_linktargetname
,$(lib
)))
1391 # tools libmerged depends on, so they link against gb_BUILD_HELPER_LIBS
1392 gb_BUILD_HELPER_TOOLS
:= $(foreach exe
,\
1397 , $(call gb_Executable__get_workdir_linktargetname
,$(exe
)))
1399 # call gb_LinkTarget__is_build_lib,linktargetname
1400 define gb_LinkTarget__is_build_lib
1401 $(if
$(filter $(call gb_LinkTarget__get_workdir_linktargetname
,$(1)),$(call gb_BUILD_HELPER_LIBS
)),$(true
))
1404 # call gb_LinkTarget__is_build_tool,linktargetname
1405 define gb_LinkTarget__is_build_tool
1406 $(if
$(filter $(call gb_LinkTarget__get_workdir_linktargetname
,$(1)),$(call gb_BUILD_HELPER_TOOLS
)),$(true
))
1409 define gb_LinkTarget__is_merged
1410 $(filter $(1),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library_get_linktarget
,$(lib
))))
1413 # call gb_LinkTarget_use_libraries,linktarget,libs
1414 define gb_LinkTarget_use_libraries
1415 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS
) $(gb_LinkTarget__syslib
),$(2)))
1416 $$(eval
$$(call gb_Output_info
,currently known libraries are
: $(sort $(gb_Library_KNOWNLIBS
)),ALL
))
1417 $$(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
))
1419 ifneq (,$$(filter $(2),$(gb_Library_KNOWNPLUGINS
)))
1420 ifneq (,$$(filter $(1),$$(foreach plugin
,$(gb_Library_KNOWNPLUGINS
),$(call gb_Library__get_workdir_linktargetname
,$(plugin
)))))
1421 $$(eval
$$(call gb_Output_error
,Cannot link against plugin library
/libraries
'$$(filter $(2),$(gb_Library_KNOWNPLUGINS))'. Only plugins are allowed to do that.
))
1425 ifeq ($(call gb_LinkTarget__is_build_tool
,$(1))$(call gb_LinkTarget__is_build_lib
,$(1)),$(true
))
1426 $(call gb_LinkTarget__use_libraries
,$(1),$(2),$(2),$(4))
1428 # $$(3) = Always just depend on non-merged libs. If any dependency is merged, but you aren't, also depend on "merged".
1429 $(call gb_LinkTarget__use_libraries
,$(1),$(2),$(strip \
1430 $(filter-out $(gb_MERGEDLIBS
),$(2)) \
1431 $(if
$(filter $(gb_MERGEDLIBS
),$(2)),$(if
$(call gb_LinkTarget__is_merged
,$(1)),,merged
)) \
1437 # avoid problem when a module is built partially but other modules that define
1438 # needed static libraries is not yet built: prevent invocation of pattern rule
1439 # for static library with invalid parameters by depending on the header target
1440 define gb_LinkTarget__static_lib_dummy_depend
1441 $(call gb_StaticLibrary_get_target
,$(1)) :| \
1442 $(call gb_StaticLibrary_get_headers_target
,$(1))
1446 # for a StaticLibrary, dependent libraries are not actually linked in
1447 # call gb_LinkTarget_use_static_libraries,linktarget,staticlibs
1448 define gb_LinkTarget_use_static_libraries
1449 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_STATIC_LIBS
+= $$(if
$$(filter-out StaticLibrary
,$$(TARGETTYPE
)),$(2))
1450 $(if
$(call gb_LinkTarget__is_merged
,$(1)),\
1451 $(call gb_Library_get_linktarget_target
,merged
) : \
1452 LINKED_STATIC_LIBS
+= $$(if
$$(filter-out StaticLibrary
,$$(TARGETTYPE
)),$(2)))
1454 # depend on the static libraries, but only if the target actually links to it
1455 ifneq (,$(call gb_LinkTarget_does_real_link
,$(1)))
1456 # make has a size limit for the prerequisites string, which will be exceeded for some larger static links,
1457 # like soffice.bin, but there seems to be no limit for makefile lines...
1458 $(foreach lib
,$(2), \
1459 $$(eval
$(call gb_LinkTarget_get_target
,$(1)): $(call gb_StaticLibrary_get_linktarget_target
,$(lib
))))
1462 $(call gb_LinkTarget__register_type
,statics
,$(1),$(2))
1464 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
1465 $(foreach lib
,$(2),$(call gb_StaticLibrary_get_headers_target
,$(lib
)))
1466 $(foreach lib
,$(2),$(call gb_LinkTarget__static_lib_dummy_depend
,$(lib
)))
1468 endef # gb_LinkTarget_use_static_libraries
1470 # call gb_LinkTarget_add_cobject,linktarget,sourcefile,cflags,linktargetmakefilename
1471 define gb_LinkTarget_add_cobject
1472 $(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)))))
1473 $(call gb_LinkTarget_get_target
,$(1)) : COBJECTS
+= $(2)
1474 $(call gb_LinkTarget_get_clean_target
,$(1)) : COBJECTS
+= $(2)
1476 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CObject_get_target
,$(2))
1477 $(call gb_CObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1478 $(call gb_CObject_get_target
,$(2)) : T_CFLAGS
+= $(call gb_LinkTarget__get_cflags
,$(4)) $(3)
1479 $(call gb_CObject_get_target
,$(2)) : \
1480 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1482 ifeq ($(gb_FULLDEPS
),$(true
))
1483 $(call gb_LinkTarget_get_dep_target
,$(1)) : COBJECTS
+= $(2)
1484 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CObject_get_dep_target
,$(2))
1485 $(call gb_CObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CObject_get_dep_target
,$(2))).
dir
1486 $(call gb_CObject_get_target
,$(2)) :|
$(dir $(call gb_CObject_get_dep_target
,$(2))).
dir
1491 # call gb_LinkTarget_add_cxxobject_internal,linktarget,sourcefile,cxxflags,linktargetmakefilename,exceptionflags
1492 # The purpose of the exceptionflags extra argument is to differentiate between usage that just needs
1493 # exception flags and usage that adds other flags. Using a PCH requires the same cxxflags as the ones used
1494 # to create the PCH, so non-empty cxxflags here mean the object cannot use the PCH, and the add_exception_cxxobject
1495 # variant passes the necessary flags by setting the extra argument.
1496 define gb_LinkTarget_add_cxxobject_internal
1497 $(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)))))
1498 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
+= $(2)
1499 $(call gb_LinkTarget_get_clean_target
,$(1)) : CXXOBJECTS
+= $(2)
1501 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CxxObject_get_target
,$(2))
1502 $(call gb_CxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1503 $(call gb_CxxObject_get_target
,$(2)) : T_CXXFLAGS
+= $(call gb_LinkTarget__get_cxxflags
,$(4)) $(3) $(5)
1504 $(call gb_CxxObject_get_target
,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS
:= $(if
$(strip $(3)),1)
1505 $(call gb_CxxObject_get_target
,$(2)) : \
1506 OBJECTOWNER
:= $(if
$(6),,$(call gb_Object__owner
,$(2),$(1)))
1507 ifneq ($(gb_ENABLE_PCH
),)
1509 $(call gb_CxxObject_get_target
,$(2)) : $(call gb_LinkTarget_get_pch_timestamp
,$(4))
1513 ifeq ($(gb_FULLDEPS
),$(true
))
1514 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXOBJECTS
+= $(2)
1515 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CxxObject_get_dep_target
,$(2))
1516 $(call gb_CxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CxxObject_get_dep_target
,$(2))).
dir
1517 $(call gb_CxxObject_get_target
,$(2)) :|
$(dir $(call gb_CxxObject_get_dep_target
,$(2))).
dir
1522 # call gb_LinkTarget_add_cxxobject,linktarget,sourcefile,cxxflags,linktargetmakefilename
1523 define gb_LinkTarget_add_cxxobject
1524 $(call gb_LinkTarget_add_cxxobject_internal
,$(1),$(2),$(3),$(4))
1527 # call gb_LinkTarget_add_objcobject,linktarget,sourcefile,objcflags,linktargetmakefilename
1528 define gb_LinkTarget_add_objcobject
1529 $(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)))))
1530 $(call gb_LinkTarget_get_target
,$(1)) : OBJCOBJECTS
+= $(2)
1531 $(call gb_LinkTarget_get_clean_target
,$(1)) : OBJCOBJECTS
+= $(2)
1533 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_ObjCObject_get_target
,$(2))
1534 $(call gb_ObjCObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1535 $(call gb_ObjCObject_get_target
,$(2)) : T_OBJCFLAGS
+= $(call gb_LinkTarget__get_objcflags
,$(4)) $(3)
1536 $(call gb_ObjCObject_get_target
,$(2)) : \
1537 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1539 ifeq ($(gb_FULLDEPS
),$(true
))
1540 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCOBJECTS
+= $(2)
1541 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_ObjCObject_get_dep_target
,$(2))
1542 $(call gb_ObjCObject_get_dep_target
,$(2)) :|
$(dir $(call gb_ObjCObject_get_dep_target
,$(2))).
dir
1543 $(call gb_ObjCObject_get_target
,$(2)) :|
$(dir $(call gb_ObjCObject_get_dep_target
,$(2))).
dir
1548 # call gb_LinkTarget_add_objcxxobject,linktarget,sourcefile,objcxxflags,linktargetmakefilename
1549 define gb_LinkTarget_add_objcxxobject
1550 $(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)))))
1551 $(call gb_LinkTarget_get_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
1552 $(call gb_LinkTarget_get_clean_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
1554 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_ObjCxxObject_get_target
,$(2))
1555 $(call gb_ObjCxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1556 $(call gb_ObjCxxObject_get_target
,$(2)) : T_OBJCXXFLAGS
+= $(call gb_LinkTarget__get_objcxxflags
,$(4)) $(3)
1557 $(call gb_ObjCxxObject_get_target
,$(2)) : \
1558 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1560 ifeq ($(gb_FULLDEPS
),$(true
))
1561 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
1562 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_ObjCxxObject_get_dep_target
,$(2))
1563 $(call gb_ObjCxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_ObjCxxObject_get_dep_target
,$(2))).
dir
1564 $(call gb_ObjCxxObject_get_target
,$(2)) :|
$(dir $(call gb_ObjCxxObject_get_dep_target
,$(2))).
dir
1569 # call gb_LinkTarget_add_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
1570 define gb_LinkTarget_add_cxxclrobject
1571 $(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)))))
1572 $(call gb_LinkTarget_get_target
,$(1)) : CXXCLROBJECTS
+= $(2)
1573 $(call gb_LinkTarget_get_clean_target
,$(1)) : CXXCLROBJECTS
+= $(2)
1575 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CxxClrObject_get_target
,$(2))
1576 $(call gb_CxxClrObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1577 $(call gb_CxxClrObject_get_target
,$(2)) : T_CXXCLRFLAGS
+= $(call gb_LinkTarget__get_cxxclrflags
,$(4)) $(3)
1578 $(call gb_CxxClrObject_get_target
,$(2)) : \
1579 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1581 ifeq ($(gb_FULLDEPS
),$(true
))
1582 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXCLROBJECTS
+= $(2)
1583 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CxxClrObject_get_dep_target
,$(2))
1584 $(call gb_CxxClrObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CxxClrObject_get_dep_target
,$(2))).
dir
1585 $(call gb_CxxClrObject_get_target
,$(2)) :|
$(dir $(call gb_CxxClrObject_get_dep_target
,$(2))).
dir
1590 # call gb_LinkTarget_add_asmobject,linktarget,sourcefile
1591 define gb_LinkTarget_add_asmobject
1592 $(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)))))
1593 $(call gb_LinkTarget_get_target
,$(1)) : ASMOBJECTS
+= $(2)
1594 $(call gb_LinkTarget_get_clean_target
,$(1)) : ASMOBJECTS
+= $(2)
1596 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_AsmObject_get_target
,$(2))
1597 $(call gb_AsmObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1598 $(call gb_AsmObject_get_target
,$(2)) : \
1599 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1601 ifeq ($(gb_FULLDEPS
),$(true
))
1602 $(call gb_LinkTarget_get_dep_target
,$(1)) : ASMOBJECTS
+= $(2)
1603 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_AsmObject_get_dep_target
,$(2))
1604 $(call gb_AsmObject_get_dep_target
,$(2)) :|
$(dir $(call gb_AsmObject_get_dep_target
,$(2))).
dir
1605 $(call gb_AsmObject_get_target
,$(2)) :|
$(dir $(call gb_AsmObject_get_dep_target
,$(2))).
dir
1610 # call gb_LinkTarget_add_generated_c_object,linktarget,sourcefile,cflags,linktargetmakefilename
1611 define gb_LinkTarget_add_generated_c_object
1612 $(call gb_LinkTarget_get_target
,$(1)) : GENCOBJECTS
+= $(2)
1613 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCOBJECTS
+= $(2)
1615 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCObject_get_target
,$(2))
1616 $(call gb_GenCObject_get_target
,$(2)) : $(call gb_GenCObject_get_source
,$(2))
1617 # Often gb_GenCObject_get_source does not have its own rule and is only a byproduct.
1618 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1619 $(call gb_GenCObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1620 $(call gb_GenCObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1621 $(call gb_GenCObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1622 $(call gb_GenCObject_get_target
,$(2)) : T_CFLAGS
+= $(call gb_LinkTarget__get_cflags
,$(4)) $(3)
1623 $(call gb_GenCObject_get_target
,$(2)) : \
1624 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1626 ifeq ($(gb_FULLDEPS
),$(true
))
1627 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCOBJECTS
+= $(2)
1628 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCObject_get_dep_target
,$(2))
1629 $(call gb_GenCObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCObject_get_dep_target
,$(2))).
dir
1630 $(call gb_GenCObject_get_target
,$(2)) :|
$(dir $(call gb_GenCObject_get_dep_target
,$(2))).
dir
1635 # call gb_LinkTarget_add_generated_cxx_object_internal,linktarget,sourcefile,cxxflags,linktargetmakefilename,exceptionflags
1636 define gb_LinkTarget_add_generated_cxx_object_internal
1637 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1638 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1640 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCxxObject_get_target
,$(2))
1641 $(call gb_GenCxxObject_get_target
,$(2)) : $(call gb_GenCxxObject_get_source
,$(2),$(1))
1642 # Often gb_GenCxxObject_get_source does not have its own rule and is only a byproduct.
1643 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1644 $(call gb_GenCxxObject_get_source
,$(2),$(1)) : |
$(gb_Helper_MISCDUMMY
)
1645 $(call gb_GenCxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1646 $(call gb_GenCxxObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1647 $(call gb_GenCxxObject_get_target
,$(2)) : T_CXXFLAGS
+= $(call gb_LinkTarget__get_cxxflags
,$(4)) $(3) $(5)
1648 $(call gb_GenCxxObject_get_target
,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS
:= $(if
$(strip $(3)),1)
1649 $(call gb_GenCxxObject_get_target
,$(2)) : \
1650 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1651 $(call gb_GenCxxObject_get_target
,$(2)) : GEN_CXX_SOURCE
:= $(call gb_GenCxxObject_get_source
,$(2),$(1))
1652 ifneq ($(gb_ENABLE_PCH
),)
1653 $(call gb_GenCxxObject_get_target
,$(2)) : $(call gb_LinkTarget_get_pch_timestamp
,$(4))
1656 ifeq ($(gb_FULLDEPS
),$(true
))
1657 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1658 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCxxObject_get_dep_target
,$(2))
1659 $(call gb_GenCxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCxxObject_get_dep_target
,$(2))).
dir
1660 $(call gb_GenCxxObject_get_target
,$(2)) :|
$(dir $(call gb_GenCxxObject_get_dep_target
,$(2))).
dir
1665 # call gb_LinkTarget_add_generated_cxx_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1666 define gb_LinkTarget_add_generated_cxx_object
1667 $(call gb_LinkTarget_add_generated_cxx_object_internal
,$(1),$(2),$(3),$(4))
1670 # call gb_LinkTarget_add_generated_objc_object,linktarget,sourcefile,cflags,linktargetmakefilename
1671 define gb_LinkTarget_add_generated_objc_object
1672 $(call gb_LinkTarget_get_target
,$(1)) : GENOBJCOBJECTS
+= $(2)
1673 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENOBJCOBJECTS
+= $(2)
1675 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenObjCObject_get_target
,$(2))
1676 $(call gb_GenObjCObject_get_target
,$(2)) : $(call gb_GenObjCObject_get_source
,$(2))
1677 # Often gb_GenObjCObject_get_source does not have its own rule and is only a byproduct.
1678 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1679 $(call gb_GenObjCObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1680 $(call gb_GenObjCObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1681 $(call gb_GenObjCObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1682 $(call gb_GenObjCObject_get_target
,$(2)) : T_OBJCFLAGS
+= $(call gb_LinkTarget__get_objcflags
,$(4)) $(3)
1683 $(call gb_GenObjCObject_get_target
,$(2)) : \
1684 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1686 ifeq ($(gb_FULLDEPS
),$(true
))
1687 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENOBJCOBJECTS
+= $(2)
1688 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenObjCObject_get_dep_target
,$(2))
1689 $(call gb_GenObjCObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenObjCObject_get_dep_target
,$(2))).
dir
1690 $(call gb_GenObjCObject_get_target
,$(2)) :|
$(dir $(call gb_GenObjCObject_get_dep_target
,$(2))).
dir
1695 # call gb_LinkTarget_add_generated_asm_object,linktarget,sourcefile,asmflags,linktargetmakefilename
1696 define gb_LinkTarget_add_generated_asm_object
1697 $(call gb_LinkTarget_get_target
,$(1)) : GENASMOBJECTS
+= $(2)
1698 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENASMOBJECTS
+= $(2)
1700 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenAsmObject_get_target
,$(2))
1701 $(call gb_GenAsmObject_get_target
,$(2)) : $(call gb_GenAsmObject_get_source
,$(2))
1702 # Often gb_GenAsmObject_get_source does not have its own rule and is only a byproduct.
1703 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1704 $(call gb_GenAsmObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1705 $(call gb_GenAsmObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1706 $(call gb_GenAsmObject_get_target
,$(2)) : T_ASMFLAGS
+= $(call gb_LinkTarget__get_asmflags
,$(4)) $(3)
1707 $(call gb_GenAsmObject_get_target
,$(2)) : \
1708 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1710 ifeq ($(gb_FULLDEPS
),$(true
))
1711 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENASMOBJECTS
+= $(2)
1712 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenAsmObject_get_dep_target
,$(2))
1713 $(call gb_GenAsmObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenAsmObject_get_dep_target
,$(2))).
dir
1714 $(call gb_GenAsmObject_get_target
,$(2)) :|
$(dir $(call gb_GenAsmObject_get_dep_target
,$(2))).
dir
1719 # call gb_LinkTarget_add_generated_nasm_object,linktarget,sourcefile,nasmflags,linktargetmakefilename
1720 define gb_LinkTarget_add_generated_nasm_object
1721 $(call gb_LinkTarget_get_target
,$(1)) : GENNASMOBJECTS
+= $(2)
1722 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENNASMOBJECTS
+= $(2)
1724 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenNasmObject_get_target
,$(2))
1725 $(call gb_GenNasmObject_get_target
,$(2)) : $(call gb_GenNasmObject_get_source
,$(2))
1726 # Often gb_GenNasmObject_get_source does not have its own rule and is only a byproduct.
1727 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1728 $(call gb_GenNasmObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1729 $(call gb_GenNasmObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1730 $(call gb_GenNasmObject_get_target
,$(2)) : T_NASMFLAGS
+= $(call gb_LinkTarget__get_nasmflags
,$(4)) $(3)
1731 $(call gb_GenNasmObject_get_target
,$(2)) : \
1732 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1734 ifeq ($(gb_FULLDEPS
),$(true
))
1735 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENNASMOBJECTS
+= $(2)
1736 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenNasmObject_get_dep_target
,$(2))
1737 $(call gb_GenNasmObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenNasmObject_get_dep_target
,$(2))).
dir
1738 $(call gb_GenNasmObject_get_target
,$(2)) :|
$(dir $(call gb_GenNasmObject_get_dep_target
,$(2))).
dir
1743 # call gb_LinkTarget_add_generated_objcxx_object,linktarget,sourcefile,cflags,linktargetmakefilename
1744 define gb_LinkTarget_add_generated_objcxx_object
1745 $(call gb_LinkTarget_get_target
,$(1)) : GENOBJCXXOBJECTS
+= $(2)
1746 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENOBJCXXOBJECTS
+= $(2)
1748 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenObjCxxObject_get_target
,$(2))
1749 $(call gb_GenObjCxxObject_get_target
,$(2)) : $(call gb_GenObjCxxObject_get_source
,$(2))
1750 # Often gb_GenObjCxxObject_get_source does not have its own rule and is only a byproduct.
1751 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1752 $(call gb_GenObjCxxObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1753 $(call gb_GenObjCxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1754 $(call gb_GenObjCxxObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1755 $(call gb_GenObjCxxObject_get_target
,$(2)) : T_OBJCXXFLAGS
+= $(call gb_LinkTarget__get_objcxxflags
,$(4)) $(3)
1756 $(call gb_GenObjCxxObject_get_target
,$(2)) : \
1757 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1759 ifeq ($(gb_FULLDEPS
),$(true
))
1760 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENOBJCXXOBJECTS
+= $(2)
1761 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenObjCxxObject_get_dep_target
,$(2))
1762 $(call gb_GenObjCxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenObjCxxObject_get_dep_target
,$(2))).
dir
1763 $(call gb_GenObjCxxObject_get_target
,$(2)) :|
$(dir $(call gb_GenObjCxxObject_get_dep_target
,$(2))).
dir
1768 # call gb_LinkTarget_add_generated_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
1769 define gb_LinkTarget_add_generated_cxxclrobject
1770 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXCLROBJECTS
+= $(2)
1771 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCXXCLROBJECTS
+= $(2)
1773 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCxxClrObject_get_target
,$(2))
1774 $(call gb_GenCxxClrObject_get_target
,$(2)) : $(call gb_GenCxxClrObject_get_source
,$(2),$(1))
1775 $(call gb_GenCxxClrObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1776 $(call gb_GenCxxClrObject_get_target
,$(2)) : T_CXXCLRFLAGS
+= $(call gb_LinkTarget__get_cxxclrflags
,$(4)) $(3)
1777 $(call gb_GenCxxClrObject_get_target
,$(2)) : \
1778 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1779 $(call gb_GenCxxClrObject_get_target
,$(2)) : GEN_CXXCLR_SOURCE
:= $(call gb_GenCxxClrObject_get_source
,$(2),$(1))
1781 ifeq ($(gb_FULLDEPS
),$(true
))
1782 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXCLROBJECTS
+= $(2)
1783 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCxxClrObject_get_dep_target
,$(2))
1784 $(call gb_GenCxxClrObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCxxClrObject_get_dep_target
,$(2))).
dir
1785 $(call gb_GenCxxClrObject_get_target
,$(2)) :|
$(dir $(call gb_GenCxxClrObject_get_dep_target
,$(2))).
dir
1790 # Add a bison grammar to the build.
1791 # call gb_LinkTarget_add_grammar,linktarget,yaccfile,cxxflags,linktargetmakefilename
1792 define gb_LinkTarget_add_grammar
1793 $(call gb_YaccTarget_YaccTarget
,$(2))
1794 $(call gb_LinkTarget_add_generated_exception_object
,$(1),YaccTarget
/$(2),$(3) $(if
$(filter GCC
,$(COM
)),-Wno-unused-macros
),$(4))
1795 $(call gb_GenCxxObject_get_target
,YaccTarget
/$(2)): PLUGIN_WARNINGS_AS_ERRORS
:= $(true
)
1796 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_YaccTarget_get_clean_target
,$(2))
1797 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(call gb_YaccTarget_get_header_target
,$(2))
1798 $(call gb_LinkTarget__add_include
,$(1),$(dir $(call gb_YaccTarget_get_header_target
,$(2))))
1802 # Add bison grammars to the build.
1803 # call gb_LinkTarget_add_grammars,linktarget,yaccfiles,cxxflags,linktargetmakefilename
1804 define gb_LinkTarget_add_grammars
1805 $(foreach grammar
,$(2),$(call gb_LinkTarget_add_grammar
,$(1),$(grammar
),$(3),$(4)))
1808 # Add a flex scanner to the build.
1809 # call gb_LinkTarget_add_scanner,linktarget,lexfile,cxxflags,linktargetmakefilename
1810 define gb_LinkTarget_add_scanner
1811 $(call gb_LexTarget_LexTarget
,$(2))
1812 $(call gb_LinkTarget_add_generated_exception_object
,$(1),LexTarget
/$(2),$(3) $(if
$(filter GCC
,$(COM
)),-Wno-unused-macros
),$(4))
1813 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_LexTarget_get_clean_target
,$(2))
1817 # Add flex scanners to the build.
1818 # call gb_LinkTarget_add_scanners,linktarget,lexfiles,cxxflags,linktargetmakefilename
1819 define gb_LinkTarget_add_scanners
1820 $(foreach scanner
,$(2),$(call gb_LinkTarget_add_scanner
,$(1),$(scanner
),$(3),$(4)))
1824 # call gb_LinkTarget_add_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1825 define gb_LinkTarget_add_exception_object
1826 $(call gb_LinkTarget_add_cxxobject_internal
,$(1),$(2),$(3),$(4),$(gb_LinkTarget_EXCEPTIONFLAGS
))
1829 # call gb_LinkTarget__use_linktarget_objects,linktarget,linktargets
1830 define gb_LinkTarget__use_linktarget_objects
1831 $(call gb_LinkTarget_get_target
,$(1)) : $(foreach linktarget
,$(2),$(call gb_LinkTarget_get_target
,$(linktarget
)))
1833 $(call gb_LinkTarget_get_target
,$(1)) : EXTRAOBJECTLISTS
+= $(foreach linktarget
,$(2),$(call gb_LinkTarget_get_objects_list
,$(linktarget
)))
1838 # call gb_LinkTarget_use_library_objects,linktarget,libs
1839 define gb_LinkTarget_use_library_objects
1840 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS
),$(2)))
1841 $$(eval
$$(call gb_Output_info
,currently known libraries are
: $(sort $(gb_Library_KNOWNLIBS
)),ALL
))
1842 $$(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
))
1844 $(call gb_LinkTarget__use_linktarget_objects
,$(1),$(foreach lib
,$(2),$(call gb_Library_get_linktarget
,$(lib
))))
1845 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
1846 $(foreach lib
,$(2),$(call gb_Library_get_headers_target
,$(lib
)))
1850 # call gb_LinkTarget_use_executable_objects,linktarget,exes
1851 define gb_LinkTarget_use_executable_objects
1852 $(call gb_LinkTarget__use_linktarget_objects
,$(1),$(foreach exe
,$(2),$(call gb_Executable_get_linktarget
,$(exe
))))
1856 # call gb_LinkTarget_add_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1857 define gb_LinkTarget_add_cobjects
1858 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cobject
,$(1),$(obj
),$(3),$(4)))
1861 # call gb_LinkTarget_add_cxxobjects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1862 define gb_LinkTarget_add_cxxobjects
1863 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cxxobject
,$(1),$(obj
),$(3),$(4)))
1866 # call gb_LinkTarget_add_objcobjects,linktarget,sourcefiles,objcflags,linktargetmakefilename
1867 define gb_LinkTarget_add_objcobjects
1868 $(foreach obj
,$(2),$(call gb_LinkTarget_add_objcobject
,$(1),$(obj
),$(3),$(4)))
1871 # call gb_LinkTarget_add_objcxxobjects,linktarget,sourcefiles,objcxxflags,linktargetmakefilename
1872 define gb_LinkTarget_add_objcxxobjects
1873 $(foreach obj
,$(2),$(call gb_LinkTarget_add_objcxxobject
,$(1),$(obj
),$(3),$(4)))
1876 # call gb_LinkTarget_add_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename
1877 define gb_LinkTarget_add_cxxclrobjects
1878 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cxxclrobject
,$(1),$(obj
),$(3),$(4)))
1881 # call gb_LinkTarget_add_asmobjects,linktarget,sourcefiles,asmflags,linktargetmakefilename
1882 define gb_LinkTarget_add_asmobjects
1883 $(foreach obj
,$(2),$(call gb_LinkTarget_add_asmobject
,$(1),$(obj
),$(3),$(4)))
1886 # call gb_LinkTarget_add_exception_objects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1887 define gb_LinkTarget_add_exception_objects
1888 $(foreach obj
,$(2),$(call gb_LinkTarget_add_exception_object
,$(1),$(obj
),$(3),$(4)))
1891 #only useful for building x64 libraries on windows
1892 # call gb_LinkTarget_add_x64_generated_exception_objects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1893 define gb_LinkTarget_add_x64_generated_exception_objects
1894 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_exception_object
,$(1),$(obj
),$(3),$(4)))
1895 $(foreach obj
,$(2),$(eval
$(call gb_GenCxxObject_get_target
,$(obj
)) : CXXOBJECT_X64
:= YES
))
1898 # call gb_LinkTarget_add_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1899 define gb_LinkTarget_add_generated_cobjects
1900 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_c_object
,$(1),$(obj
),$(3),$(4)))
1903 #only useful for building x64 libraries on windows
1904 # call gb_LinkTarget_add_x64_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1905 define gb_LinkTarget_add_x64_generated_cobjects
1906 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_c_object
,$(1),$(obj
),$(3),$(4)))
1909 # call gb_LinkTarget_add_generated_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1910 define gb_LinkTarget_add_generated_exception_object
1911 $(call gb_LinkTarget_add_generated_cxx_object_internal
,$(1),$(2),$(3),$(4),$(gb_LinkTarget_EXCEPTIONFLAGS
))
1914 # call gb_LinkTarget_add_generated_exception_objects,linktarget,sourcefile,cxxflags,linktargetmakefilename
1915 define gb_LinkTarget_add_generated_exception_objects
1916 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_exception_object
,$(1),$(obj
),$(3),$(4)))
1919 # call gb_LinkTarget_add_generated_objcobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1920 define gb_LinkTarget_add_generated_objcobjects
1921 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_objc_object
,$(1),$(obj
),$(3),$(4)))
1924 # call gb_LinkTarget_add_generated_objcxxobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1925 define gb_LinkTarget_add_generated_objcxxobjects
1926 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_objcxx_object
,$(1),$(obj
),$(3),$(4)))
1929 # call gb_LinkTarget_add_generated_asmobjects,linktarget,sourcefiles,asmflags,linktargetmakefilename
1930 define gb_LinkTarget_add_generated_asmobjects
1931 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_asm_object
,$(1),$(obj
),$(3),$(4)))
1934 # call gb_LinkTarget_add_generated_nasmobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1935 define gb_LinkTarget_add_generated_nasmobjects
1936 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_nasm_object
,$(1),$(obj
),$(3),$(4)))
1939 # call gb_LinkTarget_add_generated_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename
1940 define gb_LinkTarget_add_generated_cxxclrobjects
1941 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_cxxclrobject
,$(1),$(obj
),$(3),$(4)))
1944 # call gb_LinkTarget_set_targettype,linktarget,targettype
1945 define gb_LinkTarget_set_targettype
1946 $(call gb_LinkTarget_get_target
,$(1)) : TARGETTYPE
:= $(2)
1950 # call gb_LinkTarget_set_x64,linktarget,boolean
1951 define gb_LinkTarget_set_x64
1952 $(call gb_LinkTarget_get_target
,$(1)) : LIBRARY_X64
:= $(2)
1956 # call gb_LinkTarget_set_x86,linktarget,boolean
1957 define gb_LinkTarget_set_x86
1958 $(call gb_LinkTarget_get_target
,$(1)) : PE_X86
:= $(2)
1962 # call gb_LinkTarget_set_ilibtarget,linktarget,ilibfilename
1963 define gb_LinkTarget_set_ilibtarget
1964 ifeq (,$(DISABLE_DYNLOADING
))
1965 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1966 $(call gb_LinkTarget_get_target
,$(1)) : ILIBTARGET
:= $(2)
1971 # Add a file that is built by the LinkTarget command and define
1972 # a dummy touch rule for it so it can be tracked via dependencies.
1973 # The assumption is that the file is created by linking; in case it does not
1974 # exist there is some problem. This can be caused on WNT by re-naming DLL
1975 # files (which are aux-targets) but not the import .lib files (which
1976 # are the LinkTargets) and doing an incremental build.
1977 # call gb_LinkTarget_add_auxtarget,linktarget,auxtarget
1978 define gb_LinkTarget_add_auxtarget
1979 $(2) : $(call gb_LinkTarget_get_target
,$(1))
1980 if
test -e
$$@
; then \
1984 echo
"ERROR: aux-target $$@ missing, library deleted, please try running make again"; \
1988 $(call gb_LinkTarget_get_clean_target
,$(1)) : AUXTARGETS
+= $(2)
1992 # call gb_LinkTarget_add_auxtargets,linktarget,auxtargets
1993 define gb_LinkTarget_add_auxtargets
1994 $(foreach aux
,$(2),$(call gb_LinkTarget_add_auxtarget
,$(1),$(aux
)))
1998 # call gb_LinkTarget__use_custom_headers,linktarget,customtarget
1999 define gb_LinkTarget__use_custom_headers
2000 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
2001 $(call gb_CustomTarget_get_target
,$(2))
2002 $(call gb_LinkTarget__add_include
,$(1),$(gb_CustomTarget_workdir
)/$(2))
2006 # call gb_LinkTarget_use_custom_headers,linktarget,customtargets
2007 define gb_LinkTarget_use_custom_headers
2008 $(foreach customtarget
,$(2),$(call gb_LinkTarget__use_custom_headers
,$(1),$(customtarget
)))
2012 # add SDI (svidl) headers
2013 # call gb_LinkTarget_add_sdi_headers,linktarget,sditargets
2014 define gb_LinkTarget_add_sdi_headers
2015 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(foreach sdi
,$(2),$(call gb_SdiTarget_get_target
,$(sdi
)))
2016 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(foreach sdi
,$(2),$(call gb_SdiTarget_get_clean_target
,$(sdi
)))
2020 # call gb_LinkTarget__set_precompiled_header_variables,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2021 define gb_LinkTarget__set_precompiled_header_variables
2022 $(call gb_LinkTarget_get_target
,$(1)) : PCH_NAME
:= $(3)
2023 $(call gb_LinkTarget_get_target
,$(1)) : PCH_HEADER
:= $(patsubst %.
cxx,%.hxx
,$(2))
2024 $(call gb_LinkTarget_get_target
,$(1)) : PCH_LINKTARGETMAKEFILENAME
:= $(4)
2026 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
:= $$(DEFS
)
2027 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
:= $$(T_CXXFLAGS
) $(call gb_LinkTarget__get_cxxflags
,$(4)) $(gb_LinkTarget_EXCEPTIONFLAGS
)
2029 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
+= -DPCH_LEVEL
=$(gb_ENABLE_PCH
)
2030 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
+= -DPCH_LEVEL
=$(gb_ENABLE_PCH
)
2034 # call gb_LinkTarget__set_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2035 define gb_LinkTarget__set_precompiled_header_impl
2036 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_PrecompiledHeader_get_clean_target
,$(3))
2037 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : $(call gb_CxxObject_get_source
,$(SRCDIR
),$(2))
2038 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : $(patsubst %.
cxx,%.hxx
,$(call gb_CxxObject_get_source
,$(SRCDIR
),$(2)))
2039 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : $(call gb_PrecompiledHeader_get_flags_file
,$(3),$(4))
2041 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : $(call gb_LinkTarget_get_headers_target
,$(1))
2043 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : VISIBILITY
:=
2045 $(call gb_LinkTarget_get_pch_timestamp
,$(4)) : $(call gb_PrecompiledHeader_get_target
,$(3),$(4))
2047 $(call gb_LinkTarget__set_precompiled_header_variables
,$(1),$(2),$(3),$(4))
2049 ifeq ($(gb_FULLDEPS
),$(true
))
2050 -include $(call gb_PrecompiledHeader_get_dep_target
,$(3),$(4))
2055 # call gb_LinkTarget__add_precompiled_header_object,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2056 define gb_LinkTarget__add_precompiled_header_object
2058 ifneq ($(BUILDING_PCH_WITH_OBJ
),)
2059 $(call gb_LinkTarget_add_exception_object
,$(1),$(2),,$(4))
2060 $(call gb_CxxObject_get_target
,$(2)) : T_PCH_EXTRA_CXXFLAGS
+= $(gb_PrecompiledHeader_pch_with_obj
)
2063 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
= $(call gb_PrecompiledHeader_get_objectfile
, $(call gb_PrecompiledHeader_get_target
,$(3),$(4)))
2064 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
= $$(PCHOBJEX
)
2068 # 'compiler' set comes only from gb_LinkTarget_set_clang_precompiled_header
2069 # call gb_LinkTarget_set_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename,compiler
2070 define gb_LinkTarget_set_precompiled_header
2071 ifneq ($(gb_ENABLE_PCH
),)
2072 $(call gb_LinkTarget__set_precompiled_header_impl
,$(1),$(2),$(notdir $(2)),$(4))
2073 $(call gb_PrecompiledHeader_generate_rules
,$(notdir $(2)),$(1),$(4),$(2),$(5))
2075 ifneq ($(gb_ENABLE_PCH
)$(BLOCK_PCH
),)
2076 $(call gb_LinkTarget__add_precompiled_header_object
,$(1),$(2),$(notdir $(2)),$(4))
2081 # It seems complicated to forward the clang setting to the PCH rules, so use an extra
2082 # function to set it manually. This variant should be used if gb_LinkTarget_use_clang is used.
2083 # call gb_LinkTarget_set_clang_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename
2084 define gb_LinkTarget_set_clang_precompiled_header
2085 $(call gb_LinkTarget_set_precompiled_header
,$(1),$(2),$(3),$(4),$(LO_CLANG_CXX
))
2088 # call gb_LinkTarget__reuse_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2089 # Use the PCH as if it was LinkTarget's own, but do nothing with the PCH itself, just depend on it.
2090 define gb_LinkTarget__reuse_precompiled_header_impl
2091 $(call gb_LinkTarget__set_precompiled_header_variables
,$(1),$(2),$(3),$(4))
2093 $(call gb_LinkTarget_get_pch_timestamp
,$(4)) : $(call gb_LinkTarget_get_pch_reuse_timestamp
,$(4))
2095 # We need to depend on a special for_reuse target that depends on the linktarget that owns the PCH.
2096 # Depending directly on the PCH could cause that PCH to be built with this linktarget's flags.
2097 $(call gb_LinkTarget_get_pch_reuse_timestamp
,$(4)) : $(call gb_PrecompiledHeader_get_for_reuse_target
,$(3),$(4))
2098 $(call gb_PrecompiledHeader_check_flags
,$(4),$(2),\
2099 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)),\
2100 $(call gb_PrecompiledHeader_get_flags_file
,$(3),$(4)),\
2101 $(gb_PrecompiledHeader_cxxflags_includes
))
2102 $$(call gb_PrecompiledHeader__copy_reuse_files
,$(1),$(3),$(4))
2103 mkdir
-p
$$(dir $$@
) && touch
$$@
2107 # call gb_LinkTarget__add_reuse_precompiled_header_object,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2108 define gb_LinkTarget__add_reuse_precompiled_header_object
2110 ifneq ($(BUILDING_PCH_WITH_OBJ
),)
2111 # We need to link in also the PCH's object file. Again, rely on a special for_reuse target for dependencies.
2112 $(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)))))
2113 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
+= $(2)
2116 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
= $(call gb_PrecompiledHeader_get_objectfile
, $(call gb_PrecompiledHeader_get_target
,$(3),$(4)))
2117 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
= $$(PCHOBJEX
)
2121 # call gb_LinkTarget__reuse_precompiled_header_workarounds,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
2122 define gb_LinkTarget__reuse_precompiled_header_workarounds
2123 ifeq ($(COM_IS_CLANG
),TRUE
)
2124 $(call gb_LinkTarget_add_defs
,$(1),$(gb_CXXFLAGS_include
)$(SRCDIR
)/pch
/inc
/clangfix.hxx
)
2125 $(call gb_LinkTarget_add_defs
,$(1),$(gb_CXXFLAGS_no_pch_warnings
))
2127 $(if
$(filter precompiled_system
,$(3)), $(call gb_LinkTarget_add_defs
,$(1),-DBOOST_ALL_NO_LIB
))
2130 # call gb_LinkTarget_reuse_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename
2131 define gb_LinkTarget_reuse_precompiled_header
2132 ifeq ($(gb_DISABLE_PCH_REUSE
),$(false
))
2133 ifneq ($(gb_ENABLE_PCH
),)
2134 $(call gb_LinkTarget__reuse_precompiled_header_impl
,$(1),$(2),$(notdir $(2)),$(4))
2135 $(call gb_LinkTarget__reuse_precompiled_header_workarounds
,$(1),$(2),$(notdir $(2)),$(4))
2137 ifneq ($(gb_ENABLE_PCH
)$(BLOCK_PCH
),)
2138 $(call gb_LinkTarget__add_reuse_precompiled_header_object
,$(1),$(2),$(notdir $(2)),$(4))
2144 # call gb_LinkTarget_use_common_precompiled_header,linktarget,,,linktargetmakefilename
2145 define gb_LinkTarget_use_common_precompiled_header
2146 $(call gb_LinkTarget_reuse_precompiled_header
,$(1),pch
/inc
/pch
/precompiled_system
,,$(4))
2150 # use a header package, possibly from another module
2151 # call gb_LinkTarget_use_package,linktarget,package
2152 define gb_LinkTarget_use_package
2153 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
2154 $(call gb_Package_get_target
,$(strip $(2)))
2155 $(call gb_Package_get_target
,$(strip $(2))): RDEPENDS
+= $(call gb_LinkTarget__get_workdir_linktargetname
,$(1))
2159 # call gb_LinkTarget_use_packages,linktarget,packages
2160 define gb_LinkTarget_use_packages
2161 $(foreach package
,$(2),$(call gb_LinkTarget_use_package
,$(1),$(package
)))
2164 # use a GeneratedPackage, possibly from another module
2165 # call gb_LinkTarget_use_generated_package,linktarget,package
2166 define gb_LinkTarget_use_generated_package
2167 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
2168 $(call gb_GeneratedPackage_get_target
,$(strip $(2)))
2172 # Use sources from unpacked tarball of an external project
2173 # call gb_LinkTarget_use_unpacked,linktarget,unpackedtarget
2174 define gb_LinkTarget_use_unpacked
2175 $(call gb_LinkTarget_get_headers_target
,$(1)) :|
$(call gb_UnpackedTarball_get_final_target
,$(2))
2179 # Use artifacts from ExternalProject (i. e. configure) of an external project
2180 # example in expat: StaticLibrary depends on ExternalProject outcome
2181 # call gb_LinkTarget_use_external_project,linktarget,externalproject,full-dep
2182 define gb_LinkTarget_use_external_project
2183 $(call gb_LinkTarget_get_target
,$(1)) :|
$(call gb_ExternalProject_get_target
,$(2))
2184 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
2185 $(if
$(3),$(call gb_ExternalProject_get_target
,$(2)),$(call gb_UnpackedTarball_get_final_target
,$(2)))
2189 # this forwards to functions that must be defined in RepositoryExternal.mk.
2190 # Automatically forward for libmerged library too when linktarget is merged.
2192 # call gb_LinkTarget_use_external,linktarget,external
2193 define gb_LinkTarget_use_external
2194 $(if
$(filter undefined
,$(origin gb_LinkTarget__use_
$(2))),\
2195 $(error gb_LinkTarget_use_external
: unknown external
: $(2)) \
2197 $(if
$(gb_PARTIAL_BUILD
),,$(if
$(call gb_LinkTarget__is_merged
,$(1)), \
2198 $(call gb_LinkTarget__use_
$(2),$(call gb_Library_get_linktarget
,merged
)))) \
2199 $(call gb_LinkTarget__use_
$(2),$(1)) \
2202 $(call gb_LinkTarget__register_type
,externals
,$(1),$(2))
2206 # $(call gb_LinkTarget_use_externals,library,externals)
2207 gb_LinkTarget_use_externals
= \
2208 $(foreach external
,$(2),$(call gb_LinkTarget_use_external
,$(1),$(external
)))
2210 # call gb_LinkTarget_set_visibility_default,linktarget
2211 define gb_LinkTarget_set_visibility_default
2212 $(call gb_LinkTarget_get_target
,$(1)) : VISIBILITY
:= default
2213 ifneq ($(gb_ENABLE_PCH
),)
2214 ifneq ($(strip $$(PCH_NAME
)),)
2215 $(call gb_PrecompiledHeader_get_target
,$$(PCH_NAME
),$$(PCH_LINKTARGETMAKEFILENAME
)) : VISIBILITY
:= default
2221 # call gb_LinkTarget_set_warnings_not_errors,linktarget
2222 define gb_LinkTarget_set_warnings_not_errors
2223 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_NOT_ERRORS
:= $(true
)
2227 # call gb_LinkTarget_set_warnings_disabled,linktarget
2228 define gb_LinkTarget_set_warnings_disabled
2229 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_DISABLED
:= $(true
)
2233 # call gb_LinkTarget_set_external_code,linktarget
2234 define gb_LinkTarget_set_external_code
2235 $(call gb_LinkTarget_get_target
,$(1)) : EXTERNAL_CODE
:= $(true
)
2239 # Set suffix of C++ files, if different from 'cxx'
2241 # This is useful for external libraries.
2243 # call gb_LinkTarget_set_generated_cxx_suffix,linktarget,used-suffix
2244 define gb_LinkTarget_set_generated_cxx_suffix
2245 gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)) := $(2)
2249 # C/C++ files will be build with Clang (if possible) instead of the default compiler.
2250 # call gb_LinkTarget_use_clang,linktarget,,linktargetmakefilename
2251 define gb_LinkTarget_use_clang
2252 $(call gb_LinkTarget_get_target
,$(1)) : T_CC
:= $(LO_CLANG_CC
)
2253 $(call gb_LinkTarget_get_target
,$(1)) : T_CXX
:= $(LO_CLANG_CXX
)
2254 $(call gb_LinkTarget_get_target
,$(1)) : T_USE_CLANG
:= $(true
)
2255 $(call gb_LinkTarget_get_target
,$(1)) : T_USE_LD
:= $(or
$(CLANG_USE_LD
),$(USE_LD
))
2256 $(call gb_LinkTarget_get_target
,$(1)) : T_LTOFLAGS
:= $(if
$(LO_CLANG_CXX
),$(gb_CLANG_LTOFLAGS
),$(gb_LTOFLAGS
))
2259 # call gb_LinkTarget_use_vclmain,linktarget
2260 define gb_LinkTarget_use_vclmain
2261 $(call gb_LinkTarget_use_static_libraries
,$(1),vclmain
)
2263 endef # gb_LinkTarget_use_vclmain
2265 # Used by URE libraries that need to keep binary compatibility.
2266 # Reset some flags that make sense for our internal libraries but might
2268 # (clang-cl's -Zc:dllexportInlines- would not only be a problem for the URE libraries themselves but
2269 # also for any libraries they depend on. While that does not appear to be a problem for -Zc:inline
2270 # for neither MSVC nor clang-cl, it should not really hurt to also switch that off not only for the
2271 # URE libraries themselves but also for their dependencies.)
2272 # call gb_LinkTarget_set_is_ure_library_or_dependency,linktarget,,linktargetmakefilename
2273 define gb_LinkTarget_set_is_ure_library_or_dependency
2274 $(call gb_LinkTarget_add_cxxflags
,$(1),$(gb_CXXFLAGS_ZCINLINE_OFF
))
2275 ifeq ($(HAVE_DLLEXPORTINLINES
),TRUE
)
2276 $(call gb_LinkTarget_add_cxxflags
,$(1),-Zc
:dllexportInlines
)
2281 gb_LinkTarget__get_plugins_var
= $(call gb_LinkTarget__get_workdir_linktargetname
,$(1))<>PLUGINS
2282 gb_LinkTarget__get_plugins
= $($(call gb_LinkTarget__get_plugins_var
,$(1)))
2283 gb_Library__get_plugins
= $($(call gb_LinkTarget__get_plugins_var
,$(call gb_Library_get_linktarget
,$(1))))
2285 define gb_LinkTarget__add_plugin
2286 $(call gb_LinkTarget__get_plugins_var
,$(1)) += $(2)
2290 # Instead of setting nodep use gb_LinkTarget__set_plugin_for_nodep
2292 # call gb_LinkTarget__set_plugin_for,linktarget,loader,nodep
2293 define gb_LinkTarget__set_plugin_for
2294 ifeq (,$(filter $(1),$(foreach plugin
,$(gb_Library_KNOWNPLUGINS
),$(call gb_Library_get_linktarget
,$(plugin
)))))
2295 $$(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
))
2297 ifneq (,$(filter $(1),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library_get_linktarget
,$(lib
)))))
2298 $$(eval
$$(call gb_Output_error
,Plugins can
't be in mergelibs))
2300 ifeq ($(call gb_LinkTarget__is_build_tool,$(1)),$(true))
2301 $$(eval $$(call gb_Output_error,Plugin support for build tools not implemented))
2304 $(if $(filter $(2),$(gb_Library_KNOWNLOADERS)),,gb_Library_KNOWNLOADERS += $(2))
2305 $(if $(3),,$(call gb_LinkTarget_use_libraries,$(1),$(2),,$(4)))
2309 # call gb_LinkTarget__set_plugin_for_nodep,linktarget,loader
2310 gb_LinkTarget__set_plugin_for_nodep = $(call gb_LinkTarget__set_plugin_for,$(1),$(2),$(true))
2312 # call gb_LinkTarget_add_prejs,linktarget,js_file
2313 define gb_LinkTarget_add_prejs
2314 ifeq (EMSCRIPTEN,$(OS))
2315 $(call gb_LinkTarget_get_target,$(1)) : T_PREJS += $(2)
2316 $(call gb_LinkTarget_get_target,$(1)) : $(2)
2321 # vim: set noet sw=4: