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 # enable if: no "-TARGET" defined AND [module is enabled OR "TARGET" defined]
40 gb_LinkTarget__debug_enabled
= \
41 $(and
$(if
$(filter -$(1),$(ENABLE_DEBUGINFO_FOR
)),,$(true
)),\
42 $(or
$(gb_Module_CURRENTMODULE_DEBUG_ENABLED
),\
43 $(filter $(1),$(ENABLE_DEBUGINFO_FOR
))))
45 # debug flags, if ENABLE_DEBUG is set and the LinkTarget is named
46 # in the list of libraries of ENABLE_DEBUGINFO_FOR
47 gb_LinkTarget__get_debugcflags
=$(if
$(call gb_LinkTarget__debug_enabled
,$(1)),$(gb_COMPILERNOOPTFLAGS
) $(gb_DEBUG_CFLAGS
),$(gb_COMPILEROPTFLAGS
))
48 gb_LinkTarget__get_debugcxxflags
=$(if
$(call gb_LinkTarget__debug_enabled
,$(1)),$(gb_COMPILERNOOPTFLAGS
) $(gb_DEBUG_CFLAGS
) $(gb_DEBUG_CXXFLAGS
),$(gb_COMPILEROPTFLAGS
))
50 # similar for LDFLAGS, use linker optimization flags in non-debug case,
51 # but moreover strip debug from libraries for which debuginfo is not wanted
52 # (some libraries reuse .o files from other libraries, notably unittests)
53 gb_LinkTarget__get_stripldflags
=$(if
$(strip $(CFLAGS
)$(CXXFLAGS
)$(OBJCFLAGS
)$(OBJCXXFLAGS
)$(LDFLAGS
)),,$(gb_LINKERSTRIPDEBUGFLAGS
))
54 gb_LinkTarget__get_debugldflags
=$(if
$(call gb_LinkTarget__debug_enabled
,$(1)),,$(gb_LINKEROPTFLAGS
) $(call gb_LinkTarget__get_stripldflags
,$(1)))
56 # generic cflags/cxxflags to use (optimization flags, debug flags)
57 # user supplied CFLAGS/CXXFLAGS override default debug/optimization flags
58 # call gb_LinkTarget__get_cflags,linktargetmakefilename
59 gb_LinkTarget__get_cflags
=$(if
$(CFLAGS
),$(CFLAGS
),$(call gb_LinkTarget__get_debugcflags
,$(1)))
60 gb_LinkTarget__get_objcflags
=$(if
$(OBJCFLAGS
),$(OBJCFLAGS
),$(call gb_LinkTarget__get_debugcflags
,$(1)))
61 gb_LinkTarget__get_cxxflags
=$(if
$(CXXFLAGS
),$(CXXFLAGS
),$(call gb_LinkTarget__get_debugcxxflags
,$(1)))
62 gb_LinkTarget__get_objcxxflags
=$(if
$(OBJCXXFLAGS
),$(OBJCXXFLAGS
),$(call gb_LinkTarget__get_debugcxxflags
,$(1)))
63 # call gb_LinkTarget__get_ldflags,linktargetmakefilename
64 gb_LinkTarget__get_ldflags
=$(if
$(LDFLAGS
),$(LDFLAGS
),$(call gb_LinkTarget__get_debugldflags
,$(1)))
66 gb_LinkTarget_LAYER_LINKPATHS
:= \
73 NONE
:URELIB
+OOO
+NONE. \
76 # Overview of dependencies and tasks of LinkTarget
78 # target task depends on
79 # LinkTarget linking AsmObject CObject CxxObject GenCObject GenCxxObject ObjCObject ObjCxxObject
81 # LinkTarget/dep joined dep file AsmObject/dep CObject/dep CxxObject/dep GenCObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep
82 # | LinkTarget/headers
83 # LinkTarget/headers all headers available
84 # including own generated
85 # PCH precompiled headers LinkTarget/headers
86 # CObject plain c compile | LinkTarget/headers
87 # CxxObject c++ compile | LinkTarget/headers PCH
88 # GenCObject plain c compile from | LinkTarget/headers
90 # GenCxxObject C++ compile from | LinkTarget/headers PCH
92 # ObjCObject objective c compile | LinkTarget/headers
93 # ObjCxxObject objective c++ compile | LinkTarget/headers
95 # AsmObject asm compile | LinkTarget
97 # CObject/dep dependencies these targets generate empty dep files
98 # CxxObject/dep dependencies that are populated upon compile
99 # GenCObject/dep dependencies
100 # GenCxxObject/dep dependencies
101 # ObjCObject/dep dependencies
102 # ObjCxxObject/dep dependencies
103 # AsmObject/dep dependencies
105 # LinkTarget/headers means gb_LinkTarget_get_headers_target etc.
106 # dependencies prefixed with | are build-order only dependencies
109 # check that objects are only linked into one link target:
110 # multiple linking may cause problems because different link targets may
111 # require different compiler flags
112 define gb_Object__owner
113 $$(if
$$(OBJECTOWNER
),\
114 $$(call gb_Output_error
,fdo
#47246: $(1) is linked in by $$(OBJECTOWNER) $(2)))$(2)
117 # For every object there is a dep file (if gb_FULLDEPS is active).
118 # The dep file depends on the object: the Object__command also updates the
119 # dep file as a side effect.
120 # In the dep file rule just touch it so it's newer than the object.
122 ifneq ($(FORCE_COMPILE_ALL
),)
123 # This one only exists to force .c/.cxx "rebuilds" when running a compiler tool.
124 .PHONY
: force_compile_all_target
125 force_compile_all_target
:
126 gb_FORCE_COMPILE_ALL_TARGET
:= force_compile_all_target
131 gb_CObject_get_source
= $(1)/$(2).c
133 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
134 $(call gb_CObject_get_target
,%) : $(call gb_CObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_ALL_TARGET
)
135 $(call gb_CObject__tool_command
,$*,$<)
137 $(call gb_CObject_get_target
,%) : $(call gb_CObject_get_source
,$(SRCDIR
),%)
138 $(call gb_Output_announce
,$*.c
,$(true
),C
,3)
139 $(call gb_CObject__command_pattern
,$@
,$(T_CFLAGS
) $(T_CFLAGS_APPEND
),$<,$(call gb_CObject_get_dep_target
,$*),$(COMPILER_PLUGINS
))
142 # Note: if the *Object_dep_target does not exist it will be created by
143 # concat-deps as PHONY
144 ifeq ($(gb_FULLDEPS
),$(true
))
145 $(dir $(call gb_CObject_get_dep_target
,%)).
dir :
146 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
148 $(dir $(call gb_CObject_get_dep_target
,%))%/.
dir :
149 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
151 $(call gb_CObject_get_dep_target
,%) :
152 $(if
$(wildcard $@
),touch
$@
)
159 gb_CxxObject_get_source
= $(1)/$(2).
cxx
161 # Only enable PCH if the PCH_CXXFLAGS and the PCH_DEFS (from the linktarget)
162 # are the same as the T_CXXFLAGS and DEFS we want to use for this object. This
163 # should usually be the case. The DEFS/T_CXXFLAGS would have to be manually
164 # overridden for one object file for them to differ. PCH_CXXFLAGS/PCH_DEFS
165 # should never be overridden on an object -- they should be the same as for the
166 # whole linktarget. In general it should be cleaner to use a static library
167 # compiled with different flags and link that in rather than mixing different
168 # flags in one linktarget.
169 define gb_CxxObject__set_pchflags
170 ifeq ($(gb_ENABLE_PCH
),$(true
))
171 ifneq ($(strip $$(PCH_NAME
)),)
172 ifeq ($$(sort $$(PCH_CXXFLAGS
) $$(PCH_DEFS
) $$(gb_LinkTarget_EXCEPTIONFLAGS
)),$$(sort $$(T_CXXFLAGS
) $$(T_CXXFLAGS_APPEND
) $$(DEFS
)))
173 $$@
: PCHFLAGS
:= $$(call gb_PrecompiledHeader_get_enableflags
,$$(PCH_NAME
))
175 $$(info No precompiled header available for
$$*.
cxx .
)
176 $$(info precompiled header flags
: $$(sort $$(PCH_CXXFLAGS
) $$(PCH_DEFS
) $$(gb_LinkTarget_EXCEPTIONFLAGS
)))
177 $$(info . object flags
: $$(sort $$(T_CXXFLAGS
) $$(T_CXXFLAGS_APPEND
) $$(DEFS
)))
184 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
185 $(call gb_CxxObject_get_target
,%) : $(call gb_CxxObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_ALL_TARGET
)
186 $(call gb_CxxObject__tool_command
,$*,$<)
188 $(call gb_CxxObject_get_target
,%) : $(call gb_CxxObject_get_source
,$(SRCDIR
),%)
189 $(call gb_Output_announce
,$*.
cxx,$(true
),CXX
,3)
190 $(eval
$(gb_CxxObject__set_pchflags
))
191 $(call gb_CObject__command_pattern
,$@
,$(T_CXXFLAGS
) $(T_CXXFLAGS_APPEND
),$<,$(call gb_CxxObject_get_dep_target
,$*),$(COMPILER_PLUGINS
))
194 ifeq ($(gb_FULLDEPS
),$(true
))
195 $(dir $(call gb_CxxObject_get_dep_target
,%)).
dir :
196 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
198 $(dir $(call gb_CxxObject_get_dep_target
,%))%/.
dir :
199 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
201 $(call gb_CxxObject_get_dep_target
,%) :
202 $(if
$(wildcard $@
),touch
$@
,\
203 $(eval
$(gb_CxxObject__set_pchflags
)))
210 gb_GenCObject_get_source
= $(WORKDIR
)/$(1).c
212 $(call gb_GenCObject_get_target
,%) :
213 $(call gb_Output_announce
,$*.c
,$(true
),C
,3)
214 test -f
$(call gb_GenCObject_get_source
,$*) ||
(echo
"Missing generated source file $(call gb_GenCObject_get_source,$*)" && false
)
215 $(call gb_CObject__command_pattern
,$@
,$(T_CFLAGS
) $(T_CFLAGS_APPEND
),$(call gb_GenCObject_get_source
,$*),$(call gb_GenCObject_get_dep_target
,$*),$(COMPILER_PLUGINS
))
217 ifeq ($(gb_FULLDEPS
),$(true
))
218 $(dir $(call gb_GenCObject_get_dep_target
,%)).
dir :
219 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
221 $(dir $(call gb_GenCObject_get_dep_target
,%))%/.
dir :
222 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
224 $(call gb_GenCObject_get_dep_target
,%) :
225 $(if
$(wildcard $@
),touch
$@
)
232 gb_GenCxxObject_get_source
= $(WORKDIR
)/$(1).
$(gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(2)))
234 $(call gb_GenCxxObject_get_target
,%) :
235 $(call gb_Output_announce
,$(subst $(BUILDDIR
)/,,$(GEN_CXX_SOURCE
)),$(true
),CXX
,3)
236 test -f
$(GEN_CXX_SOURCE
) ||
(echo
"Missing generated source file $(GEN_CXX_SOURCE)" && false
)
237 $(eval
$(gb_CxxObject__set_pchflags
))
238 $(call gb_CObject__command_pattern
,$@
,$(T_CXXFLAGS
) $(T_CXXFLAGS_APPEND
),$(GEN_CXX_SOURCE
),$(call gb_GenCxxObject_get_dep_target
,$*),$(COMPILER_PLUGINS
))
240 ifeq ($(gb_FULLDEPS
),$(true
))
241 $(dir $(call gb_GenCxxObject_get_dep_target
,%)).
dir :
242 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
244 $(dir $(call gb_GenCxxObject_get_dep_target
,%))%/.
dir :
245 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
247 $(call gb_GenCxxObject_get_dep_target
,%) :
248 $(if
$(wildcard $@
),touch
$@
,\
249 $(eval
$(gb_CxxObject__set_pchflags
)))
256 # XXX: This is more complicated than necessary, but we cannot just use
257 # the generated C++ file as the main target, because we need to let the
258 # header depend on that to ensure the header is present before anything
261 gb_YaccTarget_get_source
= $(1)/$(2).y
263 .PHONY
: $(call gb_YaccTarget_get_clean_target
,%)
264 $(call gb_YaccTarget_get_clean_target
,%) :
265 $(call gb_Output_announce
,$*,$(false
),YAC
,3)
266 $(call gb_Helper_abbreviate_dirs
,\
267 rm -f
$(call gb_YaccTarget_get_grammar_target
,$*) $(call gb_YaccTarget_get_header_target
,$*) $(call gb_YaccTarget_get_target
,$*))
269 $(call gb_YaccTarget_get_target
,%) : $(call gb_YaccTarget_get_source
,$(SRCDIR
),%)
270 $(call gb_YaccTarget__command
,$<,$*,$@
,$(call gb_YaccTarget_get_header_target
,$*),$(call gb_YaccTarget_get_grammar_target
,$*))
272 # call gb_YaccTarget_YaccTarget,yacctarget
273 define gb_YaccTarget_YaccTarget
274 $(call gb_YaccTarget_get_grammar_target
,$(1)) : $(call gb_YaccTarget_get_target
,$(1))
276 $(call gb_YaccTarget_get_header_target
,$(1)) : $(call gb_YaccTarget_get_target
,$(1))
286 gb_LexTarget_get_source
= $(1)/$(2).l
288 .PHONY
: $(call gb_LexTarget_get_clean_target
,%)
289 $(call gb_LexTarget_get_clean_target
,%) :
290 $(call gb_Output_announce
,$*,$(false
),LEX
,3)
291 $(call gb_Helper_abbreviate_dirs
,\
292 rm -f
$(call gb_LexTarget_get_scanner_target
,$*) $(call gb_LexTarget_get_target
,$*))
294 $(call gb_LexTarget_get_target
,%) : $(call gb_LexTarget_get_source
,$(SRCDIR
),%)
295 $(call gb_LexTarget__command
,$<,$*,$@
,$(call gb_LexTarget_get_scanner_target
,$*))
297 # gb_LexTarget_LexTarget(scanner-file)
298 define gb_LexTarget_LexTarget
299 $(call gb_LexTarget_get_scanner_target
,$(1)) : $(call gb_LexTarget_get_target
,$(1))
304 # gb_LexTarget__command(scanner-file, stem-for-message, done-pseudo-target, source-target)
305 define gb_LexTarget__command
306 $(call gb_Output_announce
,$(2),$(true
),LEX
,3)
307 $(call gb_Helper_abbreviate_dirs
,\
308 mkdir
-p
$(dir $(3)) && \
309 $(FLEX
) $(T_LEXFLAGS
) -o
$(4) $(1) && touch
$(3) )
316 gb_ObjCxxObject_get_source
= $(1)/$(2).mm
318 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
319 $(call gb_ObjCxxObject_get_target
,%) : $(call gb_ObjCxxObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_ALL_TARGET
)
320 $(call gb_ObjCxxObject__tool_command
,$*,$<)
322 $(call gb_ObjCxxObject_get_target
,%) : $(call gb_ObjCxxObject_get_source
,$(SRCDIR
),%)
323 $(call gb_Output_announce
,$*.mm
,$(true
),OCX
,3)
324 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCXXFLAGS
) $(T_OBJCXXFLAGS_APPEND
),$<,$(call gb_ObjCxxObject_get_dep_target
,$*),$(COMPILER_PLUGINS
))
327 ifeq ($(gb_FULLDEPS
),$(true
))
328 $(dir $(call gb_ObjCxxObject_get_dep_target
,%)).
dir :
329 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
331 $(dir $(call gb_ObjCxxObject_get_dep_target
,%))%/.
dir :
332 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
334 $(call gb_ObjCxxObject_get_dep_target
,%) :
335 $(if
$(wildcard $@
),touch
$@
)
343 gb_ObjCObject_get_source
= $(1)/$(2).m
345 ifneq ($(COMPILER_EXTERNAL_TOOL
)$(COMPILER_PLUGIN_TOOL
),)
346 $(call gb_ObjCObject_get_target
,%) : $(call gb_ObjCObject_get_source
,$(SRCDIR
),%) $(gb_FORCE_COMPILE_ALL_TARGET
)
347 $(call gb_ObjCObject__tool_command
,$*,$<)
349 $(call gb_ObjCObject_get_target
,%) : $(call gb_ObjCObject_get_source
,$(SRCDIR
),%)
350 $(call gb_Output_announce
,$*.m
,$(true
),OCC
,3)
351 $(call gb_CObject__command_pattern
,$@
,$(T_OBJCFLAGS
) $(T_OBJCFLAGS_APPEND
),$<,$(call gb_ObjCObject_get_dep_target
,$*),$(COMPILER_PLUGINS
))
354 ifeq ($(gb_FULLDEPS
),$(true
))
355 $(dir $(call gb_ObjCObject_get_dep_target
,%)).
dir :
356 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
358 $(dir $(call gb_ObjCObject_get_dep_target
,%))%/.
dir :
359 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
361 $(call gb_ObjCObject_get_dep_target
,%) :
362 $(if
$(wildcard $@
),touch
$@
)
369 $(call gb_AsmObject_get_target
,%) : $(call gb_AsmObject_get_source
,$(SRCDIR
),%)
370 $(call gb_AsmObject__command
,$@
,$*,$<,$(call gb_AsmObject_get_dep_target
,$*))
372 ifeq ($(gb_FULLDEPS
),$(true
))
373 $(dir $(call gb_AsmObject_get_dep_target
,%)).
dir :
374 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
376 $(dir $(call gb_AsmObject_get_dep_target
,%))%/.
dir :
377 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
379 $(call gb_AsmObject_get_dep_target
,%) :
380 $(if
$(wildcard $@
),touch
$@
)
387 gb_LinkTarget_DEFAULTDEFS
:= $(gb_GLOBALDEFS
)
389 .PHONY
: $(WORKDIR
)/Clean
/LinkTarget
/%
390 $(WORKDIR
)/Clean
/LinkTarget
/% :
391 $(call gb_Output_announce
,$*,$(false
),LNK
,4)
392 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),200,\
393 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
394 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dep_target
,$(object
))) \
395 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
396 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dep_target
,$(object
))) \
397 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_target
,$(object
))) \
398 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dep_target
,$(object
))) \
399 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_target
,$(object
))) \
400 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dep_target
,$(object
))) \
401 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
402 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dep_target
,$(object
))) \
403 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
404 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dep_target
,$(object
))) \
405 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
406 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dep_target
,$(object
))) \
407 $(call gb_LinkTarget_get_target
,$(LINKTARGET
)) \
408 $(call gb_LinkTarget_get_dep_target
,$(LINKTARGET
)) \
409 $(call gb_LinkTarget_get_headers_target
,$(LINKTARGET
)) \
410 $(call gb_LinkTarget_get_objects_list
,$(LINKTARGET
)) \
413 cat
$${RESPONSEFILE} /dev
/null | xargs
-n
200 rm -fr
&& \
414 rm -f
$${RESPONSEFILE}
417 # cat the deps of all objects in one file, then we need only open that one file
418 # call gb_LinkTarget__command_dep,dep_target,linktargetname
419 define gb_LinkTarget__command_dep
420 $(call gb_Output_announce
,LNK
:$(2),$(true
),DEP
,1)
421 $(call gb_Helper_abbreviate_dirs
,\
422 mkdir
-p
$(dir $(1)) && \
423 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),200,\
424 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_dep_target
,$(object
))) \
425 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_dep_target
,$(object
))) \
426 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_dep_target
,$(object
)))\
427 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_dep_target
,$(object
)))\
428 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_dep_target
,$(object
)))\
429 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_dep_target
,$(object
))) \
430 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_dep_target
,$(object
))) \
432 $(call gb_Executable_get_command
,concat-deps
) $${RESPONSEFILE} > $(1)) && \
433 rm -f
$${RESPONSEFILE}
437 # call gb_LinkTarget__command_objectlist,linktarget
438 define gb_LinkTarget__command_objectlist
439 TEMPFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),200,\
440 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
441 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
442 $(foreach object
,$(OBJCOBJECTS
),$(call gb_ObjCObject_get_target
,$(object
))) \
443 $(foreach object
,$(OBJCXXOBJECTS
),$(call gb_ObjCxxObject_get_target
,$(object
))) \
444 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
445 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
446 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
448 $(if
$(EXTRAOBJECTLISTS
),cat
$(EXTRAOBJECTLISTS
) >> $${TEMPFILE} && ) \
453 $(WORKDIR
)/LinkTarget
/%/.
dir :
454 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
456 # Target for the .exports of the shared library, to speed up incremental build.
457 # This deliberately does nothing if the file exists; the file is actually
458 # written in gb_LinkTarget__command_dynamiclink.
459 # Put this pattern rule here so it overrides the one below.
460 # (this is rather ugly: because of % the functions cannot be used)
461 $(WORKDIR
)/LinkTarget
/Library
/%.exports
:
462 $(if
$(wildcard $@
),,mkdir
-p
$(dir $@
) && touch
$@
)
464 # This recipe actually also builds the dep-target as a side-effect, which
465 # is an optimization to reduce incremental build time.
466 # (with exception for concat-dep executable itself which does not exist yet...)
467 $(WORKDIR
)/LinkTarget
/% : $(gb_Helper_MISCDUMMY
)
468 $(call gb_LinkTarget__command_impl
,$@
,$*)
470 # call gb_LinkTarget__make_installed_rule,linktarget
471 define gb_LinkTarget__make_installed_rule
472 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_LinkTarget_get_headers_target
,$(1))
473 $$(call gb_LinkTarget__command_impl
,$(call gb_LinkTarget_get_target
,$(1)),$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)))
477 # it's not possible to use a pattern rule for files in INSTDIR because
478 # it would inevitably conflict with the pattern rule for Package
479 # (especially since external libraries are delivered via Package)
480 # call gb_LinkTarget__command_impl,linktargettarget,linktargetname
481 define gb_LinkTarget__command_impl
482 $(if
$(gb_FULLDEPS
),\
483 $(if
$(findstring concat-deps
,$(2)),,\
484 $(call gb_LinkTarget__command_dep
,$(call gb_LinkTarget_get_dep_target
,$(2)).tmp
,$(2)) \
485 mv
$(call gb_LinkTarget_get_dep_target
,$(2)).tmp
$(call gb_LinkTarget_get_dep_target
,$(2))))
486 $(if
$(filter $(2),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library__get_workdir_linktargetname
,$(lib
)))),\
487 $(if
$(filter $(true
),$(call gb_LinkTarget__is_build_lib
,$(2))),\
488 $(call gb_LinkTarget__command
,$(1),$(2)),\
489 mkdir
-p
$(dir $(1)) && echo invalid
- merged lib
> $(1) \
490 $(if
$(SOVERSIONSCRIPT
),&& echo invalid
- merged lib
> $(WORKDIR
)/LinkTarget
/$(2))),\
491 $(call gb_LinkTarget__command
,$(1),$(2)))
492 $(call gb_LinkTarget__command_objectlist
,$(WORKDIR
)/LinkTarget
/$(2).objectlist
)
495 ifeq ($(gb_FULLDEPS
),$(true
))
496 $(call gb_LinkTarget_get_dep_target
,%) : $(call gb_Executable_get_runtime_dependencies
,concat-deps
)
497 $(call gb_LinkTarget__command_dep
,$@
,$*)
500 # Ok, this is some dark voodoo: When declaring a linktarget with
501 # gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the
502 # target. When the rule for the headertarget is executed and SELF does not
503 # match the target name, we are depending on a linktarget that was never
504 # declared. In a full build exclusively in gbuild that should never happen.
505 define gb_LinkTarget__get_headers_check
507 $$(eval
$$(call gb_Output_error
,used LinkTarget
$$* not defined
))
509 $$@
: COMMAND
:= $$(call gb_Helper_abbreviate_dirs
, touch
$$@
)
513 $(WORKDIR
)/Headers
/%/.
dir :
514 $(if
$(wildcard $(dir $@
)),,mkdir
-p
$(dir $@
))
516 # sadly because of the subdirectories can't have pattern deps on .dir here
517 $(WORKDIR
)/Headers
/% :
518 $(eval
$(gb_LinkTarget__get_headers_check
))
521 # Explanation of some of the targets:
522 # - gb_LinkTarget_get_headers_target is the target that guarantees all headers
523 # from the linked against libraries and the linktargets own generated headers
525 # - gb_LinkTarget_get_target links the objects into a file in WORKDIR.
526 # gb_LinkTarget_get_target depends on gb_LinkTarget_get_headers_target.
527 # gb_LinkTarget_get_target depends additionally on the objects, which in turn
528 # depend build-order only on the gb_LinkTarget_get_headers_target. The build
529 # order-only dependency ensures all headers to be there for compiling and
530 # dependency generation without causing all objects to be rebuild when one
531 # header changes. Only the ones with an explicit dependency in their generated
532 # dependency file will be rebuild.
534 # gb_LinkTarget_get_target is the target that links the objects into a file in
536 # Explanation of some of the variables:
537 # - AUXTARGETS are the additionally generated files that need to be cleaned out
539 # - PCH_CXXFLAGS and PCH_DEFS are the flags that the precompiled headers will
540 # be compiled with. They should never be overridden in a single object
542 # - TARGETTYPE is the type of linktarget as some platforms need very different
543 # command to link different targettypes.
544 # - LIBRARY_X64 is only relevant for building a x64 library on windows.
546 # Since most variables are set on the linktarget and not on the object, the
547 # object learns about these setting via GNU makes scoping of target variables.
548 # Therefore it is important that objects are only directly depended on by the
549 # linktarget. This for example means that you cannot build a single object
550 # alone, because then you would directly depend on the object.
552 # A note about flags: because the overriding the global variables with a target
553 # local variable of the same name is considered obscure, the target local
554 # variables have a T_ prefix.
556 # call gb_LinkTarget_LinkTarget,linktarget,linktargetmakefilename,layer
557 define gb_LinkTarget_LinkTarget
558 $(call gb_LinkTarget_get_clean_target
,$(1)) : LINKTARGET
:= $(1)
559 $(call gb_LinkTarget_get_clean_target
,$(1)) : AUXTARGETS
:=
560 $(call gb_LinkTarget_get_headers_target
,$(1)) : SELF
:= $(call gb_LinkTarget__get_workdir_linktargetname
,$(1))
561 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
562 |
$(dir $(call gb_LinkTarget_get_headers_target
,$(1))).
dir \
563 $(dir $(call gb_LinkTarget_get_target
,$(1))).
dir \
564 $(dir $(WORKDIR
)/LinkTarget
/$(call gb_LinkTarget__get_workdir_linktargetname
,$(1))).
dir
565 $(call gb_LinkTarget_get_target
,$(1)) : ILIBTARGET
:=
566 $(call gb_LinkTarget_get_clean_target
,$(1)) \
567 $(call gb_LinkTarget_get_target
,$(1)) : COBJECTS
:=
568 $(call gb_LinkTarget_get_clean_target
,$(1)) \
569 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
:=
570 $(call gb_LinkTarget_get_clean_target
,$(1)) \
571 $(call gb_LinkTarget_get_target
,$(1)) : YACCOBJECT
:=
572 $(call gb_LinkTarget_get_target
,$(1)) : T_YACCFLAGS
:= $$(gb_LinkTarget_YYACFLAGS
) $(YACCFLAGS
)
573 $(call gb_LinkTarget_get_clean_target
,$(1)) \
574 $(call gb_LinkTarget_get_target
,$(1)) : LEXOBJECT
:=
575 $(call gb_LinkTarget_get_target
,$(1)) : T_LEXFLAGS
:= $$(gb_LinkTarget_LEXFLAGS
) $(LEXFLAGS
)
576 $(call gb_LinkTarget_get_clean_target
,$(1)) \
577 $(call gb_LinkTarget_get_target
,$(1)) : OBJCOBJECTS
:=
578 $(call gb_LinkTarget_get_clean_target
,$(1)) \
579 $(call gb_LinkTarget_get_target
,$(1)) : OBJCXXOBJECTS
:=
580 $(call gb_LinkTarget_get_clean_target
,$(1)) \
581 $(call gb_LinkTarget_get_target
,$(1)) : ASMOBJECTS
:=
582 $(call gb_LinkTarget_get_clean_target
,$(1)) \
583 $(call gb_LinkTarget_get_target
,$(1)) : GENCOBJECTS
:=
584 $(call gb_LinkTarget_get_clean_target
,$(1)) \
585 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXOBJECTS
:=
586 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS
:= $$(gb_LinkTarget_CFLAGS
)
587 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS_APPEND
:=
588 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS
:= $$(gb_LinkTarget_CXXFLAGS
)
589 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS_APPEND
:=
590 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
:= $$(gb_LinkTarget_CXXFLAGS
)
591 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS
:= $$(gb_LinkTarget_OBJCXXFLAGS
)
592 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS_APPEND
:=
593 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS
:= $$(gb_LinkTarget_OBJCFLAGS
)
594 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS_APPEND
:=
595 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
:= $$(gb_LinkTarget_DEFAULTDEFS
) $(CPPFLAGS
)
596 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
:= $$(gb_LinkTarget_DEFAULTDEFS
) $(CPPFLAGS
)
597 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
:= $$(gb_LinkTarget_INCLUDE
)
598 $(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))
599 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
:=
600 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_STATIC_LIBS
:=
601 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
:=
602 $(call gb_LinkTarget_get_target
,$(1)) : TARGETTYPE
:=
603 $(call gb_LinkTarget_get_target
,$(1)) : LIBRARY_X64
:=
604 $(call gb_LinkTarget_get_target
,$(1)) : PCH_NAME
:=
605 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
:=
606 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
:=
607 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJNOEX
:=
608 $(call gb_LinkTarget_get_target
,$(1)) : PDBFILE
:=
609 $(call gb_LinkTarget_get_target
,$(1)) : TARGETGUI
:=
610 $(call gb_LinkTarget_get_target
,$(1)) : EXTRAOBJECTLISTS
:=
611 $(call gb_LinkTarget_get_target
,$(1)) : NATIVERES
:=
612 $(call gb_LinkTarget_get_target
,$(1)) : VISIBILITY
:=
613 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_NOT_ERRORS
:=
614 $(call gb_LinkTarget_get_target
,$(1)) : EXTERNAL_CODE
:=
615 $(call gb_LinkTarget_get_target
,$(1)) : SOVERSIONSCRIPT
:=
617 ifeq ($(gb_FULLDEPS
),$(true
))
618 ifeq (depcache
:,$(filter depcache
,$(.FEATURES
)):$(gb_PARTIAL_BUILD
))
619 -includedepcache
$(call gb_LinkTarget_get_dep_target
,$(1))
621 -include $(call gb_LinkTarget_get_dep_target
,$(1))
623 $(call gb_LinkTarget_get_dep_target
,$(1)) : COBJECTS
:=
624 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXOBJECTS
:=
625 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCOBJECTS
:=
626 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCXXOBJECTS
:=
627 $(call gb_LinkTarget_get_dep_target
,$(1)) : ASMOBJECTS
:=
628 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCOBJECTS
:=
629 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXOBJECTS
:=
630 $(call gb_LinkTarget_get_dep_target
,$(1)) : YACCOBJECTS
:=
633 gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)) := cxx
635 # installed linktargets need a rule to build!
636 $(if
$(findstring $(INSTDIR
),$(1)),$(call gb_LinkTarget__make_installed_rule
,$(1)))
640 # call gb_LinkTarget_set_soversion_script,linktarget,soversionscript
641 define gb_LinkTarget_set_soversion_script
642 $(call gb_LinkTarget_get_target
,$(1)) : $(2)
643 $(call gb_LinkTarget_get_target
,$(1)) : SOVERSIONSCRIPT
:= $(2)
647 # call gb_LinkTarget_add_defs,linktarget,defines
648 define gb_LinkTarget_add_defs
649 $(call gb_LinkTarget_get_target
,$(1)) : DEFS
+= $(2)
650 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
+= $(2)
653 # call gb_LinkTarget_add_cflags,linktarget,cflags
654 define gb_LinkTarget_add_cflags
655 $(call gb_LinkTarget_get_target
,$(1)) : T_CFLAGS_APPEND
+= $(2)
658 # call gb_LinkTarget_add_cxxflags,linktarget,cxxflags
659 define gb_LinkTarget_add_cxxflags
660 $(call gb_LinkTarget_get_target
,$(1)) : T_CXXFLAGS_APPEND
+= $(2)
661 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
+= $(2)
664 # call gb_LinkTarget_add_objcxxflags,linktarget,objcxxflags
665 define gb_LinkTarget_add_objcxxflags
666 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCXXFLAGS_APPEND
+= $(2)
669 # call gb_LinkTarget_add_objcflags,linktarget,objcflags
670 define gb_LinkTarget_add_objcflags
671 $(call gb_LinkTarget_get_target
,$(1)) : T_OBJCFLAGS_APPEND
+= $(2)
675 # call gb_LinkTarget__add_include,linktarget,includes
676 define gb_LinkTarget__add_include
677 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
+= -I
$(2)
681 # call gb_LinkTarget__check_srcdir_paths,linktarget,includepaths
682 define gb_LinkTarget__check_srcdir_paths
683 $(if
$(filter-out $(wildcard $(2)),$(2)),\
684 $(call gb_Output_error
,gb_LinkTarget_set_include
: include paths
$(filter-out $(wildcard $(2)),$(2)) do not exist
) \
688 # call gb_LinkTarget_set_include,linktarget,includes
689 define gb_LinkTarget_set_include
690 $(call gb_LinkTarget__check_srcdir_paths
,$(1),\
691 $(patsubst -I
%,%,$(filter -I
$(SRCDIR
)/%,$(filter-out -I
$(WORKDIR
)/%,$(2)))))
692 $(call gb_LinkTarget_get_target
,$(1)) : INCLUDE
:= $(2)
696 # call gb_LinkTarget_add_ldflags,linktarget,ldflags
697 define gb_LinkTarget_add_ldflags
698 $(call gb_LinkTarget_get_target
,$(1)) : T_LDFLAGS
+= $(2)
702 # real use in RepositoryExternal.mk
703 # call gb_LinkTarget_set_ldflags,linktarget,ldflags
704 define gb_LinkTarget_set_ldflags
705 $(call gb_LinkTarget_get_target
,$(1)) : T_LDFLAGS
:= $(2)
709 # call gb_LinkTarget_add_libs,linktarget,libs
710 define gb_LinkTarget_add_libs
711 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
+= $(2)
712 $(if
$(call gb_LinkTarget__is_merged
,$(1)),\
713 $(call gb_LinkTarget_get_target
,$(call gb_Library_get_linktarget
,merged
)) : T_LIBS
+= $(2))
717 # remove platform specific standard libraries for linktarget $(1)
718 # assumption is that adding these standard libs is always useful, but in very
719 # exceptional cases this disable method may be used
720 # call gb_LinkTarget_disable_standard_system_libs,linktarget
721 define gb_LinkTarget_disable_standard_system_libs
722 $(call gb_LinkTarget_get_target
,$(1)) : T_LIBS
:= $$(filter-out $$(gb_STDLIBS
),$$(T_LIBS
))
726 # call gb_LinkTarget__use_api,linktarget,api
727 define gb_LinkTarget__use_api
728 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(call gb_UnoApiHeadersTarget_get_target
,$(2))
729 $(call gb_LinkTarget__add_include
,$(1),$(call gb_UnoApiHeadersTarget_get_dir
,$(2)))
733 # call gb_LinkTarget_use_api,linktarget,apis
734 define gb_LinkTarget_use_api
735 $(foreach api
,$(2),$(call gb_LinkTarget__use_api
,$(1),$(api
)))
739 # call gb_LinkTarget_use_udk_api,linktarget
740 define gb_LinkTarget_use_udk_api
741 $(call gb_LinkTarget__use_api
,$(1),udkapi
)
744 # call gb_LinkTarget_use_sdk_api,linktarget
745 define gb_LinkTarget_use_sdk_api
746 $(call gb_LinkTarget__use_api
,$(1),udkapi
)
747 $(call gb_LinkTarget__use_api
,$(1),offapi
)
750 # call gb_LinkTarget__use_internal_api_one,linktarget,api,apiprefix
751 define gb_LinkTarget__use_internal_api_one
752 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
753 $(call gb_UnoApiHeadersTarget_get_
$(3)target
,$(2))
754 $(call gb_LinkTarget__add_include
,$(1),$(call gb_UnoApiHeadersTarget_get_
$(3)dir,$(2)))
758 # call gb_LinkTarget__use_internal_api,linktarget,apis,apiprefix
759 define gb_LinkTarget__use_internal_api
760 $(foreach api
,$(2),$(call gb_LinkTarget__use_internal_api_one
,$(1),$(api
),$(3)))
764 # call gb_LinkTarget_use_internal_api,linktarget,api
765 define gb_LinkTarget_use_internal_api
766 $(call gb_LinkTarget__use_internal_api
,$(1),$(2))
770 # call gb_LinkTarget_use_internal_bootstrap_api,linktarget,api
771 define gb_LinkTarget_use_internal_bootstrap_api
772 $(call gb_LinkTarget__use_internal_api
,$(1),$(2),bootstrap_
)
776 # call gb_LinkTarget_use_internal_comprehensive_api,linktarget,api
777 define gb_LinkTarget_use_internal_comprehensive_api
778 $(call gb_LinkTarget__use_internal_api
,$(1),$(2),comprehensive_
)
782 define gb_PrintDeps_info
783 $(info LibraryDep
: $(1) links against
$(2))
786 # avoid problem when a module is built partially but other modules that define
787 # needed libraries is not yet built: prevent invocation of pattern rule
788 # for library with invalid parameters by depending on the header target
789 define gb_LinkTarget__lib_dummy_depend
790 $(call gb_Library_get_target
,$(1)) :|
$(call gb_Library_get_headers_target
,$(1))
794 # call gb_LinkTarget__use_libraries,linktarget,requestedlibs,actuallibs,linktargetmakefilename
795 define gb_LinkTarget__use_libraries
797 # used by bin/module-deps.pl
798 ifneq ($(ENABLE_PRINT_DEPS
),)
799 # exclude libraries in Library_merged
800 ifeq ($(filter $(1),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library_get_linktarget
,$(lib
)))),)
801 $$(eval
$$(call gb_PrintDeps_info
,$(4),$(3)))
805 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_LIBS
+= $(3)
807 # depend on the exports of the library, not on the library itself
808 # for faster incremental builds when the ABI is unchanged
809 ifeq ($(DISABLE_DYNLOADING
),)
810 $(call gb_LinkTarget_get_target
,$(1)) : \
811 $(foreach lib
,$(3),$(call gb_Library_get_exports_target
,$(lib
)))
813 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
814 $(foreach lib
,$(2),$(call gb_Library_get_headers_target
,$(lib
)))
815 $(foreach lib
,$(2),$(call gb_LinkTarget__lib_dummy_depend
,$(lib
)))
819 # libraries which are merged but need to be built for gb_BUILD_HELPER_TOOLS
820 gb_BUILD_HELPER_LIBS
:= basegfx \
832 # tools libmerged depends on, so they link against gb_BUILD_HELPER_LIBS
833 gb_BUILD_HELPER_TOOLS
:= $(foreach exe
,\
839 , $(call gb_Executable__get_workdir_linktargetname
,$(exe
)))
841 # call gb_LinkTarget__is_build_lib,linktargetname
842 define gb_LinkTarget__is_build_lib
843 $(if
$(filter $(call gb_LinkTarget__get_workdir_linktargetname
,$(1)),$(foreach lib
,$(gb_BUILD_HELPER_LIBS
),$(call gb_Library__get_workdir_linktargetname
,$(lib
)))),$(true
),$(false
))
846 # call gb_LinkTarget__is_build_tool,linktargetname
847 define gb_LinkTarget__is_build_tool
848 $(if
$(filter $(call gb_LinkTarget__get_workdir_linktargetname
,$(1)),$(call gb_BUILD_HELPER_TOOLS
)),$(true
),$(false
))
851 define gb_LinkTarget__is_merged
852 $(filter $(1),$(foreach lib
,$(gb_MERGEDLIBS
),$(call gb_Library_get_linktarget
,$(lib
))))
855 # call gb_LinkTarget_use_libraries,linktarget,libs
856 define gb_LinkTarget_use_libraries
857 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS
),$(2)))
858 $$(eval
$$(call gb_Output_info
,currently known libraries are
: $(sort $(gb_Library_KNOWNLIBS
)),ALL
))
859 $$(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
))
862 ifeq ($(call gb_LinkTarget__is_build_tool
,$(1)),$(true
))
863 $(call gb_LinkTarget__use_libraries
,$(1),$(2),$(2),$(4))
865 $(call gb_LinkTarget__use_libraries
,$(1),$(2),$(strip \
866 $(if
$(filter $(gb_MERGEDLIBS
),$(2)), \
867 $(if
$(call gb_LinkTarget__is_merged
,$(1)), \
868 $(filter $(gb_MERGEDLIBS
),$(2)), merged
)) \
869 $(filter-out $(gb_MERGEDLIBS
),$(2)) \
875 # avoid problem when a module is built partially but other modules that define
876 # needed static libraries is not yet built: prevent invocation of pattern rule
877 # for static library with invalid parameters by depending on the header target
878 define gb_LinkTarget__static_lib_dummy_depend
879 $(call gb_StaticLibrary_get_target
,$(1)) :| \
880 $(call gb_StaticLibrary_get_headers_target
,$(1))
884 # for a StaticLibrary, dependent libraries are not actually linked in
885 # call gb_LinkTarget_use_static_libraries,linktarget,staticlibs
886 define gb_LinkTarget_use_static_libraries
887 $(call gb_LinkTarget_get_target
,$(1)) : LINKED_STATIC_LIBS
+= $$(if
$$(filter-out StaticLibrary
,$$(TARGETTYPE
)),$(2))
888 $(if
$(call gb_LinkTarget__is_merged
,$(1)),\
889 $(call gb_LinkTarget_get_target
,$(call gb_Library_get_linktarget
,merged
)) : \
890 LINKED_STATIC_LIBS
+= $$(if
$$(filter-out StaticLibrary
,$$(TARGETTYPE
)),$(2)))
892 ifeq ($(DISABLE_DYNLOADING
),)
893 $(call gb_LinkTarget_get_target
,$(1)) : $(foreach lib
,$(2),$(call gb_StaticLibrary_get_target
,$(lib
)))
895 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
896 $(foreach lib
,$(2),$(call gb_StaticLibrary_get_headers_target
,$(lib
)))
897 $(foreach lib
,$(2),$(call gb_LinkTarget__static_lib_dummy_depend
,$(lib
)))
901 # call gb_LinkTarget_add_cobject,linktarget,sourcefile,cflags,linktargetmakefilename
902 define gb_LinkTarget_add_cobject
903 $(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)))))
904 $(call gb_LinkTarget_get_target
,$(1)) : COBJECTS
+= $(2)
905 $(call gb_LinkTarget_get_clean_target
,$(1)) : COBJECTS
+= $(2)
907 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CObject_get_target
,$(2))
908 $(call gb_CObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
909 $(call gb_CObject_get_target
,$(2)) : T_CFLAGS
+= $(call gb_LinkTarget__get_cflags
,$(4)) $(3)
910 $(call gb_CObject_get_target
,$(2)) : \
911 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
913 ifeq ($(gb_FULLDEPS
),$(true
))
914 $(call gb_LinkTarget_get_dep_target
,$(1)) : COBJECTS
+= $(2)
915 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CObject_get_dep_target
,$(2))
916 $(call gb_CObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CObject_get_dep_target
,$(2))).
dir
917 $(call gb_CObject_get_target
,$(2)) :|
$(dir $(call gb_CObject_get_dep_target
,$(2))).
dir
922 # call gb_LinkTarget_add_cxxobject,linktarget,sourcefile,cxxflags,linktargetmakefilename
923 define gb_LinkTarget_add_cxxobject
924 $(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)))))
925 $(call gb_LinkTarget_get_target
,$(1)) : CXXOBJECTS
+= $(2)
926 $(call gb_LinkTarget_get_clean_target
,$(1)) : CXXOBJECTS
+= $(2)
928 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_CxxObject_get_target
,$(2))
929 $(call gb_CxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
930 $(call gb_CxxObject_get_target
,$(2)) : T_CXXFLAGS
+= $(3)
931 $(call gb_CxxObject_get_target
,$(2)) : \
932 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
933 ifeq ($(gb_ENABLE_PCH
),$(true
))
934 $(call gb_CxxObject_get_target
,$(2)) : $(call gb_PrecompiledHeader_get_timestamp
,$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)))
937 ifeq ($(gb_FULLDEPS
),$(true
))
938 $(call gb_LinkTarget_get_dep_target
,$(1)) : CXXOBJECTS
+= $(2)
939 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_CxxObject_get_dep_target
,$(2))
940 $(call gb_CxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_CxxObject_get_dep_target
,$(2))).
dir
941 $(call gb_CxxObject_get_target
,$(2)) :|
$(dir $(call gb_CxxObject_get_dep_target
,$(2))).
dir
946 # call gb_LinkTarget_add_objcobject,linktarget,sourcefile,objcflags,linktargetmakefilename
947 define gb_LinkTarget_add_objcobject
948 $(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)))))
949 $(call gb_LinkTarget_get_target
,$(1)) : OBJCOBJECTS
+= $(2)
950 $(call gb_LinkTarget_get_clean_target
,$(1)) : OBJCOBJECTS
+= $(2)
952 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_ObjCObject_get_target
,$(2))
953 $(call gb_ObjCObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
954 $(call gb_ObjCObject_get_target
,$(2)) : T_OBJCFLAGS
+= $(call gb_LinkTarget__get_objcflags
,$(4)) $(3)
955 $(call gb_ObjCObject_get_target
,$(2)) : \
956 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
958 ifeq ($(gb_FULLDEPS
),$(true
))
959 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCOBJECTS
+= $(2)
960 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_ObjCObject_get_dep_target
,$(2))
961 $(call gb_ObjCObject_get_dep_target
,$(2)) :|
$(dir $(call gb_ObjCObject_get_dep_target
,$(2))).
dir
962 $(call gb_ObjCObject_get_target
,$(2)) :|
$(dir $(call gb_ObjCObject_get_dep_target
,$(2))).
dir
967 # call gb_LinkTarget_add_objcxxobject,linktarget,sourcefile,objcxxflags,linktargetmakefilename
968 define gb_LinkTarget_add_objcxxobject
969 $(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)))))
970 $(call gb_LinkTarget_get_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
971 $(call gb_LinkTarget_get_clean_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
973 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_ObjCxxObject_get_target
,$(2))
974 $(call gb_ObjCxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
975 $(call gb_ObjCxxObject_get_target
,$(2)) : T_OBJCXXFLAGS
+= $(call gb_LinkTarget__get_objcxxflags
,$(4)) $(3)
976 $(call gb_ObjCxxObject_get_target
,$(2)) : \
977 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
979 ifeq ($(gb_FULLDEPS
),$(true
))
980 $(call gb_LinkTarget_get_dep_target
,$(1)) : OBJCXXOBJECTS
+= $(2)
981 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_ObjCxxObject_get_dep_target
,$(2))
982 $(call gb_ObjCxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_ObjCxxObject_get_dep_target
,$(2))).
dir
983 $(call gb_ObjCxxObject_get_target
,$(2)) :|
$(dir $(call gb_ObjCxxObject_get_dep_target
,$(2))).
dir
988 # call gb_LinkTarget_add_asmobject,linktarget,sourcefile
989 define gb_LinkTarget_add_asmobject
990 $(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)))))
991 $(call gb_LinkTarget_get_target
,$(1)) : ASMOBJECTS
+= $(2)
992 $(call gb_LinkTarget_get_clean_target
,$(1)) : ASMOBJECTS
+= $(2)
994 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_AsmObject_get_target
,$(2))
995 $(call gb_AsmObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
996 $(call gb_AsmObject_get_target
,$(2)) : \
997 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
999 ifeq ($(gb_FULLDEPS
),$(true
))
1000 $(call gb_LinkTarget_get_dep_target
,$(1)) : ASMOBJECTS
+= $(2)
1001 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_AsmObject_get_dep_target
,$(2))
1002 $(call gb_AsmObject_get_dep_target
,$(2)) :|
$(dir $(call gb_AsmObject_get_dep_target
,$(2))).
dir
1003 $(call gb_AsmObject_get_target
,$(2)) :|
$(dir $(call gb_AsmObject_get_dep_target
,$(2))).
dir
1008 # call gb_LinkTarget_add_generated_c_object,linktarget,sourcefile,cflags,linktargetmakefilename
1009 define gb_LinkTarget_add_generated_c_object
1010 $(call gb_LinkTarget_get_target
,$(1)) : GENCOBJECTS
+= $(2)
1011 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCOBJECTS
+= $(2)
1013 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCObject_get_target
,$(2))
1014 $(call gb_GenCObject_get_target
,$(2)) : $(call gb_GenCObject_get_source
,$(2))
1015 # Often gb_GenCObject_get_source does not have its own rule and is only a byproduct.
1016 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1017 $(call gb_GenCObject_get_source
,$(2)) : |
$(gb_Helper_MISCDUMMY
)
1018 $(call gb_GenCObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1019 $(call gb_GenCObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1020 $(call gb_GenCObject_get_target
,$(2)) : T_CFLAGS
+= $(call gb_LinkTarget__get_cflags
,$(4)) $(3)
1021 $(call gb_GenCObject_get_target
,$(2)) : \
1022 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1024 ifeq ($(gb_FULLDEPS
),$(true
))
1025 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCOBJECTS
+= $(2)
1026 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCObject_get_dep_target
,$(2))
1027 $(call gb_GenCObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCObject_get_dep_target
,$(2))).
dir
1028 $(call gb_GenCObject_get_target
,$(2)) :|
$(dir $(call gb_GenCObject_get_dep_target
,$(2))).
dir
1033 # call gb_LinkTarget_add_generated_cxx_object,linktarget,sourcefile,cxxflags,linktargetmakefilename
1034 define gb_LinkTarget_add_generated_cxx_object
1035 $(call gb_LinkTarget_get_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1036 $(call gb_LinkTarget_get_clean_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1038 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_GenCxxObject_get_target
,$(2))
1039 $(call gb_GenCxxObject_get_target
,$(2)) : $(call gb_GenCxxObject_get_source
,$(2),$(1))
1040 # Often gb_GenCxxObject_get_source does not have its own rule and is only a byproduct.
1041 # That's why we need this order-only dependency on gb_Helper_MISCDUMMY
1042 $(call gb_GenCxxObject_get_source
,$(2),$(1)) : |
$(gb_Helper_MISCDUMMY
)
1043 $(call gb_GenCxxObject_get_target
,$(2)) : |
$(call gb_LinkTarget_get_headers_target
,$(1))
1044 $(call gb_GenCxxObject_get_target
,$(2)) : WARNINGS_NOT_ERRORS
:= $(true
)
1045 $(call gb_GenCxxObject_get_target
,$(2)) : T_CXXFLAGS
+= $(3)
1046 $(call gb_GenCxxObject_get_target
,$(2)) : \
1047 OBJECTOWNER
:= $(call gb_Object__owner
,$(2),$(1))
1048 $(call gb_GenCxxObject_get_target
,$(2)) : GEN_CXX_SOURCE
:= $(call gb_GenCxxObject_get_source
,$(2),$(1))
1049 ifeq ($(gb_ENABLE_PCH
),$(true
))
1050 $(call gb_GenCxxObject_get_target
,$(2)) : $(call gb_PrecompiledHeader_get_timestamp
,$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)))
1053 ifeq ($(gb_FULLDEPS
),$(true
))
1054 $(call gb_LinkTarget_get_dep_target
,$(1)) : GENCXXOBJECTS
+= $(2)
1055 $(call gb_LinkTarget_get_dep_target
,$(1)) : $(call gb_GenCxxObject_get_dep_target
,$(2))
1056 $(call gb_GenCxxObject_get_dep_target
,$(2)) :|
$(dir $(call gb_GenCxxObject_get_dep_target
,$(2))).
dir
1057 $(call gb_GenCxxObject_get_target
,$(2)) :|
$(dir $(call gb_GenCxxObject_get_dep_target
,$(2))).
dir
1062 # Add a bison grammar to the build.
1063 # call gb_LinkTarget_add_grammar,linktarget,yaccfile,linktargetmakefilename,cxxflags
1064 define gb_LinkTarget_add_grammar
1065 $(call gb_YaccTarget_YaccTarget
,$(2))
1066 $(call gb_LinkTarget_add_generated_exception_object
,$(1),YaccTarget
/$(2),$(3),$(if
$(filter GCC
,$(COM
)),-Wno-unused-macros
))
1067 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_YaccTarget_get_clean_target
,$(2))
1068 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(call gb_YaccTarget_get_header_target
,$(2))
1069 $(call gb_LinkTarget__add_include
,$(1),$(dir $(call gb_YaccTarget_get_header_target
,$(2))))
1073 # Add bison grammars to the build.
1074 # call gb_LinkTarget_add_grammars,linktarget,yaccfiles,ignored,linktargetmakefilename
1075 define gb_LinkTarget_add_grammars
1076 $(foreach grammar
,$(2),$(call gb_LinkTarget_add_grammar
,$(1),$(grammar
),$(4)))
1079 # Add a flex scanner to the build.
1080 # call gb_LinkTarget_add_scanner,linktarget,lexfile,linktargetmakefilename,cxxflags
1081 define gb_LinkTarget_add_scanner
1082 $(call gb_LexTarget_LexTarget
,$(2))
1083 $(call gb_LinkTarget_add_generated_exception_object
,$(1),LexTarget
/$(2),$(3),$(if
$(filter GCC
,$(COM
)),-Wno-unused-macros
))
1084 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_LexTarget_get_clean_target
,$(2))
1088 # Add flex scanners to the build.
1089 # call gb_LinkTarget_add_scanners,linktarget,lexfiles,ignored,linktargetmakefilename
1090 define gb_LinkTarget_add_scanners
1091 $(foreach scanner
,$(2),$(call gb_LinkTarget_add_scanner
,$(1),$(scanner
),$(4)))
1095 # call gb_LinkTarget_add_exception_object,linktarget,sourcefile,linktargetmakefilename
1096 define gb_LinkTarget_add_exception_object
1097 $(call gb_LinkTarget_add_cxxobject
,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS
) $(call gb_LinkTarget__get_cxxflags
,$(3)))
1100 # call gb_LinkTarget__use_linktarget_objects,linktarget,linktargets
1101 define gb_LinkTarget__use_linktarget_objects
1102 $(call gb_LinkTarget_get_target
,$(1)) : $(foreach linktarget
,$(2),$(call gb_LinkTarget_get_target
,$(linktarget
)))
1104 $(call gb_LinkTarget_get_target
,$(1)) : EXTRAOBJECTLISTS
+= $(foreach linktarget
,$(2),$(call gb_LinkTarget_get_objects_list
,$(linktarget
)))
1109 # call gb_LinkTarget_use_library_objects,linktarget,libs
1110 define gb_LinkTarget_use_library_objects
1111 ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS
),$(2)))
1112 $$(eval
$$(call gb_Output_info
,currently known libraries are
: $(sort $(gb_Library_KNOWNLIBS
)),ALL
))
1113 $$(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
))
1115 $(call gb_LinkTarget__use_linktarget_objects
,$(1),$(foreach lib
,$(2),$(call gb_Library_get_linktarget
,$(lib
))))
1116 $(call gb_LinkTarget_get_headers_target
,$(1)) : \
1117 $(foreach lib
,$(2),$(call gb_Library_get_headers_target
,$(lib
)))
1121 # call gb_LinkTarget_use_executable_objects,linktarget,exes
1122 define gb_LinkTarget_use_executable_objects
1123 $(call gb_LinkTarget__use_linktarget_objects
,$(1),$(foreach exe
,$(2),$(call gb_Executable_get_linktarget
,$(exe
))))
1127 # call gb_LinkTarget_add_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1128 define gb_LinkTarget_add_cobjects
1129 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cobject
,$(1),$(obj
),$(3),$(4)))
1132 # call gb_LinkTarget_add_cxxobjects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1133 define gb_LinkTarget_add_cxxobjects
1134 $(foreach obj
,$(2),$(call gb_LinkTarget_add_cxxobject
,$(1),$(obj
),$(3)))
1137 # call gb_LinkTarget_add_objcobjects,linktarget,sourcefiles,objcflags,linktargetmakefilename
1138 define gb_LinkTarget_add_objcobjects
1139 $(foreach obj
,$(2),$(call gb_LinkTarget_add_objcobject
,$(1),$(obj
),$(3),$(4)))
1142 # call gb_LinkTarget_add_objcxxobjects,linktarget,sourcefiles,objcxxflags,linktargetmakefilename
1143 define gb_LinkTarget_add_objcxxobjects
1144 $(foreach obj
,$(2),$(call gb_LinkTarget_add_objcxxobject
,$(1),$(obj
),$(3),$(4)))
1147 # call gb_LinkTarget_add_asmobjects,linktarget,sourcefiles,asmflags,linktargetmakefilename
1148 define gb_LinkTarget_add_asmobjects
1149 $(foreach obj
,$(2),$(call gb_LinkTarget_add_asmobject
,$(1),$(obj
),$(3)))
1152 # call gb_LinkTarget_add_exception_objects,linktarget,sourcefiles,ignored,linktargetmakefilename
1153 define gb_LinkTarget_add_exception_objects
1154 $(foreach obj
,$(2),$(call gb_LinkTarget_add_exception_object
,$(1),$(obj
),$(4)))
1157 #only useful for building x64 libraries on windows
1158 # call gb_LinkTarget_add_x64_generated_exception_objects,linktarget,sourcefiles,ignored,linktargetmakefilename
1159 define gb_LinkTarget_add_x64_generated_exception_objects
1160 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_exception_object
,$(1),$(obj
),$(4)))
1161 $(foreach obj
,$(2),$(eval
$(call gb_GenCxxObject_get_target
,$(obj
)) : CXXOBJECT_X64
:= YES
))
1164 # call gb_LinkTarget_add_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1165 define gb_LinkTarget_add_generated_cobjects
1166 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_c_object
,$(1),$(obj
),$(3),$(4)))
1169 #only useful for building x64 libraries on windows
1170 # call gb_LinkTarget_add_x64_generated_cobjects,linktarget,sourcefiles,cflags,linktargetmakefilename
1171 define gb_LinkTarget_add_x64_generated_cobjects
1172 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_c_object
,$(1),$(obj
),$(3),$(4)))
1173 $(foreach obj
,$(2),$(eval
$(call gb_GenCObject_get_target
,$(obj
)) : CXXOBJECT_X64
:= YES
))
1176 # call gb_LinkTarget_add_generated_cxxobjects,linktarget,sourcefiles,cxxflags,linktargetmakefilename
1177 define gb_LinkTarget_add_generated_cxxobjects
1178 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_cxx_object
,$(1),$(obj
),$(3)))
1181 # call gb_LinkTarget_add_generated_exception_object,linktarget,sourcefile,linktargetmakefilename,cxxflags
1182 define gb_LinkTarget_add_generated_exception_object
1183 $(call gb_LinkTarget_add_generated_cxx_object
,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS
) $(call gb_LinkTarget__get_cxxflags
,$(3)) $(4))
1186 # call gb_LinkTarget_add_generated_exception_objects,linktarget,sourcefile,ignored,linktargetmakefilename
1187 define gb_LinkTarget_add_generated_exception_objects
1188 $(foreach obj
,$(2),$(call gb_LinkTarget_add_generated_exception_object
,$(1),$(obj
),$(4)))
1191 # call gb_LinkTarget_set_targettype,linktarget,targettype
1192 define gb_LinkTarget_set_targettype
1193 $(call gb_LinkTarget_get_target
,$(1)) : TARGETTYPE
:= $(2)
1197 # call gb_LinkTarget_set_x64,linktarget,boolean
1198 define gb_LinkTarget_set_x64
1199 $(call gb_LinkTarget_get_target
,$(1)) : LIBRARY_X64
:= $(2)
1203 # call gb_LinkTarget_set_ilibtarget,linktarget,ilibfilename
1204 define gb_LinkTarget_set_ilibtarget
1205 $(call gb_LinkTarget_get_clean_target
,$(1)) \
1206 $(call gb_LinkTarget_get_target
,$(1)) : ILIBTARGET
:= $(2)
1210 # Add a file that is built by the LinkTarget command and define
1211 # a dummy touch rule for it so it can be tracked via dependencies.
1212 # The assumption is that the file is created by linking; in case it does not
1213 # exist there is some problem. This can be caused on WNT by re-naming DLL
1214 # files (which are aux-targets) but not the import .lib files (which
1215 # are the LinkTargets) and doing an incremental build.
1216 # call gb_LinkTarget_add_auxtarget,linktarget,auxtarget
1217 define gb_LinkTarget_add_auxtarget
1218 $(2) : $(call gb_LinkTarget_get_target
,$(1))
1219 if
test -e
$$@
; then \
1223 echo
"ERROR: aux-target missing, library deleted, please try running make again"; \
1227 $(call gb_LinkTarget_get_clean_target
,$(1)) : AUXTARGETS
+= $(2)
1231 # call gb_LinkTarget_add_auxtargets,linktarget,auxtargets
1232 define gb_LinkTarget_add_auxtargets
1233 $(foreach aux
,$(2),$(call gb_LinkTarget_add_auxtarget
,$(1),$(aux
)))
1237 # call gb_LinkTarget__use_custom_headers,linktarget,customtarget
1238 define gb_LinkTarget__use_custom_headers
1239 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
1240 $(call gb_CustomTarget_get_target
,$(2))
1241 $(call gb_LinkTarget__add_include
,$(1),$(call gb_CustomTarget_get_workdir
,$(2)))
1245 # call gb_LinkTarget_use_custom_headers,linktarget,customtargets
1246 define gb_LinkTarget_use_custom_headers
1247 $(foreach customtarget
,$(2),$(call gb_LinkTarget__use_custom_headers
,$(1),$(customtarget
)))
1251 # add SDI (svidl) headers
1252 # call gb_LinkTarget_add_sdi_headers,linktarget,sditargets
1253 define gb_LinkTarget_add_sdi_headers
1254 $(call gb_LinkTarget_get_headers_target
,$(1)) : $(foreach sdi
,$(2),$(call gb_SdiTarget_get_target
,$(sdi
)))
1255 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(foreach sdi
,$(2),$(call gb_SdiTarget_get_clean_target
,$(sdi
)))
1259 # call gb_LinkTarget__set_precompiled_header_impl,linktarget,pchcxxfile,pchtarget,linktargetmakefilename
1260 define gb_LinkTarget__set_precompiled_header_impl
1261 $(call gb_LinkTarget_get_clean_target
,$(1)) : $(call gb_PrecompiledHeader_get_clean_target
,$(3))
1262 $(call gb_PrecompiledHeader_get_target
,$(3)) : $(2).
cxx
1264 $(call gb_PrecompiledHeader_get_target
,$(3)) : $(call gb_LinkTarget_get_headers_target
,$(1))
1266 $(call gb_LinkTarget_get_target
,$(1)) : PCH_NAME
:= $(3)
1267 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJEX
= $(call gb_PrecompiledHeader_get_objectfile
, $(call gb_PrecompiledHeader_get_target
,$(3)))
1268 $(call gb_LinkTarget_get_target
,$(1)) : PCHOBJS
= $$(PCHOBJEX
)
1270 $(call gb_LinkTarget_get_target
,$(1)) : PCH_DEFS
:= $$(DEFS
)
1271 $(call gb_LinkTarget_get_target
,$(1)) : PCH_CXXFLAGS
:= $$(T_CXXFLAGS
) $(call gb_LinkTarget__get_cxxflags
,$(4))
1273 $(call gb_PrecompiledHeader_get_target
,$(3)) : VISIBILITY
:=
1275 $(call gb_PrecompiledHeader_get_timestamp
,$(call gb_LinkTarget__get_workdir_linktargetname
,$(1))) : $(call gb_PrecompiledHeader_get_target
,$(3))
1277 ifeq ($(gb_FULLDEPS
),$(true
))
1278 -include $(call gb_PrecompiledHeader_get_dep_target
,$(3))
1283 # call gb_LinkTarget_set_precompiled_header,linktarget,pchcxxfile,linktargetmakefilename
1284 define gb_LinkTarget_set_precompiled_header
1285 ifeq ($(gb_ENABLE_PCH
),$(true
))
1286 $(call gb_LinkTarget__set_precompiled_header_impl
,$(1),$(2),$(notdir $(2)),$(4))
1291 # use a header package, possibly from another module
1292 # call gb_LinkTarget_use_package,linktarget,package
1293 define gb_LinkTarget_use_package
1294 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
1295 $(call gb_Package_get_target
,$(strip $(2)))
1299 # call gb_LinkTarget_use_packages,linktarget,packages
1300 define gb_LinkTarget_use_packages
1301 $(foreach package
,$(2),$(call gb_LinkTarget_use_package
,$(1),$(package
)))
1304 # use a GeneratedPackage, possibly from another module
1305 # call gb_LinkTarget_use_generated_package,linktarget,package
1306 define gb_LinkTarget_use_generated_package
1307 $(call gb_LinkTarget_get_headers_target
,$(1)) :| \
1308 $(call gb_GeneratedPackage_get_target
,$(strip $(2)))
1312 # Use sources from unpacked tarball of an external project
1313 # call gb_LinkTarget_use_unpacked,linktarget,unpackedtarget
1314 define gb_LinkTarget_use_unpacked
1315 $(call gb_LinkTarget_get_headers_target
,$(1)) :|
$(call gb_UnpackedTarball_get_final_target
,$(2))
1319 # Use artifacts from ExternalProject (i. e. configure) of an external project
1320 # example in expat: StaticLibrary depends on ExternalProject outcome
1321 # call gb_LinkTarget_use_external_project,linktarget,externalproject
1322 define gb_LinkTarget_use_external_project
1323 $(call gb_LinkTarget_get_headers_target
,$(1)) :|
$(call gb_ExternalProject_get_target
,$(2))
1327 # Delay linking until a res target has been built. This is needed so that
1328 # unit tests using libraries do not fail if the res target is not yet built.
1330 # call gb_LinkTarget_use_restarget,linktarget,restarget(s)
1331 define gb_LinkTarget_use_restarget
1332 $(call gb_LinkTarget_get_target
,$(1)) :| \
1333 $(foreach res
,$(2),$(call gb_AllLangResTarget_get_target
,$(res
)))
1337 # this forwards to functions that must be defined in RepositoryExternal.mk.
1338 # Automatically forward for libmerged library too when linktarget is merged.
1340 # call gb_LinkTarget_use_external,linktarget,external
1341 define gb_LinkTarget_use_external
1342 $(if
$(filter undefined
,$(origin gb_LinkTarget__use_
$(2))),\
1343 $(error gb_LinkTarget_use_external
: unknown external
: $(2)),\
1344 $(if
$(call gb_LinkTarget__is_merged
,$(1)),$(call gb_LinkTarget__use_
$(2),$(call gb_Library_get_linktarget
,merged
))) \
1345 $(call gb_LinkTarget__use_
$(2),$(1)) \
1349 # $(call gb_LinkTarget_use_externals,library,externals)
1350 gb_LinkTarget_use_externals
= \
1351 $(foreach external
,$(2),$(call gb_LinkTarget_use_external
,$(1),$(external
)))
1353 # call gb_LinkTarget_set_visibility_default,linktarget
1354 define gb_LinkTarget_set_visibility_default
1355 $(call gb_LinkTarget_get_target
,$(1)) : VISIBILITY
:= default
1356 ifeq ($(gb_ENABLE_PCH
),$(true
))
1357 ifneq ($(strip $$(PCH_NAME
)),)
1358 $(call gb_PrecompiledHeader_get_target
,$$(PCH_NAME
)) : VISIBILITY
:= default
1364 # call gb_LinkTarget_set_warnings_not_errors,linktarget
1365 define gb_LinkTarget_set_warnings_not_errors
1366 $(call gb_LinkTarget_get_target
,$(1)) : WARNINGS_NOT_ERRORS
:= $(true
)
1370 # call gb_LinkTarget_set_external_code,linktarget
1371 define gb_LinkTarget_set_external_code
1372 $(call gb_LinkTarget_get_target
,$(1)) : EXTERNAL_CODE
:= $(true
)
1376 # Set suffix of C++ files, if different from 'cxx'
1378 # This is useful for external libraries.
1380 # call gb_LinkTarget_set_generated_cxx_suffix,linktarget,used-suffix
1381 define gb_LinkTarget_set_generated_cxx_suffix
1382 gb_LinkTarget_CXX_SUFFIX_
$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)) := $(2)
1386 # vim: set noet sw=4: