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 # Detect whether symbols should be enabled for the given gbuild target.
40 # enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined]
41 gb_LinkTarget__symbols_enabled
= \
42 $(and
$(if
$(filter -$(1),$(ENABLE_SYMBOLS_FOR
)),,$(true
)),\
43 $(or
$(gb_Module_CURRENTMODULE_SYMBOLS_ENABLED
),\
44 $(filter $(1),$(ENABLE_SYMBOLS_FOR
))))
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
), \
50 $(gb_COMPILERNOOPTFLAGS
))) \
51 $(if
$(call gb_LinkTarget__symbols_enabled
,$(1)),$(gb_DEBUGINFO_FLAGS
))
53 # similar for LDFLAGS, use linker optimization flags in non-debug case,
54 # but moreover strip debug from libraries for which debuginfo is not wanted
55 # (some libraries reuse .o files from other libraries, notably unittests)
56 gb_LinkTarget__get_stripldflags
=$(if
$(strip $(CFLAGS
)$(CXXFLAGS
)$(OBJCFLAGS
)$(OBJCXXFLAGS
)$(LDFLAGS
)),,$(gb_LINKERSTRIPDEBUGFLAGS
))
57 gb_LinkTarget__get_debugldflags
=$(if
$(call gb_LinkTarget__symbols_enabled
,$(1)),$(gb_LINKER_DEBUGINFO_FLAGS
),$(gb_LINKEROPTFLAGS
) $(call gb_LinkTarget__get_stripldflags
,$(1)))
59 # generic cflags/cxxflags to use (optimization flags, debug flags)
60 # user supplied CFLAGS/CXXFLAGS override default debug/optimization flags
61 # call gb_LinkTarget__get_cflags,linktargetmakefilename
62 gb_LinkTarget__get_cflags
=$(if
$(CFLAGS
),$(CFLAGS
),$(call gb_LinkTarget__get_debugflags
,$(1)))
63 gb_LinkTarget__get_objcflags
=$(if
$(OBJCFLAGS
),$(OBJCFLAGS
),$(call gb_LinkTarget__get_debugflags
,$(1)))
64 gb_LinkTarget__get_cxxflags
=$(if
$(CXXFLAGS
),$(CXXFLAGS
),$(call gb_LinkTarget__get_debugflags
,$(1)))
65 gb_LinkTarget__get_objcxxflags
=$(if
$(OBJCXXFLAGS
),$(OBJCXXFLAGS
),$(call gb_LinkTarget__get_debugflags
,$(1)))
66 gb_LinkTarget__get_cxxclrflags
=$(call gb_LinkTarget__get_debugflags
,$(1))
67 # call gb_LinkTarget__get_ldflags,linktargetmakefilename
68 gb_LinkTarget__get_ldflags
=$(if
$(LDFLAGS
),$(LDFLAGS
),$(call gb_LinkTarget__get_debugldflags
,$(1)))
70 gb_LinkTarget_LAYER_LINKPATHS
:= \
77 NONE
:URELIB
+OOO
+NONE. \
80 # Used to run a compiler plugin tool.
82 # At least for now, these definitions are generic enough so that they can be
83 # shared across all current use cases (COMPILER_EXTERNAL_TOOL,
84 # COMPILER_PLUGIN_TOOL) on all relevant toolchains (GCC?, Clang, clang-cl). If
85 # it ever becomes necessary, they can be moved to e.g.
86 # platform/com_{GCC,MSC}_class.mk and made different there.
88 # $(call gb_CObject__tool_command,relative-source,source)
89 define gb_CObject__tool_command
90 $(call gb_Helper_abbreviate_dirs
,\
91 ICECC
=no CCACHE_DISABLE
=1 \
95 $(if
$(VISIBILITY
),,$(gb_VISIBILITY_FLAGS
)) \
96 $(if
$(WARNINGS_NOT_ERRORS
),$(if
$(ENABLE_WERROR
),$(if
$(PLUGIN_WARNINGS_AS_ERRORS
),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS
))),$(gb_CFLAGS_WERROR
)) \
97 $(gb_COMPILER_PLUGINS
) \
98 $(T_CFLAGS
) $(T_CFLAGS_APPEND
) \
99 $(if
$(EXTERNAL_CODE
),$(gb_CXXFLAGS_Wundef
),$(gb_DEFS_INTERNAL
)) \
104 define gb_ObjCObject__tool_command
105 $(call gb_Helper_abbreviate_dirs
,\
106 ICECC
=no CCACHE_DISABLE
=1 \
110 $(if
$(VISIBILITY
),,$(gb_VISIBILITY_FLAGS
)) \
111 $(if
$(WARNINGS_NOT_ERRORS
),$(if
$(ENABLE_WERROR
),$(if
$(PLUGIN_WARNINGS_AS_ERRORS
),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS
))),$(gb_CFLAGS_WERROR
)) \
112 $(gb_COMPILER_PLUGINS
) \
113 $(T_OBJCFLAGS
) $(T_OBJCFLAGS_APPEND
) \
114 $(if
$(EXTERNAL_CODE
),$(gb_CXXFLAGS_Wundef
),$(gb_DEFS_INTERNAL
)) \
119 define gb_CxxObject__tool_command
120 $(call gb_Helper_abbreviate_dirs
,\
121 ICECC
=no CCACHE_DISABLE
=1 \
125 $(if
$(VISIBILITY
),,$(gb_VISIBILITY_FLAGS
)) \
126 $(if
$(WARNINGS_NOT_ERRORS
),$(if
$(ENABLE_WERROR
),$(if
$(PLUGIN_WARNINGS_AS_ERRORS
),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS
))),$(gb_CFLAGS_WERROR
)) \
127 $(gb_COMPILER_PLUGINS
) \
128 $(T_CXXFLAGS
) $(T_CXXFLAGS_APPEND
) \
129 $(if
$(EXTERNAL_CODE
),$(gb_CXXFLAGS_Wundef
),$(gb_DEFS_INTERNAL
)) \
134 define gb_ObjCxxObject__tool_command
135 $(call gb_Helper_abbreviate_dirs
,\
136 ICECC
=no CCACHE_DISABLE
=1 \
140 $(if
$(VISIBILITY
),,$(gb_VISIBILITY_FLAGS
)) \
141 $(if
$(WARNINGS_NOT_ERRORS
),$(if
$(ENABLE_WERROR
),$(if
$(PLUGIN_WARNINGS_AS_ERRORS
),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS
))),$(gb_CFLAGS_WERROR
)) \
142 $(gb_COMPILER_PLUGINS
) \
143 $(T_OBJCXXFLAGS
) $(T_OBJCXXFLAGS_APPEND
) \
144 $(if
$(EXTERNAL_CODE
),$(gb_CXXFLAGS_Wundef
),$(gb_DEFS_INTERNAL
)) \
149 define gb_CxxClrObject__tool_command
150 $(call gb_Helper_abbreviate_dirs
,\
151 ICECC
=no CCACHE_DISABLE
=1 \
155 $(if
$(VISIBILITY
),,$(gb_VISIBILITY_FLAGS
)) \
156 $(if
$(WARNINGS_NOT_ERRORS
),$(if
$(ENABLE_WERROR
),$(if
$(PLUGIN_WARNINGS_AS_ERRORS
),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS
))),$(gb_CFLAGS_WERROR
)) \
157 $(gb_COMPILER_PLUGINS
) \
158 $(T_CXXCLRFLAGS
) $(T_CXXCLRFLAGS_APPEND
) \
159 $(if
$(EXTERNAL_CODE
),$(gb_CXXFLAGS_Wundef
),$(gb_DEFS_INTERNAL
)) \
166 # Overview of dependencies and tasks of LinkTarget
168 # target task depends on
169 # LinkTarget linking AsmObject CObject CxxObject GenCObject GenCxxObject ObjCObject ObjCxxObject CxxClrObject GenCxxClrObject
171 # LinkTarget/dep joined dep file AsmObject/dep CObject/dep CxxObject/dep GenCObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep CxxClrObject/dep GenCxxClrObject/dep
172 # | LinkTarget/headers
173 # LinkTarget/headers all headers available
174 # including own generated
175 # PCH precompiled headers LinkTarget/headers
176 # CObject plain c compile | LinkTarget/headers
177 # CxxObject c++ compile | LinkTarget/headers PCH
178 # GenCObject plain c compile from | LinkTarget/headers
180 # GenCxxObject C++ compile from | LinkTarget/headers PCH
182 # ObjCObject objective c compile | LinkTarget/headers
183 # ObjCxxObject objective c++ compile | LinkTarget/headers
184 # CxxClrObject C++ CLR compile | LinkTarget/headers
185 # GenCxxClrObject C++ CLR compile from | LinkTarget/headers
188 # AsmObject asm compile | LinkTarget
190 # CObject/dep dependencies these targets generate empty dep files
191 # CxxObject/dep dependencies that are populated upon compile
192 # GenCObject/dep dependencies
193 # GenCxxObject/dep dependencies
194 # ObjCObject/dep dependencies
195 # ObjCxxObject/dep dependencies
196 # CxxClrObject/dep dependencies
197 # GenCxxClrObject/dep dependencies
198 # AsmObject/dep dependencies
200 # LinkTarget/headers means gb_LinkTarget_get_headers_target etc.
201 # dependencies prefixed with | are build-order only dependencies
204 # check that objects are only linked into one link target:
205 # multiple linking may cause problems because different link targets may
206 # require different compiler flags
207 define gb_Object__owner
208 $$(if
$$(OBJECTOWNER
),\
209 $$(call gb_Output_error
,fdo
#47246: $(1) is linked in by $$(OBJECTOWNER) $(2)))$(2)
212 # For every object there is a dep file (if gb_FULLDEPS is active).
213 # The dep file depends on the object: the Object__command also updates the
214 # dep file as a side effect.
215 # In the dep file rule just touch it so it's newer than the object.
217 ifneq ($(FORCE_COMPILE_ALL
),)
218 # This one only exists to force .c/.cxx "rebuilds" when running a compiler tool.
219 .PHONY
: force_compile_all_target
220 force_compile_all_target
:
221 gb_FORCE_COMPILE_ALL_TARGET
:= force_compile_all_target
226 gb_CObject_get_source
= $(1)/$(2).c
228 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
229 $(call gb_CObject_get_target
,%) : $(call gb_CObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_ALL_TARGET
)
230 $(call gb_Output_announce
,$*.c
,$(true
),C
,3)
231 $(call gb_Trace_StartRange
,$*.c
,C
)
232 $(call gb_CObject__tool_command
,$*,$<)
233 $(call gb_Trace_EndRange
,$*.c
,C
)
235 $(call gb_CObject_get_target
,%) : $(call gb_CObject_get_source
,$(SRCDIR
),%)
236 $(call gb_Output_announce
,$*.c
,$(true
),$(if
$(COMPILER_TEST
),C?
,C
),3)
237 $(call gb_Trace_StartRange
,$*.c
,$(if
$(COMPILER_TEST
),C?
,C
))
238 $(call gb_CObject__command_pattern
,$@
,$(T_CFLAGS
) $(T_CFLAGS_APPEND
),$<,$(call gb_CObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),$(T_SYMBOLS
),$(T_CC
))
239 $(call gb_Trace_EndRange
,$*.c
,$(if
$(COMPILER_TEST
),C?
,C
))
242 # Note: if the *Object_dep_target does not exist it will be created by
243 # concat-deps as PHONY
244 ifeq ($(gb_FULLDEPS
),$(true
))
245 $(dir $(call gb_CObject_get_dep_target
,%)).
dir :
246 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
248 $(dir $(call gb_CObject_get_dep_target
,%))%/.
dir :
249 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
251 $(call gb_CObject_get_dep_target
,%) :
252 $(if
$(wildcard $@
),touch
$@
)
259 gb_CxxObject_get_source
= $(1)/$(2).
cxx
261 # Only enable PCH if the PCH_CXXFLAGS and the PCH_DEFS (from the linktarget)
262 # are the same as the T_CXXFLAGS and DEFS we want to use for this object. This
263 # should usually be the case. The DEFS/T_CXXFLAGS would have to be manually
264 # overridden for one object file for them to differ. PCH_CXXFLAGS/PCH_DEFS
265 # should never be overridden on an object -- they should be the same as for the
266 # whole linktarget. In general it should be cleaner to use a static library
267 # compiled with different flags and link that in rather than mixing different
268 # flags in one linktarget. If OBJECT_HAS_EXTRA_CXXFLAGS is set, the object
269 # has explicitly set additional CXXFLAGS, so in that case avoid using the PCH.
270 # T_PCH_EXTRA_CXXFLAGS is used when some object requires extra flags when using
271 # the PCH, but they are intended (gb_PrecompiledHeader_pch_with_obj).
272 define gb_CxxObject__set_pchflags
273 ifneq ($(gb_ENABLE_PCH
),)
274 ifneq ($(strip $$(PCH_NAME
)),)
275 ifeq ($(OBJECT_HAS_EXTRA_CXXFLAGS
),)
276 ifeq ($$(sort $$(PCH_CXXFLAGS
) $$(PCH_DEFS
)),$$(sort $$(T_CXXFLAGS
) $$(T_CXXFLAGS_APPEND
) $$(DEFS
)))
277 $$@
: PCHFLAGS
:= $$(call gb_PrecompiledHeader_get_enableflags
,$$(PCH_NAME
),$$(PCH_LINKTARGETMAKEFILENAME
),$$(PCH_HEADER
)) $$(T_PCH_EXTRA_CXXFLAGS
)
279 $$(warning No precompiled header available for
$$*.
cxx .
)
280 $$(info precompiled header flags
: $$(sort $$(PCH_CXXFLAGS
) $$(PCH_DEFS
)))
281 $$(info . object flags
: $$(sort $$(T_CXXFLAGS
) $$(T_CXXFLAGS_APPEND
) $$(DEFS
)))
282 $$(error Incorrect precompiled header setup or internal gbuild error.
)
290 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
291 $(call gb_CxxObject_get_target
,%) : $(call gb_CxxObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_ALL_TARGET
)
292 $(call gb_Output_announce
,$*.
cxx,$(true
),CXX
,3)
293 $(call gb_Trace_StartRange
,$*.
cxx,CXX
)
294 $(call gb_CxxObject__tool_command
,$*,$<)
295 $(call gb_Trace_EndRange
,$*.
cxx,CXX
)
297 $(call gb_CxxObject_get_target
,%) : $(call gb_CxxObject_get_source
,$(SRCDIR
),%)
298 $(call gb_Output_announce
,$*.
cxx,$(true
),$(if
$(COMPILER_TEST
),CPT
,CXX
),3)
299 $(call gb_Trace_StartRange
,$*.
cxx,$(if
$(COMPILER_TEST
),CPT
,CXX
))
300 $(eval
$(gb_CxxObject__set_pchflags
))
301 $(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_SYMBOLS
),$(T_CXX
))
302 $(call gb_Trace_EndRange
,$*.
cxx,$(if
$(COMPILER_TEST
),CPT
,CXX
))
305 ifeq ($(gb_FULLDEPS
),$(true
))
306 $(dir $(call gb_CxxObject_get_dep_target
,%)).
dir :
307 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
309 $(dir $(call gb_CxxObject_get_dep_target
,%))%/.
dir :
310 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
312 $(call gb_CxxObject_get_dep_target
,%) :
313 $(if
$(wildcard $@
),touch
$@
)
320 gb_GenCObject_get_source
= $(WORKDIR
)/$(1).c
322 $(call gb_GenCObject_get_target
,%) : $(gb_FORCE_COMPILE_ALL_TARGET
)
323 $(call gb_Output_announce
,$*.c
,$(true
),C
,3)
324 $(call gb_Trace_StartRange
,$*.c
,C
)
325 test -f
$(call gb_GenCObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenCObject_get_source,$*)" && false
)
326 $(call gb_CObject__command_pattern
,$@
,$(T_CFLAGS
) $(T_CFLAGS_APPEND
),$(call gb_GenCObject_get_source
,$*),$(call gb_GenCObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),$(T_SYMBOLS
),$(T_CC
))
327 $(call gb_Trace_EndRange
,$*.c
,C
)
329 ifeq ($(gb_FULLDEPS
),$(true
))
330 $(dir $(call gb_GenCObject_get_dep_target
,%)).
dir :
331 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
333 $(dir $(call gb_GenCObject_get_dep_target
,%))%/.
dir :
334 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
336 $(call gb_GenCObject_get_dep_target
,%) :
337 $(if
$(wildcard $@
),touch
$@
)
344 gb_GenCxxObject_get_source
= $(WORKDIR
)/$(1).
$(gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(2)))
346 $(call gb_GenCxxObject_get_target
,%) : $(gb_FORCE_COMPILE_ALL_TARGET
)
347 $(call gb_Output_announce
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),$(true
),CXX
,3)
348 $(call gb_Trace_StartRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),CXX
)
349 test -f
$(GEN_CXX_SOURCE
) ||
(echo
"Missing generated source file $(GEN_CXX_SOURCE)" && false
)
350 $(eval
$(gb_CxxObject__set_pchflags
))
351 $(call gb_CObject__command_pattern
,$@
,$(T_CXXFLAGS
) $(T_CXXFLAGS_APPEND
),$(GEN_CXX_SOURCE
),$(call gb_GenCxxObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),$(T_SYMBOLS
),$(T_CXX
))
352 $(call gb_Trace_EndRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),CXX
)
354 ifeq ($(gb_FULLDEPS
),$(true
))
355 $(dir $(call gb_GenCxxObject_get_dep_target
,%)).
dir :
356 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
358 $(dir $(call gb_GenCxxObject_get_dep_target
,%))%/.
dir :
359 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
361 $(call gb_GenCxxObject_get_dep_target
,%) :
362 $(if
$(wildcard $@
),touch
$@
)
367 # GenCxxClrObject class
369 gb_GenCxxClrObject_get_source
= $(WORKDIR
)/$(1).
$(gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(2)))
371 $(call gb_GenCxxClrObject_get_target
,%) : $(gb_FORCE_COMPILE_ALL_TARGET
)
372 $(call gb_Output_announce
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),$(true
),CLR
,3)
373 $(call gb_Trace_StartRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),CLR
)
374 test -f
$(GEN_CXXCLR_SOURCE
) ||
(echo
"Missing generated source file $(GEN_CXXCLR_SOURCE)" && false
)
375 $(call gb_CObject__command_pattern
,$@
,$(T_CXXCLRFLAGS
) $(T_CXXCLRFLAGS_APPEND
),$(GEN_CXXCLR_SOURCE
),$(call gb_GenCxxClrObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),$(T_SYMBOLS
))
376 $(call gb_Trace_EndRange
,$(subst $(BUILDDIR
)/,,$(GEN_CXXCLR_SOURCE
)),CLR
)
378 ifeq ($(gb_FULLDEPS
),$(true
))
379 $(dir $(call gb_GenCxxClrObject_get_dep_target
,%)).
dir :
380 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
382 $(dir $(call gb_GenCxxClrObject_get_dep_target
,%))%/.
dir :
383 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
385 $(call gb_GenCxxClrObject_get_dep_target
,%) :
386 $(if
$(wildcard $@
),touch
$@
)
393 # XXX: This is more complicated than necessary, but we cannot just use
394 # the generated C++ file as the main target, because we need to let the
395 # header depend on that to ensure the header is present before anything
398 gb_YaccTarget_get_source
= $(1)/$(2).y
400 .PHONY
: $(call gb_YaccTarget_get_clean_target
,%)
401 $(call gb_YaccTarget_get_clean_target
,%) :
402 $(call gb_Output_announce
,$*,$(false
),YAC
,3)
403 $(call gb_Helper_abbreviate_dirs
,\
404 rm -f
$(call gb_YaccTarget_get_grammar_target
,$*) $(call gb_YaccTarget_get_header_target
,$*) $(call gb_YaccTarget_get_target
,$*))
406 $(call gb_YaccTarget_get_target
,%) : $(call gb_YaccTarget_get_source
,$(SRCDIR
),%)
407 $(call gb_YaccTarget__command
,$<,$*,$@
,$(call gb_YaccTarget_get_header_target
,$*),$(call gb_YaccTarget_get_grammar_target
,$*))
409 # call gb_YaccTarget_YaccTarget,yacctarget
410 define gb_YaccTarget_YaccTarget
411 $(call gb_YaccTarget_get_grammar_target
,$(1)) : $(call gb_YaccTarget_get_target
,$(1))
413 $(call gb_YaccTarget_get_header_target
,$(1)) : $(call gb_YaccTarget_get_target
,$(1))
420 gb_LexTarget_get_source
= $(1)/$(2).l
422 .PHONY
: $(call gb_LexTarget_get_clean_target
,%)
423 $(call gb_LexTarget_get_clean_target
,%) :
424 $(call gb_Output_announce
,$*,$(false
),LEX
,3)
425 $(call gb_Helper_abbreviate_dirs
,\
426 rm -f
$(call gb_LexTarget_get_scanner_target
,$*) $(call gb_LexTarget_get_target
,$*))
428 $(call gb_LexTarget_get_target
,%) : $(call gb_LexTarget_get_source
,$(SRCDIR
),%)
429 $(call gb_Output_announce
,$*,$(true
),LEX
,3)
430 $(call gb_Trace_StartRange
,$*,LEX
)
431 $(call gb_LexTarget__command
,$<,$*,$@
,$(call gb_LexTarget_get_scanner_target
,$*))
432 $(call gb_Trace_EndRange
,$*,LEX
)
434 # gb_LexTarget_LexTarget(scanner-file)
435 define gb_LexTarget_LexTarget
436 $(call gb_LexTarget_get_scanner_target
,$(1)) : $(call gb_LexTarget_get_target
,$(1))
441 # gb_LexTarget__command(scanner-file, stem-for-message, done-pseudo-target, source-target)
442 define gb_LexTarget__command
443 $(call gb_Helper_abbreviate_dirs
,\
444 mkdir
-p
$(dir $(3)) && \
445 $(FLEX
) $(T_LEXFLAGS
) -o
$(4) $(1) && touch
$(3) )
452 gb_ObjCxxObject_get_source
= $(1)/$(2).mm
454 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
455 $(call gb_ObjCxxObject_get_target
,%) : $(call gb_ObjCxxObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_ALL_TARGET
)
456 $(call gb_Output_announce
,$*.mm
,$(true
),OCX
,3)
457 $(call gb_Trace_StartRange
,$*.mm
,OCX
)
458 $(call gb_ObjCxxObject__tool_command
,$*,$<)
459 $(call gb_Trace_EndRange
,$*.mm
,OCX
)
461 $(call gb_ObjCxxObject_get_target
,%) : $(call gb_ObjCxxObject_get_source
,$(SRCDIR
),%)
462 $(call gb_Output_announce
,$*.mm
,$(true
),$(if
$(COMPILER_TEST
),O?X
,OCX
),3)
463 $(call gb_Trace_StartRange
,$*.mm
,$(if
$(COMPILER_TEST
),O?X
,OCX
))
464 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCXXFLAGS
) $(T_OBJCXXFLAGS_APPEND
),$<,$(call gb_ObjCxxObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),$(T_SYMBOLS
))
465 $(call gb_Trace_EndRange
,$*.mm
,$(if
$(COMPILER_TEST
),O?X
,OCX
))
468 ifeq ($(gb_FULLDEPS
),$(true
))
469 $(dir $(call gb_ObjCxxObject_get_dep_target
,%)).
dir :
470 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
472 $(dir $(call gb_ObjCxxObject_get_dep_target
,%))%/.
dir :
473 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
475 $(call gb_ObjCxxObject_get_dep_target
,%) :
476 $(if
$(wildcard $@
),touch
$@
)
484 gb_ObjCObject_get_source
= $(1)/$(2).m
486 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
487 $(call gb_ObjCObject_get_target
,%) : $(call gb_ObjCObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_ALL_TARGET
)
488 $(call gb_Output_announce
,$*.m
,$(true
),OCC
,3)
489 $(call gb_Trace_StartRange
,$*.m
,OCC
)
490 $(call gb_ObjCObject__tool_command
,$*,$<)
491 $(call gb_Trace_EndRange
,$*.m
,OCC
)
493 $(call gb_ObjCObject_get_target
,%) : $(call gb_ObjCObject_get_source
,$(SRCDIR
),%)
494 $(call gb_Output_announce
,$*.m
,$(true
),$(if
$(COMPILER_TEST
),O?C
,OCC
),3)
495 $(call gb_Trace_StartRange
,$*.m
,$(if
$(COMPILER_TEST
),O?C
,OCC
))
496 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCFLAGS
) $(T_OBJCFLAGS_APPEND
),$<,$(call gb_ObjCObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),$(T_SYMBOLS
))
497 $(call gb_Trace_EndRange
,$*.m
,$(if
$(COMPILER_TEST
),O?C
,OCC
))
500 ifeq ($(gb_FULLDEPS
),$(true
))
501 $(dir $(call gb_ObjCObject_get_dep_target
,%)).
dir :
502 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
504 $(dir $(call gb_ObjCObject_get_dep_target
,%))%/.
dir :
505 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
507 $(call gb_ObjCObject_get_dep_target
,%) :
508 $(if
$(wildcard $@
),touch
$@
)
516 gb_CxxClrObject_get_source
= $(1)/$(2).
cxx
518 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
519 $(call gb_CxxClrObject_get_target
,%) : $(call gb_CxxClrObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_ALL_TARGET
)
520 $(call gb_Output_announce
,$*.
cxx,$(true
),CLR
,3)
521 $(call gb_Trace_StartRange
,$*.
cxx,CLR
)
522 $(call gb_CxxClrObject__tool_command
,$*,$<)
523 $(call gb_Trace_EndRange
,$*.
cxx,CLR
)
525 $(call gb_CxxClrObject_get_target
,%) : $(call gb_CxxClrObject_get_source
,$(SRCDIR
),%)
526 $(call gb_Output_announce
,$*.
cxx,$(true
),$(if
$(COMPILER_TEST
),C?R
,CLR
),3)
527 $(call gb_Trace_StartRange
,$*.
cxx,$(if
$(COMPILER_TEST
),C?R
,CLR
))
528 $(call gb_CObject__command_pattern
,$@
,$(T_CXXCLRFLAGS
) $(T_CXXCLRFLAGS_APPEND
),$<,$(call gb_CxxClrObject_get_dep_target
,$*),$(COMPILER_PLUGINS
),$(T_SYMBOLS
))
529 $(call gb_Trace_EndRange
,$*.
cxx,$(if
$(COMPILER_TEST
),C?R
,CLR
))
532 ifeq ($(gb_FULLDEPS
),$(true
))
533 $(dir $(call gb_CxxClrObject_get_dep_target
,%)).
dir :
534 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
536 $(dir $(call gb_CxxClrObject_get_dep_target
,%))%/.
dir :
537 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
539 $(call gb_CxxClrObject_get_dep_target
,%) :
540 $(if
$(wildcard $@
),touch
$@
)
547 $(call gb_AsmObject_get_target
,%) : $(call gb_AsmObject_get_source
,$(SRCDIR
),%)
548 $(call gb_AsmObject__command
,$@
,$*,$<,$(call gb_AsmObject_get_dep_target
,$*))
550 ifeq ($(gb_FULLDEPS
),$(true
))
551 $(dir $(call gb_AsmObject_get_dep_target
,%)).
dir :
552 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
554 $(dir $(call gb_AsmObject_get_dep_target
,%))%/.
dir :
555 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
557 $(call gb_AsmObject_get_dep_target
,%) :
558 $(if
$(wildcard $@
),touch
$@
)
565 gb_LinkTarget_DEFAULTDEFS
:= $(gb_GLOBALDEFS
)
567 .PHONY
: $(WORKDIR
)/Clean
/LinkTarget
/%
568 $(WORKDIR
)/Clean
/LinkTarget
/% :
569 $(call gb_Output_announce
,$(LINKTARGETMAKEFILENAME
),$(false
),LNK
,4)
570 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),200,\
571 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
572 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dep_target
,$(object
))) \
573 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dwo_target
,$(object
))) \
574 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
575 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dep_target
,$(object
))) \
576 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dwo_target
,$(object
))) \
577 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_target
,$(object
))) \
578 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dep_target
,$(object
))) \
579 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dwo_target
,$(object
))) \
580 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_target
,$(object
))) \
581 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dep_target
,$(object
))) \
582 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dwo_target
,$(object
))) \
583 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_target
,$(object
))) \
584 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_dep_target
,$(object
))) \
585 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_dwo_target
,$(object
))) \
586 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
587 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dep_target
,$(object
))) \
588 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dwo_target
,$(object
))) \
589 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
590 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dep_target
,$(object
))) \
591 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dwo_target
,$(object
))) \
592 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
593 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dep_target
,$(object
))) \
594 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dwo_target
,$(object
))) \
595 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_target
,$(object
))) \
596 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_dep_target
,$(object
))) \
597 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_dwo_target
,$(object
))) \
598 $(call gb_LinkTarget_get_target
,$(LINKTARGET
)) \
599 $(call gb_LinkTarget_get_dep_target
,$(LINKTARGET
)) \
600 $(call gb_LinkTarget_get_headers_target
,$(LINKTARGET
)) \
601 $(call gb_LinkTarget_get_objects_list
,$(LINKTARGET
)) \
602 $(call gb_LinkTarget_get_pch_timestamp
,$(LINKTARGETMAKEFILENAME
)) \
603 $(call gb_LinkTarget_get_pch_reuse_timestamp
,$(LINKTARGETMAKEFILENAME
)) \
606 cat
$${RESPONSEFILE} /dev
/null |
$(if
$(filter WNT
,$(OS
)),env
-i PATH
="$$PATH") xargs
-n
200 rm -fr
&& \
607 rm -f
$${RESPONSEFILE}
610 # cat the deps of all objects in one file, then we need only open that one file
611 # call gb_LinkTarget__command_dep,dep_target,linktargetname
612 define gb_LinkTarget__command_dep
613 $(call gb_Output_announce
,LNK
:$(2),$(true
),DEP
,1)
614 $(call gb_Trace_StartRange
,LNK
:$(2),DEP
)
615 $(call gb_Helper_abbreviate_dirs
,\
616 mkdir
-p
$(dir $(1)) && \
617 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),200,\
618 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dep_target
,$(object
))) \
619 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dep_target
,$(object
))) \
620 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dep_target
,$(object
)))\
621 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dep_target
,$(object
)))\
622 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_dep_target
,$(object
)))\
623 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dep_target
,$(object
)))\
624 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dep_target
,$(object
))) \
625 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dep_target
,$(object
))) \
626 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_dep_target
,$(object
))) \
628 $(call gb_Executable_get_command
,concat-deps
) $${RESPONSEFILE} > $(1)) && \
629 rm -f
$${RESPONSEFILE}
630 $(call gb_Trace_EndRange
,LNK
:$(2),DEP
)
634 # call gb_LinkTarget__command_objectlist,linktarget
635 define gb_LinkTarget__command_objectlist
636 TEMPFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),200,\
637 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
638 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
639 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_target
,$(object
))) \
640 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_target
,$(object
))) \
641 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_target
,$(object
))) \
642 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
643 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
644 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
645 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_target
,$(object
))) \
647 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),$(shell cat
$(extraobjectlist
)))) && \
652 $(WORKDIR
)/LinkTarget
/%/.
dir :
653 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
655 # Target for the .exports of the shared library, to speed up incremental build.
656 # This deliberately does nothing if the file exists; the file is actually
657 # written in gb_LinkTarget__command_dynamiclink.
658 # Put this pattern rule here so it overrides the one below.
659 # (this is rather ugly: because of % the functions cannot be used)
660 $(WORKDIR
)/LinkTarget
/Library
/%.exports
:
661 $(if
$(wildcard $@
),,mkdir
-p
$(dir $@
) && touch
$@
)
663 # This recipe actually also builds the dep-target as a side-effect, which
664 # is an optimization to reduce incremental build time.
665 # (with exception for concat-dep executable itself which does not exist yet...)
666 $(WORKDIR
)/LinkTarget
/% : $(gb_Helper_MISCDUMMY
)
667 $(call gb_LinkTarget__command_impl
,$@
,$*)
669 # call gb_LinkTarget__make_installed_rule,linktarget
670 define gb_LinkTarget__make_installed_rule
671 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_LinkTarget_get_headers_target
,$(1))
672 $$(call gb_LinkTarget__command_impl
,$(call gb_LinkTarget_get_target
,$(1)),$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)))
676 # it's not possible to use a pattern rule for files in INSTDIR because
677 # it would inevitably conflict with the pattern rule for Package
678 # (especially since external libraries are delivered via Package)
679 # call gb_LinkTarget__command_impl,linktargettarget,linktargetname
680 define gb_LinkTarget__command_impl
682 $(if
$(findstring concat-deps
,$(2)),,
683 $(call gb_LinkTarget__command_dep
,$(call gb_LinkTarget_get_dep_target
,$(2)).tmp
,$(2))
684 mv
$(call gb_LinkTarget_get_dep_target
,$(2)).tmp
$(call gb_LinkTarget_get_dep_target
,$(2))))
685 $(if
$(filter $(2),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library__get_workdir_linktargetname
,$(lib
)))),
686 $(if
$(filter $(true
),$(call gb_LinkTarget__is_build_lib
,$(2))),
687 $(call gb_LinkTarget__command
,$(1),$(2)),
688 mkdir
-p
$(dir $(1)) && echo invalid
- merged lib
> $(1)
689 $(if
$(SOVERSIONSCRIPT
),&& echo invalid
- merged lib
> $(WORKDIR
)/LinkTarget
/$(2))),
690 $(if
$(filter-out CompilerTest
,$(TARGETTYPE
)),
691 $(call gb_LinkTarget__command
,$(1),$(2))))
692 $(call gb_LinkTarget__command_objectlist
,$(WORKDIR
)/LinkTarget
/$(2).objectlist
)
695 ifeq ($(gb_FULLDEPS
),$(true
))
696 $(call gb_LinkTarget_get_dep_target
,%) : $(call gb_Executable_get_runtime_dependencies
,concat-deps
)
697 $(call gb_LinkTarget__command_dep
,$@
,$*)
700 # Ok, this is some dark voodoo: When declaring a linktarget with
701 # gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the
702 # target. When the rule for the headertarget is executed and SELF does not
703 # match the target name, we are depending on a linktarget that was never
704 # declared. In a full build exclusively in gbuild that should never happen.
705 define gb_LinkTarget__get_headers_check
707 $$(eval
$$(call gb_Output_error
,used LinkTarget
$$* not defined
))
709 $$@
: COMMAND
:= $$(call gb_Helper_abbreviate_dirs
, touch
$$@
)
713 $(WORKDIR
)/Headers
/%/.
dir :
714 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
716 # sadly because of the subdirectories can't have pattern deps on .dir here
717 $(WORKDIR
)/Headers
/% :
718 $(eval
$(gb_LinkTarget__get_headers_check
))
721 # Explanation of some of the targets:
722 # - gb_LinkTarget_get_headers_target is the target that guarantees all headers
723 # from the linked against libraries and the linktargets own generated headers
725 # - gb_LinkTarget_get_target links the objects into a file in WORKDIR.
726 # gb_LinkTarget_get_target depends on gb_LinkTarget_get_headers_target.
727 # gb_LinkTarget_get_target depends additionally on the objects, which in turn
728 # depend build-order only on the gb_LinkTarget_get_headers_target. The build
729 # order-only dependency ensures all headers to be there for compiling and
730 # dependency generation without causing all objects to be rebuild when one
731 # header changes. Only the ones with an explicit dependency in their generated
732 # dependency file will be rebuild.
734 # gb_LinkTarget_get_target is the target that links the objects into a file in
736 # Explanation of some of the variables:
737 # - AUXTARGETS are the additionally generated files that need to be cleaned out
739 # - PCH_CXXFLAGS and PCH_DEFS are the flags that the precompiled headers will
740 # be compiled with. They should never be overridden in a single object
742 # - TARGETTYPE is the type of linktarget as some platforms need very different
743 # command to link different targettypes.
744 # - LIBRARY_X64 is only relevant for building a x64 library on windows.
745 # - PE_X86 is only relevant for building a x86 binaries on Windows.
747 # Since most variables are set on the linktarget and not on the object, the
748 # object learns about these setting via GNU makes scoping of target variables.
749 # Therefore it is important that objects are only directly depended on by the
750 # linktarget. This for example means that you cannot build a single object
751 # alone, because then you would directly depend on the object.
753 # A note about flags: because the overriding the global variables with a target
754 # local variable of the same name is considered obscure, the target local
755 # variables have a T_ prefix.
757 # call gb_LinkTarget_LinkTarget,linktarget,linktargetmakefilename,layer
758 define gb_LinkTarget_LinkTarget
759 $(call gb_LinkTarget_get_clean_target
,$(1)) : LINKTARGET
:= $(1)
760 $(call gb_LinkTarget_get_clean_target
,$(1)) : LINKTARGETMAKEFILENAME
:= $(2)
761 $(call gb_LinkTarget_get_clean_target
,$(1)) : AUXTARGETS
:=
762 $(call gb_LinkTarget_get_headers_target
,$(1)) : SELF
:= $(call gb_LinkTarget__get_workdir_linktargetname
,$(1))
763 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
764 |
$(dir $(call gb_LinkTarget_get_headers_target
,$(1))).
dir \
765 $(dir $(call gb_LinkTarget_get_target
,$(1))).
dir \
766 $(dir $(WORKDIR
)/LinkTarget
/$(call gb_LinkTarget__get_workdir_linktargetname
,$(1))).
dir
767 $(call gb_LinkTarget_get_target
,$(1)) : ILIBTARGET
:=
768 $(call gb_LinkTarget_get_clean_target
,$(1)) \
769 $(call gb_LinkTarget_get_target
,$(1)) : COBJECTS
:=
770 $(call gb_LinkTarget_get_clean_target
,$(1)) \
771 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
:=
772 $(call gb_LinkTarget_get_clean_target
,$(1)) \
773 $(call gb_LinkTarget_get_target
,$(1)) : YACCOBJECT
:=
774 $(call gb_LinkTarget_get_target
,$(1)) : T_YACCFLAGS
:= $$(gb_LinkTarget_YYACFLAGS
) $(YACCFLAGS
)
775 $(call gb_LinkTarget_get_clean_target
,$(1)) \
776 $(call gb_LinkTarget_get_target
,$(1)) : LEXOBJECT
:=
777 $(call gb_LinkTarget_get_target
,$(1)) : T_LEXFLAGS
:= $$(gb_LinkTarget_LEXFLAGS
) $(LEXFLAGS
)
778 $(call gb_LinkTarget_get_clean_target
,$(1)) \
779 $(call gb_LinkTarget_get_target
,$(1)) : OBJCOBJECTS
:=
780 $(call gb_LinkTarget_get_clean_target
,$(1)) \
781 $(call gb_LinkTarget_get_target
,$(1)) : OBJCXXOBJECTS
:=
782 $(call gb_LinkTarget_get_clean_target
,$(1)) \
783 $(call gb_LinkTarget_get_target
,$(1)) : CXXCLROBJECTS
:=
784 $(call gb_LinkTarget_get_clean_target
,$(1)) \
785 $(call gb_LinkTarget_get_target
,$(1)) : ASMOBJECTS
:=
786 $(call gb_LinkTarget_get_clean_target
,$(1)) \
787 $(call gb_LinkTarget_get_target
,$(1)) : GENCOBJECTS
:=
788 $(call gb_LinkTarget_get_clean_target
,$(1)) \
789 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXOBJECTS
:=
790 $(call gb_LinkTarget_get_clean_target
,$(1)) \
791 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXCLROBJECTS
:=
792 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS
:= $$(gb_LinkTarget_CFLAGS
)
793 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS_APPEND
:=
794 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS
:= $$(gb_LinkTarget_CXXFLAGS
)
795 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS_APPEND
:=
796 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
:= $$(gb_LinkTarget_CXXFLAGS
)
797 $(call gb_LinkTarget_get_target
,$(1)) : OBJECT_HAS_EXTRA_CXXFLAGS
:=
798 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS
:= $$(gb_LinkTarget_OBJCXXFLAGS
)
799 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS_APPEND
:=
800 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS
:= $$(gb_LinkTarget_OBJCFLAGS
)
801 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS_APPEND
:=
802 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXCLRFLAGS
:= $$(gb_LinkTarget_CXXCLRFLAGS
)
803 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXCLRFLAGS_APPEND
:=
804 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
:= $$(gb_LinkTarget_DEFAULTDEFS
) $(CPPFLAGS
)
805 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
:= $$(gb_LinkTarget_DEFAULTDEFS
) $(CPPFLAGS
)
806 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
:= $$(gb_LinkTarget_INCLUDE
)
807 $(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))
808 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
:=
809 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_STATIC_LIBS
:=
810 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
:=
811 $(call gb_LinkTarget_get_target
,$(1)) : T_STDLIBS_CXX
:= $(gb_STDLIBS_CXX
)
812 $(call gb_LinkTarget_get_target
,$(1)) : TARGETTYPE
:=
813 $(call gb_LinkTarget_get_target
,$(1)) : LIBRARY_X64
:=
814 $(call gb_LinkTarget_get_target
,$(1)) : PCH_NAME
:=
815 $(call gb_LinkTarget_get_target
,$(1)) : PCH_HEADER
:=
816 $(call gb_LinkTarget_get_target
,$(1)) : PCH_LINKTARGETMAKEFILENAME
:=
817 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
:=
818 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
:=
819 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJNOEX
:=
820 $(call gb_LinkTarget_get_target
,$(1)) : T_PCH_EXTRA_CXXFLAGS
:=
821 $(call gb_LinkTarget_get_target
,$(1)) : PE_X86
:=
822 $(call gb_LinkTarget_get_target
,$(1)) : PDBFILE
:=
823 $(call gb_LinkTarget_get_target
,$(1)) : TARGETGUI
:=
824 $(call gb_LinkTarget_get_target
,$(1)) : EXTRAOBJECTLISTS
:=
825 $(call gb_LinkTarget_get_target
,$(1)) : NATIVERES
:=
826 $(call gb_LinkTarget_get_target
,$(1)) : VISIBILITY
:=
827 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_NOT_ERRORS
:=
828 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_DISABLED
:=
829 $(call gb_LinkTarget_get_target
,$(1)) : PLUGIN_WARNINGS_AS_ERRORS
:=
830 $(call gb_LinkTarget_get_target
,$(1)) : EXTERNAL_CODE
:=
831 $(call gb_LinkTarget_get_target
,$(1)) : SOVERSIONSCRIPT
:=
832 $(call gb_LinkTarget_get_target
,$(1)) : COMPILER_TEST
:=
833 $(call gb_LinkTarget_get_target
,$(1)) : T_SYMBOLS
:= $(if
$(call gb_LinkTarget__symbols_enabled
,$(2)),$(true
),$(false
))
834 $(call gb_LinkTarget_get_target
,$(1)) : T_CC
:=
835 $(call gb_LinkTarget_get_target
,$(1)) : T_CXX
:=
836 $(call gb_LinkTarget_get_target
,$(1)) : T_USE_LD
:= $(USE_LD
)
838 ifeq ($(gb_FULLDEPS
),$(true
))
839 ifeq (depcache
:,$(filter depcache
,$(.FEATURES
)):$(gb_PARTIAL_BUILD
))
840 -includedepcache
$(call gb_LinkTarget_get_dep_target
,$(1))
842 -include $(call gb_LinkTarget_get_dep_target
,$(1))
844 $(call gb_LinkTarget_get_dep_target
,$(1)) : COBJECTS
:=
845 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXOBJECTS
:=
846 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCOBJECTS
:=
847 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCXXOBJECTS
:=
848 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXCLROBJECTS
:=
849 $(call gb_LinkTarget_get_dep_target
,$(1)) : ASMOBJECTS
:=
850 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCOBJECTS
:=
851 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXOBJECTS
:=
852 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXCLROBJECTS
:=
853 $(call gb_LinkTarget_get_dep_target
,$(1)) : YACCOBJECTS
:=
856 gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)) := cxx
858 # installed linktargets need a rule to build!
859 $(if
$(findstring $(INSTDIR
),$(1)),$(call gb_LinkTarget__make_installed_rule
,$(1)))
861 $(call gb_PrecompiledHeader_generate_timestamp_rule
,$(2))
865 # call gb_LinkTarget_set_soversion_script,linktarget,soversionscript
866 define gb_LinkTarget_set_soversion_script
867 $(call gb_LinkTarget_get_target
,$(1)) : $(2)
868 $(call gb_LinkTarget_get_target
,$(1)) : SOVERSIONSCRIPT
:= $(2)
872 # call gb_LinkTarget_add_defs,linktarget,defines
873 define gb_LinkTarget_add_defs
874 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
+= $(2)
875 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
+= $(2)
878 # call gb_LinkTarget_add_cflags,linktarget,cflags
879 define gb_LinkTarget_add_cflags
880 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS_APPEND
+= $(2)
883 # call gb_LinkTarget_add_cxxflags,linktarget,cxxflags
884 define gb_LinkTarget_add_cxxflags
885 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS_APPEND
+= $(2)
886 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
+= $(2)
889 # call gb_LinkTarget_add_objcxxflags,linktarget,objcxxflags
890 define gb_LinkTarget_add_objcxxflags
891 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS_APPEND
+= $(2)
894 # call gb_LinkTarget_add_objcflags,linktarget,objcflags
895 define gb_LinkTarget_add_objcflags
896 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS_APPEND
+= $(2)
900 # call gb_LinkTarget_add_cxxclrflags,linktarget,cxxclrflags
901 define gb_LinkTarget_add_cxxclrflags
902 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXCLRFLAGS_APPEND
+= $(2)
905 # call gb_LinkTarget__add_include,linktarget,includes
906 define gb_LinkTarget__add_include
907 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
+= -I
$(2)
911 # call gb_LinkTarget__check_srcdir_paths,linktarget,includepaths
912 define gb_LinkTarget__check_srcdir_paths
913 $(if
$(filter-out $(wildcard $(2)),$(2)),\
914 $(call gb_Output_error
,gb_LinkTarget_set_include
: include paths
$(filter-out $(wildcard $(2)),$(2)) do not exist
) \
918 # call gb_LinkTarget_set_include,linktarget,includes
919 define gb_LinkTarget_set_include
920 $(call gb_LinkTarget__check_srcdir_paths
,$(1),\
921 $(patsubst -I
%,%,$(filter -I
$(SRCDIR
)/%,$(filter-out -I
$(WORKDIR
)/%,$(2)))))
922 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
:= $(2)
926 # call gb_LinkTarget_add_ldflags,linktarget,ldflags
927 define gb_LinkTarget_add_ldflags
928 $(call gb_LinkTarget_get_target
,$(1)) : T_LDFLAGS
+= $(2)
932 # real use in RepositoryExternal.mk
933 # call gb_LinkTarget_set_ldflags,linktarget,ldflags
934 define gb_LinkTarget_set_ldflags
935 $(call gb_LinkTarget_get_target
,$(1)) : T_LDFLAGS
:= $(2)
939 # call gb_LinkTarget_add_libs,linktarget,libs
940 define gb_LinkTarget_add_libs
941 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
+= $(2)
942 $(if
$(call gb_LinkTarget__is_merged
,$(1)),\
943 $(call gb_LinkTarget_get_target
,$(call gb_Library_get_linktarget
,merged
)) : T_LIBS
+= $(2))
947 # remove platform specific standard libraries for linktarget $(1)
948 # assumption is that adding these standard libs is always useful, but in very
949 # exceptional cases this disable method may be used
950 # call gb_LinkTarget_disable_standard_system_libs,linktarget
951 define gb_LinkTarget_disable_standard_system_libs
952 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
:= $$(filter-out $$(gb_STDLIBS
),$$(T_LIBS
))
953 $(call gb_LinkTarget_get_target
,$(1)) : T_STDLIBS_CXX
:=
957 # call gb_LinkTarget__use_api,linktarget,api
958 define gb_LinkTarget__use_api
959 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(call gb_UnoApiHeadersTarget_get_target
,$(2))
960 $(call gb_LinkTarget__add_include
,$(1),$(call gb_UnoApiHeadersTarget_get_dir
,$(2)))
964 # call gb_LinkTarget_use_api,linktarget,apis
965 define gb_LinkTarget_use_api
966 $(foreach api
,$(2),$(call gb_LinkTarget__use_api
,$(1),$(api
)))
970 # call gb_LinkTarget_use_udk_api,linktarget
971 define gb_LinkTarget_use_udk_api
972 $(call gb_LinkTarget__use_api
,$(1),udkapi
)
975 # call gb_LinkTarget_use_sdk_api,linktarget
976 define gb_LinkTarget_use_sdk_api
977 $(call gb_LinkTarget__use_api
,$(1),udkapi
)
978 $(call gb_LinkTarget__use_api
,$(1),offapi
)
981 # call gb_LinkTarget__use_internal_api_one,linktarget,api,apiprefix
982 define gb_LinkTarget__use_internal_api_one
983 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
984 $(call gb_UnoApiHeadersTarget_get_
$(3)target
,$(2))
985 $(call gb_LinkTarget__add_include
,$(1),$(call gb_UnoApiHeadersTarget_get_
$(3)dir,$(2)))
989 # call gb_LinkTarget__use_internal_api,linktarget,apis,apiprefix
990 define gb_LinkTarget__use_internal_api
991 $(foreach api
,$(2),$(call gb_LinkTarget__use_internal_api_one
,$(1),$(api
),$(3)))
995 # call gb_LinkTarget_use_internal_api,linktarget,api
996 define gb_LinkTarget_use_internal_api
997 $(call gb_LinkTarget__use_internal_api
,$(1),$(2))
1001 # call gb_LinkTarget_use_internal_bootstrap_api,linktarget,api
1002 define gb_LinkTarget_use_internal_bootstrap_api
1003 $(call gb_LinkTarget__use_internal_api
,$(1),$(2),bootstrap_
)
1007 # call gb_LinkTarget_use_internal_comprehensive_api,linktarget,api
1008 define gb_LinkTarget_use_internal_comprehensive_api
1009 $(call gb_LinkTarget__use_internal_api
,$(1),$(2),comprehensive_
)
1013 define gb_PrintDeps_info
1014 $(info LibraryDep
: $(1) links against
$(2))
1017 # avoid problem when a module is built partially but other modules that define
1018 # needed libraries is not yet built: prevent invocation of pattern rule
1019 # for library with invalid parameters by depending on the header target
1020 define gb_LinkTarget__lib_dummy_depend
1021 $(call gb_Library_get_target
,$(1)) :|
$(call gb_Library_get_headers_target
,$(1))
1025 # call gb_LinkTarget__use_libraries,linktarget,requestedlibs,actuallibs,linktargetmakefilename
1026 define gb_LinkTarget__use_libraries
1028 # used by bin/module-deps.pl
1029 ifneq ($(ENABLE_PRINT_DEPS
),)
1030 # exclude libraries in Library_merged
1031 ifeq ($(filter $(1),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library_get_linktarget
,$(lib
)))),)
1032 $$(eval
$$(call gb_PrintDeps_info
,$(4),$(3)))
1036 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
+= $(3)
1038 # depend on the exports of the library, not on the library itself
1039 # for faster incremental builds when the ABI is unchanged
1040 ifeq ($(DISABLE_DYNLOADING
),)
1041 $(call gb_LinkTarget_get_target
,$(1)) : \
1042 $(foreach lib
,$(3),$(call gb_Library_get_exports_target
,$(lib
)))
1044 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
1045 $(foreach lib
,$(2),$(call gb_Library_get_headers_target
,$(lib
)))
1046 $(foreach lib
,$(2),$(call gb_LinkTarget__lib_dummy_depend
,$(lib
)))
1050 # libraries which are merged but need to be built for gb_BUILD_HELPER_TOOLS
1051 gb_BUILD_HELPER_LIBS
:= basegfx \
1066 # tools libmerged depends on, so they link against gb_BUILD_HELPER_LIBS
1067 gb_BUILD_HELPER_TOOLS
:= $(foreach exe
,\
1072 , $(call gb_Executable__get_workdir_linktargetname
,$(exe
)))
1074 # call gb_LinkTarget__is_build_lib,linktargetname
1075 define gb_LinkTarget__is_build_lib
1076 $(if
$(filter $(call gb_LinkTarget__get_workdir_linktargetname
,$(1)),$(foreach lib
,$(gb_BUILD_HELPER_LIBS
),$(call gb_Library__get_workdir_linktargetname
,$(lib
)))),$(true
),$(false
))
1079 # call gb_LinkTarget__is_build_tool,linktargetname
1080 define gb_LinkTarget__is_build_tool
1081 $(if
$(filter $(call gb_LinkTarget__get_workdir_linktargetname
,$(1)),$(call gb_BUILD_HELPER_TOOLS
)),$(true
),$(false
))
1084 define gb_LinkTarget__is_merged
1085 $(filter $(1),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library_get_linktarget
,$(lib
))))
1088 # call gb_LinkTarget_use_libraries,linktarget,libs
1089 define gb_LinkTarget_use_libraries
1090 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS
),$(2)))
1091 $$(eval
$$(call gb_Output_info
,currently known libraries are
: $(sort $(gb_Library_KNOWNLIBS
)),ALL
))
1092 $$(eval
$$(call gb_Output_error
,Cannot link against library
/libraries
$$(filter-out $(gb_Library_KNOWNLIBS
),$(2)). Libraries must be registered in Repository.mk or RepositoryExternal.mk
))
1095 ifeq ($(call gb_LinkTarget__is_build_tool
,$(1)),$(true
))
1096 $(call gb_LinkTarget__use_libraries
,$(1),$(2),$(2),$(4))
1098 $(call gb_LinkTarget__use_libraries
,$(1),$(2),$(strip \
1099 $(if
$(filter $(gb_MERGEDLIBS
),$(2)), \
1100 $(if
$(call gb_LinkTarget__is_merged
,$(1)), \
1101 $(filter $(gb_MERGEDLIBS
),$(2)), merged
)) \
1102 $(filter-out $(gb_MERGEDLIBS
),$(2)) \
1108 # avoid problem when a module is built partially but other modules that define
1109 # needed static libraries is not yet built: prevent invocation of pattern rule
1110 # for static library with invalid parameters by depending on the header target
1111 define gb_LinkTarget__static_lib_dummy_depend
1112 $(call gb_StaticLibrary_get_target
,$(1)) :| \
1113 $(call gb_StaticLibrary_get_headers_target
,$(1))
1117 # for a StaticLibrary, dependent libraries are not actually linked in
1118 # call gb_LinkTarget_use_static_libraries,linktarget,staticlibs
1119 define gb_LinkTarget_use_static_libraries
1120 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_STATIC_LIBS
+= $$(if
$$(filter-out StaticLibrary
,$$(TARGETTYPE
)),$(2))
1121 $(if
$(call gb_LinkTarget__is_merged
,$(1)),\
1122 $(call gb_LinkTarget_get_target
,$(call gb_Library_get_linktarget
,merged
)) : \
1123 LINKED_STATIC_LIBS
+= $$(if
$$(filter-out StaticLibrary
,$$(TARGETTYPE
)),$(2)))
1125 ifeq ($(DISABLE_DYNLOADING
),)
1126 $(call gb_LinkTarget_get_target
,$(1)) : $(foreach lib
,$(2),$(call gb_StaticLibrary_get_target
,$(lib
)))
1128 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
1129 $(foreach lib
,$(2),$(call gb_StaticLibrary_get_headers_target
,$(lib
)))
1130 $(foreach lib
,$(2),$(call gb_LinkTarget__static_lib_dummy_depend
,$(lib
)))
1134 # call gb_LinkTarget_add_cobject,linktarget,sourcefile,cflags,linktargetmakefilename
1135 define gb_LinkTarget_add_cobject
1136 $(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)))))
1137 $(call gb_LinkTarget_get_target
,$(1)) : COBJECTS
+= $(2)
1138 $(call gb_LinkTarget_get_clean_target
,$(1)) : COBJECTS
+= $(2)
1140 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CObject_get_target
,$(2))
1141 $(call gb_CObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1142 $(call gb_CObject_get_target
,$(2)) : T_CFLAGS
+= $(call gb_LinkTarget__get_cflags
,$(4)) $(3)
1143 $(call gb_CObject_get_target
,$(2)) : \
1144 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1146 ifeq ($(gb_FULLDEPS
),$(true
))
1147 $(call gb_LinkTarget_get_dep_target
,$(1)) : COBJECTS
+= $(2)
1148 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CObject_get_dep_target
,$(2))
1149 $(call gb_CObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CObject_get_dep_target
,$(2))).
dir
1150 $(call gb_CObject_get_target
,$(2)) :|
$(dir $(call gb_CObject_get_dep_target
,$(2))).
dir
1155 # call gb_LinkTarget_add_cxxobject_internal,linktarget,sourcefile,cxxflags,linktargetmakefilename,exceptionflags
1156 # The purpose of the exceptionflags extra argument is to differentiate between usage that just needs
1157 # exception flags and usage that adds other flags. Using a PCH requires the same cxxflags as the ones used
1158 # to create the PCH, so non-empty cxxflags here mean the object cannot use the PCH, and the add_exception_cxxobject
1159 # variant passes the necessary flags by setting the extra argument.
1160 define gb_LinkTarget_add_cxxobject_internal
1161 $(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)))))
1162 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
+= $(2)
1163 $(call gb_LinkTarget_get_clean_target
,$(1)) : CXXOBJECTS
+= $(2)
1165 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CxxObject_get_target
,$(2))
1166 $(call gb_CxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1167 $(call gb_CxxObject_get_target
,$(2)) : T_CXXFLAGS
+= $(call gb_LinkTarget__get_cxxflags
,$(4)) $(3) $(5)
1168 $(call gb_CxxObject_get_target
,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS
:= $(if
$(strip $(3)),1)
1169 $(call gb_CxxObject_get_target
,$(2)) : \
1170 OBJECTOWNER
:= $(if
$(6),,$(call gb_Object__owner
,$(2),$(1)))
1171 ifneq ($(gb_ENABLE_PCH
),)
1173 $(call gb_CxxObject_get_target
,$(2)) : $(call gb_LinkTarget_get_pch_timestamp
,$(4))
1177 ifeq ($(gb_FULLDEPS
),$(true
))
1178 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXOBJECTS
+= $(2)
1179 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CxxObject_get_dep_target
,$(2))
1180 $(call gb_CxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CxxObject_get_dep_target
,$(2))).
dir
1181 $(call gb_CxxObject_get_target
,$(2)) :|
$(dir $(call gb_CxxObject_get_dep_target
,$(2))).
dir
1186 # call gb_LinkTarget_add_cxxobject,linktarget,sourcefile,cxxflags,linktargetmakefilename
1187 define gb_LinkTarget_add_cxxobject
1188 $(call gb_LinkTarget_add_cxxobject_internal
,$(1),$(2),$(3),$(4))
1191 # call gb_LinkTarget_add_objcobject,linktarget,sourcefile,objcflags,linktargetmakefilename
1192 define gb_LinkTarget_add_objcobject
1193 $(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)))))
1194 $(call gb_LinkTarget_get_target
,$(1)) : OBJCOBJECTS
+= $(2)
1195 $(call gb_LinkTarget_get_clean_target
,$(1)) : OBJCOBJECTS
+= $(2)
1197 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_ObjCObject_get_target
,$(2))
1198 $(call gb_ObjCObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1199 $(call gb_ObjCObject_get_target
,$(2)) : T_OBJCFLAGS
+= $(call gb_LinkTarget__get_objcflags
,$(4)) $(3)
1200 $(call gb_ObjCObject_get_target
,$(2)) : \
1201 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1203 ifeq ($(gb_FULLDEPS
),$(true
))
1204 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCOBJECTS
+= $(2)
1205 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_ObjCObject_get_dep_target
,$(2))
1206 $(call gb_ObjCObject_get_dep_target
,$(2)) :|
$(dir $(call gb_ObjCObject_get_dep_target
,$(2))).
dir
1207 $(call gb_ObjCObject_get_target
,$(2)) :|
$(dir $(call gb_ObjCObject_get_dep_target
,$(2))).
dir
1212 # call gb_LinkTarget_add_objcxxobject,linktarget,sourcefile,objcxxflags,linktargetmakefilename
1213 define gb_LinkTarget_add_objcxxobject
1214 $(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)))))
1215 $(call gb_LinkTarget_get_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
1216 $(call gb_LinkTarget_get_clean_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
1218 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_ObjCxxObject_get_target
,$(2))
1219 $(call gb_ObjCxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1220 $(call gb_ObjCxxObject_get_target
,$(2)) : T_OBJCXXFLAGS
+= $(call gb_LinkTarget__get_objcxxflags
,$(4)) $(3)
1221 $(call gb_ObjCxxObject_get_target
,$(2)) : \
1222 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1224 ifeq ($(gb_FULLDEPS
),$(true
))
1225 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
1226 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_ObjCxxObject_get_dep_target
,$(2))
1227 $(call gb_ObjCxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_ObjCxxObject_get_dep_target
,$(2))).
dir
1228 $(call gb_ObjCxxObject_get_target
,$(2)) :|
$(dir $(call gb_ObjCxxObject_get_dep_target
,$(2))).
dir
1233 # call gb_LinkTarget_add_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
1234 define gb_LinkTarget_add_cxxclrobject
1235 $(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)))))
1236 $(call gb_LinkTarget_get_target
,$(1)) : CXXCLROBJECTS
+= $(2)
1237 $(call gb_LinkTarget_get_clean_target
,$(1)) : CXXCLROBJECTS
+= $(2)
1239 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CxxClrObject_get_target
,$(2))
1240 $(call gb_CxxClrObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1241 $(call gb_CxxClrObject_get_target
,$(2)) : T_CXXCLRFLAGS
+= $(call gb_LinkTarget__get_cxxclrflags
,$(4)) $(3)
1242 $(call gb_CxxClrObject_get_target
,$(2)) : \
1243 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1245 ifeq ($(gb_FULLDEPS
),$(true
))
1246 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXCLROBJECTS
+= $(2)
1247 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CxxClrObject_get_dep_target
,$(2))
1248 $(call gb_CxxClrObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CxxClrObject_get_dep_target
,$(2))).
dir
1249 $(call gb_CxxClrObject_get_target
,$(2)) :|
$(dir $(call gb_CxxClrObject_get_dep_target
,$(2))).
dir
1254 # call gb_LinkTarget_add_asmobject,linktarget,sourcefile
1255 define gb_LinkTarget_add_asmobject
1256 $(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)))))
1257 $(call gb_LinkTarget_get_target
,$(1)) : ASMOBJECTS
+= $(2)
1258 $(call gb_LinkTarget_get_clean_target
,$(1)) : ASMOBJECTS
+= $(2)
1260 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_AsmObject_get_target
,$(2))
1261 $(call gb_AsmObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1262 $(call gb_AsmObject_get_target
,$(2)) : \
1263 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1265 ifeq ($(gb_FULLDEPS
),$(true
))
1266 $(call gb_LinkTarget_get_dep_target
,$(1)) : ASMOBJECTS
+= $(2)
1267 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_AsmObject_get_dep_target
,$(2))
1268 $(call gb_AsmObject_get_dep_target
,$(2)) :|
$(dir $(call gb_AsmObject_get_dep_target
,$(2))).
dir
1269 $(call gb_AsmObject_get_target
,$(2)) :|
$(dir $(call gb_AsmObject_get_dep_target
,$(2))).
dir
1274 # call gb_LinkTarget_add_generated_c_object,linktarget,sourcefile,cflags,linktargetmakefilename
1275 define gb_LinkTarget_add_generated_c_object
1276 $(call gb_LinkTarget_get_target
,$(1)) : GENCOBJECTS
+= $(2)
1277 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCOBJECTS
+= $(2)
1279 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCObject_get_target
,$(2))
1280 $(call gb_GenCObject_get_target
,$(2)) : $(call gb_GenCObject_get_source
,$(2))
1281 # Often gb_GenCObject_get_source does not have its own rule and is only a byproduct.
1282 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1283 $(call gb_GenCObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1284 $(call gb_GenCObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1285 $(call gb_GenCObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1286 $(call gb_GenCObject_get_target
,$(2)) : T_CFLAGS
+= $(call gb_LinkTarget__get_cflags
,$(4)) $(3)
1287 $(call gb_GenCObject_get_target
,$(2)) : \
1288 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1290 ifeq ($(gb_FULLDEPS
),$(true
))
1291 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCOBJECTS
+= $(2)
1292 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCObject_get_dep_target
,$(2))
1293 $(call gb_GenCObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCObject_get_dep_target
,$(2))).
dir
1294 $(call gb_GenCObject_get_target
,$(2)) :|
$(dir $(call gb_GenCObject_get_dep_target
,$(2))).
dir
1299 # call gb_LinkTarget_add_generated_cxx_object_internal,linktarget,sourcefile,cxxflags,linktargetmakefilename,exceptionflags
1300 define gb_LinkTarget_add_generated_cxx_object_internal
1301 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1302 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1304 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCxxObject_get_target
,$(2))
1305 $(call gb_GenCxxObject_get_target
,$(2)) : $(call gb_GenCxxObject_get_source
,$(2),$(1))
1306 # Often gb_GenCxxObject_get_source does not have its own rule and is only a byproduct.
1307 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1308 $(call gb_GenCxxObject_get_source
,$(2),$(1)) : |
$(gb_Helper_MISCDUMMY
)
1309 $(call gb_GenCxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1310 $(call gb_GenCxxObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1311 $(call gb_GenCxxObject_get_target
,$(2)) : T_CXXFLAGS
+= $(call gb_LinkTarget__get_cxxflags
,$(4)) $(3) $(5)
1312 $(call gb_GenCxxObject_get_target
,$(2)) : OBJECT_HAS_EXTRA_CXXFLAGS
:= $(if
$(strip $(3)),1)
1313 $(call gb_GenCxxObject_get_target
,$(2)) : \
1314 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1315 $(call gb_GenCxxObject_get_target
,$(2)) : GEN_CXX_SOURCE
:= $(call gb_GenCxxObject_get_source
,$(2),$(1))
1316 ifneq ($(gb_ENABLE_PCH
),)
1317 $(call gb_GenCxxObject_get_target
,$(2)) : $(call gb_LinkTarget_get_pch_timestamp
,$(4))
1320 ifeq ($(gb_FULLDEPS
),$(true
))
1321 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1322 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCxxObject_get_dep_target
,$(2))
1323 $(call gb_GenCxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCxxObject_get_dep_target
,$(2))).
dir
1324 $(call gb_GenCxxObject_get_target
,$(2)) :|
$(dir $(call gb_GenCxxObject_get_dep_target
,$(2))).
dir
1329 # call gb_LinkTarget_add_generated_cxx_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1330 define gb_LinkTarget_add_generated_cxx_object
1331 $(call gb_LinkTarget_add_generated_cxx_object_internal
,$(1),$(2),$(3),$(4))
1334 # call gb_LinkTarget_add_generated_cxxclrobject,linktarget,sourcefile,cxxclrflags,linktargetmakefilename
1335 define gb_LinkTarget_add_generated_cxxclrobject
1336 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXCLROBJECTS
+= $(2)
1337 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCXXCLROBJECTS
+= $(2)
1339 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCxxClrObject_get_target
,$(2))
1340 $(call gb_GenCxxClrObject_get_target
,$(2)) : $(call gb_GenCxxClrObject_get_source
,$(2),$(1))
1341 $(call gb_GenCxxClrObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1342 $(call gb_GenCxxClrObject_get_target
,$(2)) : T_CXXCLRFLAGS
+= $(call gb_LinkTarget__get_cxxclrflags
,$(4)) $(3)
1343 $(call gb_GenCxxClrObject_get_target
,$(2)) : \
1344 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1345 $(call gb_GenCxxClrObject_get_target
,$(2)) : GEN_CXXCLR_SOURCE
:= $(call gb_GenCxxClrObject_get_source
,$(2),$(1))
1347 ifeq ($(gb_FULLDEPS
),$(true
))
1348 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXCLROBJECTS
+= $(2)
1349 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCxxClrObject_get_dep_target
,$(2))
1350 $(call gb_GenCxxClrObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCxxClrObject_get_dep_target
,$(2))).
dir
1351 $(call gb_GenCxxClrObject_get_target
,$(2)) :|
$(dir $(call gb_GenCxxClrObject_get_dep_target
,$(2))).
dir
1356 # Add a bison grammar to the build.
1357 # call gb_LinkTarget_add_grammar,linktarget,yaccfile,cxxflags,linktargetmakefilename
1358 define gb_LinkTarget_add_grammar
1359 $(call gb_YaccTarget_YaccTarget
,$(2))
1360 $(call gb_LinkTarget_add_generated_exception_object
,$(1),YaccTarget
/$(2),$(3) $(if
$(filter GCC
,$(COM
)),-Wno-unused-macros
),$(4))
1361 $(call gb_GenCxxObject_get_target
,YaccTarget
/$(2)): PLUGIN_WARNINGS_AS_ERRORS
:= $(true
)
1362 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_YaccTarget_get_clean_target
,$(2))
1363 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(call gb_YaccTarget_get_header_target
,$(2))
1364 $(call gb_LinkTarget__add_include
,$(1),$(dir $(call gb_YaccTarget_get_header_target
,$(2))))
1368 # Add bison grammars to the build.
1369 # call gb_LinkTarget_add_grammars,linktarget,yaccfiles,cxxflags,linktargetmakefilename
1370 define gb_LinkTarget_add_grammars
1371 $(foreach grammar
,$(2),$(call gb_LinkTarget_add_grammar
,$(1),$(grammar
),$(3),$(4)))
1374 # Add a flex scanner to the build.
1375 # call gb_LinkTarget_add_scanner,linktarget,lexfile,cxxflags,linktargetmakefilename
1376 define gb_LinkTarget_add_scanner
1377 $(call gb_LexTarget_LexTarget
,$(2))
1378 $(call gb_LinkTarget_add_generated_exception_object
,$(1),LexTarget
/$(2),$(3) $(if
$(filter GCC
,$(COM
)),-Wno-unused-macros
),$(4))
1379 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_LexTarget_get_clean_target
,$(2))
1383 # Add flex scanners to the build.
1384 # call gb_LinkTarget_add_scanners,linktarget,lexfiles,cxxflags,linktargetmakefilename
1385 define gb_LinkTarget_add_scanners
1386 $(foreach scanner
,$(2),$(call gb_LinkTarget_add_scanner
,$(1),$(scanner
),$(3),$(4)))
1390 # call gb_LinkTarget_add_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1391 define gb_LinkTarget_add_exception_object
1392 $(call gb_LinkTarget_add_cxxobject_internal
,$(1),$(2),$(3),$(4),$(gb_LinkTarget_EXCEPTIONFLAGS
))
1395 # call gb_LinkTarget__use_linktarget_objects,linktarget,linktargets
1396 define gb_LinkTarget__use_linktarget_objects
1397 $(call gb_LinkTarget_get_target
,$(1)) : $(foreach linktarget
,$(2),$(call gb_LinkTarget_get_target
,$(linktarget
)))
1399 $(call gb_LinkTarget_get_target
,$(1)) : EXTRAOBJECTLISTS
+= $(foreach linktarget
,$(2),$(call gb_LinkTarget_get_objects_list
,$(linktarget
)))
1404 # call gb_LinkTarget_use_library_objects,linktarget,libs
1405 define gb_LinkTarget_use_library_objects
1406 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS
),$(2)))
1407 $$(eval
$$(call gb_Output_info
,currently known libraries are
: $(sort $(gb_Library_KNOWNLIBS
)),ALL
))
1408 $$(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
))
1410 $(call gb_LinkTarget__use_linktarget_objects
,$(1),$(foreach lib
,$(2),$(call gb_Library_get_linktarget
,$(lib
))))
1411 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
1412 $(foreach lib
,$(2),$(call gb_Library_get_headers_target
,$(lib
)))
1416 # call gb_LinkTarget_use_executable_objects,linktarget,exes
1417 define gb_LinkTarget_use_executable_objects
1418 $(call gb_LinkTarget__use_linktarget_objects
,$(1),$(foreach exe
,$(2),$(call gb_Executable_get_linktarget
,$(exe
))))
1422 # call gb_LinkTarget_add_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1423 define gb_LinkTarget_add_cobjects
1424 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cobject
,$(1),$(obj
),$(3),$(4)))
1427 # call gb_LinkTarget_add_cxxobjects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1428 define gb_LinkTarget_add_cxxobjects
1429 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cxxobject
,$(1),$(obj
),$(3),$(4)))
1432 # call gb_LinkTarget_add_objcobjects,linktarget,sourcefiles,objcflags,linktargetmakefilename
1433 define gb_LinkTarget_add_objcobjects
1434 $(foreach obj
,$(2),$(call gb_LinkTarget_add_objcobject
,$(1),$(obj
),$(3),$(4)))
1437 # call gb_LinkTarget_add_objcxxobjects,linktarget,sourcefiles,objcxxflags,linktargetmakefilename
1438 define gb_LinkTarget_add_objcxxobjects
1439 $(foreach obj
,$(2),$(call gb_LinkTarget_add_objcxxobject
,$(1),$(obj
),$(3),$(4)))
1442 # call gb_LinkTarget_add_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename
1443 define gb_LinkTarget_add_cxxclrobjects
1444 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cxxclrobject
,$(1),$(obj
),$(3),$(4)))
1447 # call gb_LinkTarget_add_asmobjects,linktarget,sourcefiles,asmflags,linktargetmakefilename
1448 define gb_LinkTarget_add_asmobjects
1449 $(foreach obj
,$(2),$(call gb_LinkTarget_add_asmobject
,$(1),$(obj
),$(3),$(4)))
1452 # call gb_LinkTarget_add_exception_objects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1453 define gb_LinkTarget_add_exception_objects
1454 $(foreach obj
,$(2),$(call gb_LinkTarget_add_exception_object
,$(1),$(obj
),$(3),$(4)))
1457 #only useful for building x64 libraries on windows
1458 # call gb_LinkTarget_add_x64_generated_exception_objects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1459 define gb_LinkTarget_add_x64_generated_exception_objects
1460 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_exception_object
,$(1),$(obj
),$(3),$(4)))
1461 $(foreach obj
,$(2),$(eval
$(call gb_GenCxxObject_get_target
,$(obj
)) : CXXOBJECT_X64
:= YES
))
1464 # call gb_LinkTarget_add_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1465 define gb_LinkTarget_add_generated_cobjects
1466 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_c_object
,$(1),$(obj
),$(3),$(4)))
1469 #only useful for building x64 libraries on windows
1470 # call gb_LinkTarget_add_x64_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1471 define gb_LinkTarget_add_x64_generated_cobjects
1472 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_c_object
,$(1),$(obj
),$(3),$(4)))
1475 # call gb_LinkTarget_add_generated_exception_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1476 define gb_LinkTarget_add_generated_exception_object
1477 $(call gb_LinkTarget_add_generated_cxx_object_internal
,$(1),$(2),$(3),$(4),$(gb_LinkTarget_EXCEPTIONFLAGS
))
1480 # call gb_LinkTarget_add_generated_exception_objects,linktarget,sourcefile,cxxflags,linktargetmakefilename
1481 define gb_LinkTarget_add_generated_exception_objects
1482 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_exception_object
,$(1),$(obj
),$(3),$(4)))
1485 # call gb_LinkTarget_add_generated_cxxclrobjects,linktarget,sourcefiles,cxxclrflags,linktargetmakefilename
1486 define gb_LinkTarget_add_generated_cxxclrobjects
1487 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_cxxclrobject
,$(1),$(obj
),$(3),$(4)))
1490 # call gb_LinkTarget_set_targettype,linktarget,targettype
1491 define gb_LinkTarget_set_targettype
1492 $(call gb_LinkTarget_get_target
,$(1)) : TARGETTYPE
:= $(2)
1496 # call gb_LinkTarget_set_x64,linktarget,boolean
1497 define gb_LinkTarget_set_x64
1498 $(call gb_LinkTarget_get_target
,$(1)) : LIBRARY_X64
:= $(2)
1502 # call gb_LinkTarget_set_x86,linktarget,boolean
1503 define gb_LinkTarget_set_x86
1504 $(call gb_LinkTarget_get_target
,$(1)) : PE_X86
:= $(2)
1508 # call gb_LinkTarget_set_ilibtarget,linktarget,ilibfilename
1509 define gb_LinkTarget_set_ilibtarget
1510 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1511 $(call gb_LinkTarget_get_target
,$(1)) : ILIBTARGET
:= $(2)
1515 # Add a file that is built by the LinkTarget command and define
1516 # a dummy touch rule for it so it can be tracked via dependencies.
1517 # The assumption is that the file is created by linking; in case it does not
1518 # exist there is some problem. This can be caused on WNT by re-naming DLL
1519 # files (which are aux-targets) but not the import .lib files (which
1520 # are the LinkTargets) and doing an incremental build.
1521 # call gb_LinkTarget_add_auxtarget,linktarget,auxtarget
1522 define gb_LinkTarget_add_auxtarget
1523 $(2) : $(call gb_LinkTarget_get_target
,$(1))
1524 if
test -e
$$@
; then \
1528 echo
"ERROR: aux-target missing, library deleted, please try running make again"; \
1532 $(call gb_LinkTarget_get_clean_target
,$(1)) : AUXTARGETS
+= $(2)
1536 # call gb_LinkTarget_add_auxtargets,linktarget,auxtargets
1537 define gb_LinkTarget_add_auxtargets
1538 $(foreach aux
,$(2),$(call gb_LinkTarget_add_auxtarget
,$(1),$(aux
)))
1542 # call gb_LinkTarget__use_custom_headers,linktarget,customtarget
1543 define gb_LinkTarget__use_custom_headers
1544 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
1545 $(call gb_CustomTarget_get_target
,$(2))
1546 $(call gb_LinkTarget__add_include
,$(1),$(call gb_CustomTarget_get_workdir
,$(2)))
1550 # call gb_LinkTarget_use_custom_headers,linktarget,customtargets
1551 define gb_LinkTarget_use_custom_headers
1552 $(foreach customtarget
,$(2),$(call gb_LinkTarget__use_custom_headers
,$(1),$(customtarget
)))
1556 # add SDI (svidl) headers
1557 # call gb_LinkTarget_add_sdi_headers,linktarget,sditargets
1558 define gb_LinkTarget_add_sdi_headers
1559 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(foreach sdi
,$(2),$(call gb_SdiTarget_get_target
,$(sdi
)))
1560 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(foreach sdi
,$(2),$(call gb_SdiTarget_get_clean_target
,$(sdi
)))
1564 # call gb_LinkTarget__set_precompiled_header_variables,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1565 define gb_LinkTarget__set_precompiled_header_variables
1566 $(call gb_LinkTarget_get_target
,$(1)) : PCH_NAME
:= $(3)
1567 $(call gb_LinkTarget_get_target
,$(1)) : PCH_HEADER
:= $(patsubst %.
cxx,%.hxx
,$(2))
1568 $(call gb_LinkTarget_get_target
,$(1)) : PCH_LINKTARGETMAKEFILENAME
:= $(4)
1570 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
:= $$(DEFS
)
1571 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
:= $$(T_CXXFLAGS
) $(call gb_LinkTarget__get_cxxflags
,$(4)) $(gb_LinkTarget_EXCEPTIONFLAGS
)
1573 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
+= -DPCH_LEVEL
=$(gb_ENABLE_PCH
)
1574 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
+= -DPCH_LEVEL
=$(gb_ENABLE_PCH
)
1578 # call gb_LinkTarget__set_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1579 define gb_LinkTarget__set_precompiled_header_impl
1580 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_PrecompiledHeader_get_clean_target
,$(3))
1581 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : $(call gb_CxxObject_get_source
,$(SRCDIR
),$(2))
1583 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : $(call gb_LinkTarget_get_headers_target
,$(1))
1585 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)) : VISIBILITY
:=
1587 $(call gb_LinkTarget_get_pch_timestamp
,$(4)) : $(call gb_PrecompiledHeader_get_target
,$(3),$(4))
1589 $(call gb_LinkTarget__set_precompiled_header_variables
,$(1),$(2),$(3),$(4))
1591 ifeq ($(gb_FULLDEPS
),$(true
))
1592 -include $(call gb_PrecompiledHeader_get_dep_target
,$(3),$(4))
1597 # call gb_LinkTarget__add_precompiled_header_object,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1598 define gb_LinkTarget__add_precompiled_header_object
1600 ifneq ($(BUILDING_PCH_WITH_OBJ
),)
1601 $(call gb_LinkTarget_add_exception_object
,$(1),$(2),,$(4))
1602 $(call gb_CxxObject_get_target
,$(2)) : T_PCH_EXTRA_CXXFLAGS
+= $(gb_PrecompiledHeader_pch_with_obj
)
1605 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
= $(call gb_PrecompiledHeader_get_objectfile
, $(call gb_PrecompiledHeader_get_target
,$(3),$(4)))
1606 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
= $$(PCHOBJEX
)
1610 # 'compiler' set comes only from gb_LinkTarget_set_clang_precompiled_header
1611 # call gb_LinkTarget_set_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename,compiler
1612 define gb_LinkTarget_set_precompiled_header
1613 ifneq ($(gb_ENABLE_PCH
),)
1614 $(call gb_LinkTarget__set_precompiled_header_impl
,$(1),$(2),$(notdir $(2)),$(4))
1615 $(call gb_PrecompiledHeader_generate_rules
,$(notdir $(2)),$(1),$(4),$(2),$(5))
1617 ifneq ($(gb_ENABLE_PCH
)$(BLOCK_PCH
),)
1618 $(call gb_LinkTarget__add_precompiled_header_object
,$(1),$(2),$(notdir $(2)),$(4))
1623 # It seems complicated to forward the clang setting to the PCH rules, so use an extra
1624 # function to set it manually. This variant should be used if gb_LinkTarget_use_clang is used.
1625 # call gb_LinkTarget_set_clang_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename
1626 define gb_LinkTarget_set_clang_precompiled_header
1627 $(call gb_LinkTarget_set_precompiled_header
,$(1),$(2),$(3),$(4),$(LO_CLANG_CXX
))
1630 # call gb_LinkTarget__reuse_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1631 # Use the PCH as if it was LinkTarget's own, but do nothing with the PCH itself, just depend on it.
1632 define gb_LinkTarget__reuse_precompiled_header_impl
1633 $(call gb_LinkTarget__set_precompiled_header_variables
,$(1),$(2),$(3),$(4))
1635 $(call gb_LinkTarget_get_pch_timestamp
,$(4)) : $(call gb_LinkTarget_get_pch_reuse_timestamp
,$(4))
1637 # We need to depend on a special for_reuse target that depends on the linktarget that owns the PCH.
1638 # Depending directly on the PCH could cause that PCH to be built with this linktarget's flags.
1639 $(call gb_LinkTarget_get_pch_reuse_timestamp
,$(4)) : $(call gb_PrecompiledHeader_get_for_reuse_target
,$(3),$(4))
1640 $(call gb_PrecompiledHeader_check_flags
,$(4),$(2),\
1641 $(call gb_PrecompiledHeader_get_target
,$(3),$(4)),$$(PCH_CXXFLAGS
) $$(PCH_DEFS
) $$(gb_LinkTarget_EXCEPTIONFLAGS
))
1642 $$(call gb_PrecompiledHeader__copy_reuse_files
,$(1),$(3),$(4))
1643 mkdir
-p
$$(dir $$@
) && touch
$$@
1647 # call gb_LinkTarget__add_reuse_precompiled_header_object,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1648 define gb_LinkTarget__add_reuse_precompiled_header_object
1650 ifneq ($(BUILDING_PCH_WITH_OBJ
),)
1651 # We need to link in also the PCH's object file. Again, rely on a special for_reuse target for dependencies.
1652 $(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)))))
1653 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
+= $(2)
1656 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
= $(call gb_PrecompiledHeader_get_objectfile
, $(call gb_PrecompiledHeader_get_target
,$(3),$(4)))
1657 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
= $$(PCHOBJEX
)
1661 # call gb_LinkTarget__reuse_precompiled_header_workarounds,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1662 define gb_LinkTarget__reuse_precompiled_header_workarounds
1663 ifeq ($(COM_IS_CLANG
),TRUE
)
1664 $(call gb_LinkTarget_add_defs
,$(1),-include $(SRCDIR
)/pch
/inc
/clangfix.hxx
)
1666 $(if
$(filter precompiled_system
,$(3)), $(call gb_LinkTarget_add_defs
,$(1),-DBOOST_ALL_NO_LIB
))
1669 # call gb_LinkTarget_reuse_precompiled_header,linktarget,pchcxxfile,,linktargetmakefilename
1670 define gb_LinkTarget_reuse_precompiled_header
1671 ifeq ($(gb_DISABLE_PCH_REUSE
),$(false
))
1672 ifneq ($(gb_ENABLE_PCH
),)
1673 $(call gb_LinkTarget__reuse_precompiled_header_impl
,$(1),$(2),$(notdir $(2)),$(4))
1674 $(call gb_LinkTarget__reuse_precompiled_header_workarounds
,$(1),$(2),$(notdir $(2)),$(4))
1676 ifneq ($(gb_ENABLE_PCH
)$(BLOCK_PCH
),)
1677 $(call gb_LinkTarget__add_reuse_precompiled_header_object
,$(1),$(2),$(notdir $(2)),$(4))
1683 # call gb_LinkTarget_use_common_precompiled_header,linktarget,,,linktargetmakefilename
1684 define gb_LinkTarget_use_common_precompiled_header
1685 $(call gb_LinkTarget_reuse_precompiled_header
,$(1),pch
/inc
/pch
/precompiled_system
,,$(4))
1689 # use a header package, possibly from another module
1690 # call gb_LinkTarget_use_package,linktarget,package
1691 define gb_LinkTarget_use_package
1692 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
1693 $(call gb_Package_get_target
,$(strip $(2)))
1697 # call gb_LinkTarget_use_packages,linktarget,packages
1698 define gb_LinkTarget_use_packages
1699 $(foreach package
,$(2),$(call gb_LinkTarget_use_package
,$(1),$(package
)))
1702 # use a GeneratedPackage, possibly from another module
1703 # call gb_LinkTarget_use_generated_package,linktarget,package
1704 define gb_LinkTarget_use_generated_package
1705 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
1706 $(call gb_GeneratedPackage_get_target
,$(strip $(2)))
1710 # Use sources from unpacked tarball of an external project
1711 # call gb_LinkTarget_use_unpacked,linktarget,unpackedtarget
1712 define gb_LinkTarget_use_unpacked
1713 $(call gb_LinkTarget_get_headers_target
,$(1)) :|
$(call gb_UnpackedTarball_get_final_target
,$(2))
1717 # Use artifacts from ExternalProject (i. e. configure) of an external project
1718 # example in expat: StaticLibrary depends on ExternalProject outcome
1719 # call gb_LinkTarget_use_external_project,linktarget,externalproject,full-dep
1720 define gb_LinkTarget_use_external_project
1721 $(call gb_LinkTarget_get_target
,$(1)) :|
$(call gb_ExternalProject_get_target
,$(2))
1722 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
1723 $(if
$(3),$(call gb_ExternalProject_get_target
,$(2)),$(call gb_UnpackedTarball_get_final_target
,$(2)))
1727 # this forwards to functions that must be defined in RepositoryExternal.mk.
1728 # Automatically forward for libmerged library too when linktarget is merged.
1730 # call gb_LinkTarget_use_external,linktarget,external
1731 define gb_LinkTarget_use_external
1732 $(if
$(filter undefined
,$(origin gb_LinkTarget__use_
$(2))),\
1733 $(error gb_LinkTarget_use_external
: unknown external
: $(2)),\
1734 $(if
$(call gb_LinkTarget__is_merged
,$(1)),$(call gb_LinkTarget__use_
$(2),$(call gb_Library_get_linktarget
,merged
))) \
1735 $(call gb_LinkTarget__use_
$(2),$(1)) \
1739 # $(call gb_LinkTarget_use_externals,library,externals)
1740 gb_LinkTarget_use_externals
= \
1741 $(foreach external
,$(2),$(call gb_LinkTarget_use_external
,$(1),$(external
)))
1743 # call gb_LinkTarget_set_visibility_default,linktarget
1744 define gb_LinkTarget_set_visibility_default
1745 $(call gb_LinkTarget_get_target
,$(1)) : VISIBILITY
:= default
1746 ifneq ($(gb_ENABLE_PCH
),)
1747 ifneq ($(strip $$(PCH_NAME
)),)
1748 $(call gb_PrecompiledHeader_get_target
,$$(PCH_NAME
),$$(PCH_LINKTARGETMAKEFILENAME
)) : VISIBILITY
:= default
1754 # call gb_LinkTarget_set_warnings_not_errors,linktarget
1755 define gb_LinkTarget_set_warnings_not_errors
1756 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_NOT_ERRORS
:= $(true
)
1760 # call gb_LinkTarget_set_warnings_disabled,linktarget
1761 define gb_LinkTarget_set_warnings_disabled
1762 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_DISABLED
:= $(true
)
1766 # call gb_LinkTarget_set_external_code,linktarget
1767 define gb_LinkTarget_set_external_code
1768 $(call gb_LinkTarget_get_target
,$(1)) : EXTERNAL_CODE
:= $(true
)
1772 # Set suffix of C++ files, if different from 'cxx'
1774 # This is useful for external libraries.
1776 # call gb_LinkTarget_set_generated_cxx_suffix,linktarget,used-suffix
1777 define gb_LinkTarget_set_generated_cxx_suffix
1778 gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)) := $(2)
1782 # C/C++ files will be build with Clang (if possible) instead of the default compiler.
1783 # call gb_LinkTarget_use_clang,linktarget,,linktargetmakefilename
1784 define gb_LinkTarget_use_clang
1785 $(call gb_LinkTarget_get_target
,$(1)) : T_CC
:= $(LO_CLANG_CC
)
1786 $(call gb_LinkTarget_get_target
,$(1)) : T_CXX
:= $(LO_CLANG_CXX
)
1787 $(call gb_LinkTarget_get_target
,$(1)) : T_USE_LD
:= $(or
$(CLANG_USE_LD
),$(USE_LD
))
1790 # call gb_LinkTarget_use_glxtest,linktarget,add_libs
1791 define gb_LinkTarget_use_glxtest
1792 $(call gb_LinkTarget_use_libraries
,$(1),vcl
)
1794 ifeq (,$(DISABLE_DYNLOADING
))
1795 $(call gb_LinkTarget_add_libs
,$(1),$(DLOPEN_LIBS
))
1798 ifeq (,$(DISABLE_GUI
))
1799 ifeq ($(USING_X11
),TRUE
)
1800 $(call gb_LinkTarget_add_libs
,$(1),-lX11
$(2))
1801 $(call gb_LinkTarget_use_static_libraries
,$(1),glxtest
)
1805 endef # gb_LinkTarget_use_glxtest
1807 # call gb_LinkTarget_use_vclmain,linktarget,add_libs
1808 define gb_LinkTarget_use_vclmain
1809 $(call gb_LinkTarget_use_glxtest
,$(1),$(2))
1810 $(call gb_LinkTarget_use_static_libraries
,$(1),vclmain
)
1812 endef # gb_LinkTarget_use_vclmain
1814 # vim: set noet sw=4: