1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance 9# with the License. You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, 14# software distributed under the License is distributed on an 15# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16# KIND, either express or implied. See the License for the 17# specific language governing permissions and limitations 18# under the License. 19# 20#************************************************************** 21 22 23 24#the following user-defined variables are supported: 25# CPPFLAGS 26# CFLAGS 27# CXXFLAGS 28# OBJCFLAGS 29# OBJCXXFLAGS 30# JAVAFLAGS 31# LDFLAGS 32 33# CFLAGS from environment override debug/optimization flags 34 35ifeq ($(gb_DEBUGGING),TRUE) 36CFLAGS ?= $(gb_COMPILEROPTFLAGS) $(gb_DEBUG_CFLAGS) 37CXXFLAGS ?= $(gb_COMPILEROPTFLAGS) $(gb_DEBUG_CFLAGS) 38OBJCFLAGS ?= $(gb_COMPILEROPTFLAGS) $(gb_DEBUG_CFLAGS) 39OBJCXXFLAGS ?= $(gb_COMPILEROPTFLAGS) $(gb_DEBUG_CFLAGS) 40JAVAFLAGS ?= -g 41else 42CFLAGS ?= $(gb_COMPILEROPTFLAGS) 43CXXFLAGS ?= $(gb_COMPILEROPTFLAGS) 44OBJCFLAGS ?= $(gb_COMPILEROPTFLAGS) 45OBJCXXFLAGS ?= $(gb_COMPILEROPTFLAGS) 46endif 47 48 49# For every object there is a dep file (if gb_FULLDEPS is active). 50# The dep file depends on the object: the Object__command also updates the 51# dep file as a side effect. 52# In the dep file rule just touch it so it's newer than the object. 53 54# The gb_Object__command_dep generates an "always rebuild" dep file; 55# It is _only_ used in case the user deletes the object dep file. 56ifeq ($(gb_FULLDEPS),$(true)) 57define gb_Object__command_dep 58mkdir -p $(dir $(1)) && \ 59 echo '$(2) : $$(gb_Helper_PHONY)' > $(1) 60 61endef 62else 63gb_Object__command_dep = \ 64 $(call gb_Output_error,gb_Object__command_dep is only for gb_FULLDEPS) 65endif 66 67 68# AsmObject class 69 70gb_AsmObject_REPOS := $(gb_REPOS) 71 72gb_AsmObject_get_source = $(1)/$(2)$(gb_AsmObject_EXT) 73 74define gb_AsmObject__rules 75$$(call gb_AsmObject_get_target,%) : $$(call gb_AsmObject_get_source,$(1),%) 76 $$(call gb_AsmObject__command,$$@,$$*,$$<) 77 78endef 79 80$(foreach repo,$(gb_AsmObject_REPOS),$(eval $(call gb_AsmObject__rules,$(repo)))) 81 82gb_AsmObject_AsmObject = 83 84 85# CObject class 86 87gb_CObject_REPOS := $(gb_REPOS) 88 89gb_CObject_get_source = $(1)/$(2).c 90# defined by platform 91# gb_CObject__command 92 93define gb_CObject__rules 94$$(call gb_CObject_get_target,%) : $$(call gb_CObject_get_source,$(1),%) 95 $$(call gb_CObject__command,$$@,$$*,$$<,$$(call gb_CObject_get_dep_target,$$*)) 96 97ifeq ($(gb_FULLDEPS),$(true)) 98$$(call gb_CObject_get_dep_target,%) : $$(call gb_CObject_get_target,%) 99 $$(if $$(wildcard $$@),touch $$@,\ 100 $$(call gb_Object__command_dep,$$@,$$(call gb_CObject_get_target,$$*))) 101endif 102 103endef 104 105$(foreach repo,$(gb_CObject_REPOS),$(eval $(call gb_CObject__rules,$(repo)))) 106 107$(call gb_CObject_get_dep_target,%) : 108 $(eval $(call gb_Output_error,Unable to find plain C file $(call gb_CObject_get_source,,$*) in the repositories: $(gb_CObject_REPOS))) 109 110gb_CObject_CObject = 111 112 113# GenCObject class 114 115gb_GenCObject_get_source = $(WORKDIR)/$(1).c 116# defined by platform 117# gb_CObject__command 118 119$(call gb_GenCObject_get_target,%) : $(call gb_GenCObject_get_source,%) 120 $(call gb_CObject__command,$@,$*,$<,$(call gb_GenCObject_get_dep_target,$*)) 121 122ifeq ($(gb_FULLDEPS),$(true)) 123$(call gb_GenCObject_get_dep_target,%) : $(call gb_GenCObject_get_target,%) 124 $(if $(wildcard $@),touch $@,\ 125 $(call gb_Object__command_dep,$@,$(call gb_GenCObject_get_target,$*))) 126endif 127 128gb_GenCObject_GenCObject = 129 130 131 132 133# CxxObject class 134 135gb_CxxObject_REPOS := $(gb_REPOS) 136 137gb_CxxObject_get_source = $(1)/$(2).cxx 138# defined by platform 139# gb_CxxObject__command 140 141# Only enable PCH if the PCH_CXXFLAGS and the PCH_DEFS (from the linktarget) 142# are the same as the T_CXXFLAGS and DEFS we want to use for this object. This 143# should usually be the case. The DEFS/T_CXXFLAGS would have too be manually 144# overridden for one object file for them to differ. PCH_CXXFLAGS/PCH_DEFS 145# should never be overridden on an object -- they should be the same as for the 146# whole linktarget. In general it should be cleaner to use a static library 147# compiled with different flags and link that in rather than mixing different 148# flags in one linktarget. 149define gb_CxxObject__set_pchflags 150ifeq ($(gb_ENABLE_PCH),$(true)) 151ifneq ($(strip $$(PCH_NAME)),) 152ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)),$$(sort $$(T_CXXFLAGS) $$(CXXFLAGS) $$(DEFS))) 153$$@ : PCHFLAGS := $$(call gb_PrecompiledHeader_get_enableflags,$$(PCH_NAME)) 154else 155ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_NOEXCEPTIONFLAGS)),$$(sort $$(T_CXXFLAGS) $$(CXXFLAGS) $$(DEFS))) 156$$@ : PCHFLAGS := $$(call gb_NoexPrecompiledHeader_get_enableflags,$$(PCH_NAME)) 157else 158$$(info No precompiled header available for $$*.) 159$$(info precompiled header flags ( ex) : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS))) 160$$(info precompiled header flags (noex) : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_NOEXCEPTIONFLAGS))) 161$$(info . object flags : $$(sort $$(T_CXXFLAGS) $$(DEFS))) 162$$@ : PCHFLAGS := 163endif 164endif 165endif 166endif 167endef 168 169define gb_CxxObject__rules 170$$(call gb_CxxObject_get_target,%) : $$(call gb_CxxObject_get_source,$(1),%) 171 $$(eval $$(gb_CxxObject__set_pchflags)) 172 $$(call gb_CxxObject__command,$$@,$$*,$$<,$$(call gb_CxxObject_get_dep_target,$$*)) 173 174ifeq ($(gb_FULLDEPS),$(true)) 175$$(call gb_CxxObject_get_dep_target,%) : $$(call gb_CxxObject_get_target,%) 176 $$(if $$(wildcard $$@),touch $$@,\ 177 $$(eval $$(gb_CxxObject__set_pchflags))\ 178 $$(call gb_Object__command_dep,$$@,$$(call gb_CxxObject_get_target,$$*))) 179endif 180 181endef 182 183$(foreach repo,$(gb_CxxObject_REPOS),$(eval $(call gb_CxxObject__rules,$(repo)))) 184 185ifeq ($(gb_FULLDEPS),$(true)) 186$(call gb_CxxObject_get_dep_target,%) : 187 $(eval $(call gb_Output_error,Unable to find C++ file $(call gb_CxxObject_get_source,,$*) in repositories: $(gb_CxxObject_REPOS))) 188 189endif 190 191gb_CxxObject_CxxObject = 192 193 194# GenCxxObject class 195 196gb_GenCxxObject_get_source = $(WORKDIR)/$(1).cxx 197# defined by platform 198# gb_CxxObject__command 199 200$(call gb_GenCxxObject_get_target,%) : $(call gb_GenCxxObject_get_source,%) 201 $(call gb_CxxObject__command,$@,$*,$<,$(call gb_GenCxxObject_get_dep_target,$*)) 202 203ifeq ($(gb_FULLDEPS),$(true)) 204$(call gb_GenCxxObject_get_dep_target,%) : $(call gb_GenCxxObject_get_target,%) 205 $(if $(wildcard $@),touch $@,\ 206 $(call gb_Object__command_dep,$@,$(call gb_GenCxxObject_get_target,$*))) 207endif 208 209gb_GenCxxObject_GenCxxObject = 210 211 212 213# ObjCObject class 214# 215gb_ObjCObject_REPOS := $(gb_REPOS) 216 217gb_ObjCObject_get_source = $(1)/$(2).m 218# defined by platform 219# gb_ObjCObject__command 220 221define gb_ObjCObject__rules 222$$(call gb_ObjCObject_get_target,%) : $$(call gb_ObjCObject_get_source,$(1),%) 223 $$(call gb_ObjCObject__command,$$@,$$*,$$<,$$(call gb_ObjCObject_get_dep_target,$$*)) 224 225ifeq ($(gb_FULLDEPS),$(true)) 226$$(call gb_ObjCObject_get_dep_target,%) : $$(call gb_ObjCObject_get_target,%) 227 $$(if $$(wildcard $$@),touch $$@,\ 228 $$(call gb_Object__command_dep,$$@,$$(call gb_ObjCObject_get_target,$$*))) 229endif 230 231endef 232 233$(foreach repo,$(gb_ObjCObject_REPOS),$(eval $(call gb_ObjCObject__rules,$(repo)))) 234 235ifeq ($(gb_FULLDEPS),$(true)) 236$(call gb_ObjCObject_get_dep_target,%) : 237 $(eval $(call gb_Output_error,Unable to find Objective C file $(call gb_ObjCObject_get_source,,$*) in repositories: $(gb_ObjCObject_REPOS))) 238endif 239 240gb_ObjCObject_ObjCObject = 241 242 243 244# ObjCxxObject class 245# 246gb_ObjCxxObject_REPOS := $(gb_REPOS) 247 248gb_ObjCxxObject_get_source = $(1)/$(2).mm 249# defined by platform 250# gb_ObjCxxObject__command 251 252define gb_ObjCxxObject__rules 253$$(call gb_ObjCxxObject_get_target,%) : $$(call gb_ObjCxxObject_get_source,$(1),%) 254 $$(call gb_ObjCxxObject__command,$$@,$$*,$$<,$$(call gb_ObjCxxObject_get_dep_target,$$*)) 255 256ifeq ($(gb_FULLDEPS),$(true)) 257$$(call gb_ObjCxxObject_get_dep_target,%) : $$(call gb_ObjCxxObject_get_target,%) 258 $$(if $$(wildcard $$@),touch $$@,\ 259 $$(call gb_Object__command_dep,$$@,$$(call gb_ObjCxxObject_get_target,$$*))) 260endif 261 262endef 263 264$(foreach repo,$(gb_ObjCxxObject_REPOS),$(eval $(call gb_ObjCxxObject__rules,$(repo)))) 265 266ifeq ($(gb_FULLDEPS),$(true)) 267$(call gb_ObjCxxObject_get_dep_target,%) : 268 $(eval $(call gb_Output_error,Unable to find Objective C++ file $(call gb_ObjCxxObject_get_source,,$*) in repositories: $(gb_ObjCxxObject_REPOS))) 269endif 270 271gb_ObjCxxObject_ObjCxxObject = 272 273 274 275# LinkTarget class 276 277gb_LinkTarget_DEFAULTDEFS := $(gb_GLOBALDEFS) 278# defined by platform 279# gb_LinkTarget_CXXFLAGS 280# gb_LinkTarget_LDFLAGS 281# gb_LinkTarget_INCLUDE 282# gb_LinkTarget_INCLUDE_STL 283 284.PHONY : $(call gb_LinkTarget_get_clean_target,%) 285$(call gb_LinkTarget_get_clean_target,%) : 286 $(call gb_Output_announce,$*,$(false),LNK,4) 287 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\ 288 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \ 289 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ 290 $(foreach object,$(COBJECTS),$(call gb_CObject_get_dep_target,$(object))) \ 291 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ 292 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dep_target,$(object))) \ 293 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \ 294 $(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dep_target,$(object))) \ 295 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ 296 $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object))) \ 297 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \ 298 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_dep_target,$(object))) \ 299 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ 300 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \ 301 $(call gb_LinkTarget_get_target,$*) \ 302 $(call gb_LinkTarget_get_dep_target,$*) \ 303 $(call gb_LinkTarget_get_headers_target,$*) \ 304 $(call gb_LinkTarget_get_external_headers_target,$*) \ 305 $(DLLTARGET) \ 306 $(AUXTARGETS)) && \ 307 cat $${RESPONSEFILE} /dev/null | xargs -n 200 rm -f && \ 308 rm -f $${RESPONSEFILE} 309 310 311# cat the deps of all objects in one file, then we need only open that one file 312define gb_LinkTarget__command_dep 313$(call gb_Output_announce,LNK:$(2),$(true),DEP,1) 314$(call gb_Helper_abbreviate_dirs,\ 315 mkdir -p $(dir $(1)) && \ 316 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\ 317 $(foreach object,$(3),$(call gb_CObject_get_dep_target,$(object))) \ 318 $(foreach object,$(4),$(call gb_CxxObject_get_dep_target,$(object))) \ 319 $(foreach object,$(5),$(call gb_ObjCObject_get_dep_target,$(object)))\ 320 $(foreach object,$(6),$(call gb_ObjCxxObject_get_dep_target,$(object)))\ 321 $(foreach object,$(7),$(call gb_GenCObject_get_dep_target,$(object)))\ 322 $(foreach object,$(8),$(call gb_GenCxxObject_get_dep_target,$(object)))\ 323 ) && \ 324 cat $${RESPONSEFILE} /dev/null | xargs -n 200 cat > $(1)) && \ 325 rm -f $${RESPONSEFILE} 326 327endef 328 329$(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%) $(gb_Helper_MISCDUMMY) 330 $(call gb_LinkTarget__command,$@,$*) 331 332ifeq ($(gb_FULLDEPS),$(true)) 333$(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_dep_target,%) 334$(call gb_LinkTarget_get_dep_target,%) : | $(call gb_LinkTarget_get_headers_target,%) 335 $(call gb_LinkTarget__command_dep,$@,$*,$(COBJECTS),$(CXXOBJECTS),$(OBJCOBJECTS),$(OBJCXXOBJECTS),$(GENCOBJECTS),$(GENCXXOBJECTS)) 336endif 337 338# Ok, this is some dark voodoo: When declaring a linktarget with 339# gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the 340# target. When the rule for the headertarget is executed and SELF does not 341# match the target name, we are depending on a linktarget that was never 342# declared. In a full build exclusively in gbuild that should never happen. 343# However, partial gbuild build will not know about how to build lower level 344# linktargets, just as gbuild can not know about linktargets generated in the 345# old build.pl/dmake system. Once all is migrated, gbuild should error out 346# when is is told to depend on a linktarget it does not know about and not 347# only warn. 348define gb_LinkTarget__get_external_headers_check 349ifneq ($$(SELF),$$*) 350$$(eval $$(call gb_Output_info,LinkTarget $$* not defined: Assuming headers to be there!,ALL)) 351endif 352$$(if $$(findstring /,$$*), , $$(error gb_LinkTarget__get_external_headers_check trying to create $$@ as a plain file)) 353$$@ : COMMAND := $$(call gb_Helper_abbreviate_dirs, mkdir -p $$(dir $$@) && touch $$@ && mkdir -p $(call gb_LinkTarget_get_target,)pdb/$$(dir $$*)) 354 355endef 356 357$(call gb_LinkTarget_get_external_headers_target,%) : 358 $(eval $(gb_LinkTarget__get_external_headers_check)) 359 $(COMMAND) 360 361$(call gb_LinkTarget_get_headers_target,%) : $(call gb_LinkTarget_get_external_headers_target,%) 362 $(call gb_Helper_abbreviate_dirs,\ 363 mkdir -p $(dir $@) && touch $@) 364 365# Explanation of some of the targets: 366# - gb_LinkTarget_get_external_headers_target is the targets that guarantees all 367# headers from linked against libraries are in OUTDIR. 368# - gb_LinkTarget_get_headers_target is the target that guarantees all headers 369# from the linked against the libraries and the linktargets own headers 370# (including generated headers) are in the OUTDIR. 371# - gb_LinkTarget_get_target links the objects into a file in WORKDIR. 372# gb_LinkTarget_get_target depends on gb_LinkTarget_get_headers_target which in 373# turn depends gb_LinkTarget_get_external_headers_target. 374# gb_LinkTarget_get_target depends additionally on the objects, which in turn 375# depend build-order only on the gb_LinkTarget_get_headers_target. The build 376# order-only dependency ensures all headers to be there for compiling and 377# dependency generation without causing all objects to be rebuild when one 378# header changes. Only the ones with an explicit dependency in their generated 379# dependency file will be rebuild. 380# 381# gb_LinkTarget_get_target is the target that links the objects into a file in 382# WORKDIR 383# Explanation of some of the variables: 384# - AUXTARGETS are the additionally generated files that need to be cleaned out 385# on clean. 386# - PCH_CXXFLAGS and PCH_DEFS are the flags that the precompiled headers will 387# be compiled with. They should never be overridden in a single object 388# files. 389# - TARGETTYPE is the type of linktarget as some platforms need very different 390# command to link different targettypes. 391# - VERSIONMAP is the linker script, usually used to version a dynamic 392# library's symbols (on *nix/Mac). 393# 394# Since most variables are set on the linktarget and not on the object, the 395# object learns about these setting via GNU makes scoping of target variables. 396# Therefore it is important that objects are only directly depended on by the 397# linktarget. This for example means that you cannot build a single object 398# alone, because then you would directly depend on the object. 399# 400# A note about flags: because the overriding the global variables with a target 401# local variable of the same name is considered obscure, the target local 402# variables have a T_ prefix. 403define gb_LinkTarget_LinkTarget 404$(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS := 405$(call gb_LinkTarget_get_external_headers_target,$(1)) : SELF := $(1) 406$(call gb_LinkTarget_get_target,$(1)) : DLLTARGET := 407$(call gb_LinkTarget_get_clean_target,$(1)) \ 408$(call gb_LinkTarget_get_target,$(1)) : ASMOBJECTS := 409$(call gb_LinkTarget_get_clean_target,$(1)) \ 410$(call gb_LinkTarget_get_target,$(1)) : COBJECTS := 411$(call gb_LinkTarget_get_clean_target,$(1)) \ 412$(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS := 413$(call gb_LinkTarget_get_clean_target,$(1)) \ 414$(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS := 415$(call gb_LinkTarget_get_clean_target,$(1)) \ 416$(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS := 417$(call gb_LinkTarget_get_clean_target,$(1)) \ 418$(call gb_LinkTarget_get_target,$(1)) : GENCOBJECTS := 419$(call gb_LinkTarget_get_clean_target,$(1)) \ 420$(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS := 421$(call gb_LinkTarget_get_headers_target,$(1)) \ 422$(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS) 423$(call gb_LinkTarget_get_headers_target,$(1)) \ 424$(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) 425$(call gb_LinkTarget_get_headers_target,$(1)) \ 426$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $$(CXXFLAGS) 427$(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS := $$(gb_LinkTarget_OBJCFLAGS) 428$(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS) 429$(call gb_LinkTarget_get_headers_target,$(1)) \ 430$(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS) 431$(call gb_LinkTarget_get_headers_target,$(1)) \ 432$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS) 433$(call gb_LinkTarget_get_headers_target,$(1)) \ 434$(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE) 435$(call gb_LinkTarget_get_headers_target,$(1)) \ 436$(call gb_LinkTarget_get_target,$(1)) : INCLUDE_STL := $$(gb_LinkTarget_INCLUDE_STL) 437$(call gb_LinkTarget_get_target,$(1)) : T_LDFLAGS := $$(gb_LinkTarget_LDFLAGS) $(LDFLAGS) 438$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS := 439$(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS := 440$(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_LIBS := 441$(call gb_LinkTarget_get_target,$(1)) : LIBS := 442$(call gb_LinkTarget_get_target,$(1)) : TARGETTYPE := 443$(call gb_LinkTarget_get_target,$(1)) : VERSIONMAP := 444$(call gb_LinkTarget_get_headers_target,$(1)) \ 445$(call gb_LinkTarget_get_target,$(1)) : PCH_NAME := 446$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS := 447#$(call gb_LinkTarget_get_headers_target,$(1)) \ 448#$(call gb_LinkTarget_get_target,$(1)) : PDBFILE := 449$(call gb_LinkTarget_get_target,$(1)) : NATIVERES := 450 451ifeq ($(gb_FULLDEPS),$(true)) 452-include $(call gb_LinkTarget_get_dep_target,$(1)) 453$(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS := 454$(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS := 455$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS := 456$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS := 457$(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS := 458$(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS := 459$(call gb_LinkTarget_get_dep_target,$(1)) : T_CFLAGS := $$(gb_LinkTarget_CFLAGS) 460$(call gb_LinkTarget_get_dep_target,$(1)) : T_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) 461$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $$(CXXFLAGS) 462$(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCFLAGS := $$(gb_LinkTarget_OBJCFLAGS) 463$(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS) 464$(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS) 465$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS) $(CPPFLAGS) 466$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE) 467$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE_STL := $$(gb_LinkTarget_INCLUDE_STL) 468$(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE := 469$(call gb_LinkTarget_get_dep_target,$(1)) : VERSIONMAP := 470$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_NAME := 471endif 472 473endef 474 475define gb_LinkTarget_add_defs 476$(call gb_LinkTarget_get_headers_target,$(1)) \ 477$(call gb_LinkTarget_get_target,$(1)) : DEFS += $(2) 478$(call gb_LinkTarget_get_headers_target,$(1)) \ 479$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS += $(2) 480ifeq ($(gb_FULLDEPS),$(true)) 481$(call gb_LinkTarget_get_dep_target,$(1)) : DEFS += $(2) 482$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS += $(2) 483endif 484endef 485 486define gb_LinkTarget_set_defs 487ifeq (,) 488$$(call gb_Output_error,\ 489 gb_LinkTarget_set_defs: use gb_LinkTarget_add_defs instead.) 490else 491$(call gb_LinkTarget_get_headers_target,$(1)) \ 492$(call gb_LinkTarget_get_target,$(1)) : DEFS := $(2) 493$(call gb_LinkTarget_get_headers_target,$(1)) \ 494$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $(2) 495 496ifeq ($(gb_FULLDEPS),$(true)) 497$(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $(2) 498$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS := $(2) 499endif 500endif 501 502endef 503 504define gb_LinkTarget_add_cflags 505$(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS += $(2) 506ifeq ($(gb_FULLDEPS),$(true)) 507$(call gb_LinkTarget_get_dep_target,$(1)) : T_CFLAGS += $(2) 508endif 509 510endef 511 512define gb_LinkTarget_set_cflags 513ifeq (,) 514$$(call gb_Output_error,\ 515 gb_LinkTarget_set_cflags: use gb_LinkTarget_add_cflags instead.) 516else 517$(call gb_LinkTarget_get_target,$(1)) : T_CFLAGS := $(2) 518ifeq ($(gb_FULLDEPS),$(true)) 519$(call gb_LinkTarget_get_dep_target,$(1)) : T_CFLAGS := $(2) 520endif 521endif 522 523endef 524 525define gb_LinkTarget_add_cxxflags 526$(call gb_LinkTarget_get_headers_target,$(1)) \ 527$(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS += $(2) 528$(call gb_LinkTarget_get_headers_target,$(1)) \ 529$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS += $(2) 530ifeq ($(gb_FULLDEPS),$(true)) 531$(call gb_LinkTarget_get_dep_target,$(1)) : T_CXXFLAGS += $(2) 532$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS += $(2) 533endif 534endef 535 536define gb_LinkTarget_set_cxxflags 537ifeq (,) 538$$(call gb_Output_error,\ 539 gb_LinkTarget_set_cxxflags: use gb_LinkTarget_add_cxxflags instead.) 540else 541$(call gb_LinkTarget_get_headers_target,$(1)) \ 542$(call gb_LinkTarget_get_target,$(1)) : T_CXXFLAGS := $(2) 543$(call gb_LinkTarget_get_headers_target,$(1)) \ 544$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $(2) 545ifeq ($(gb_FULLDEPS),$(true)) 546$(call gb_LinkTarget_get_dep_target,$(1)) : T_CXXFLAGS := $(2) 547$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := $(2) 548endif 549endif 550 551endef 552 553define gb_LinkTarget_add_objcflags 554$(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS += $(2) 555ifeq ($(gb_FULLDEPS),$(true)) 556$(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCFLAGS += $(2) 557endif 558endef 559 560define gb_LinkTarget_set_objcflags 561ifeq (,) 562$$(call gb_Output_error,\ 563 gb_LinkTarget_set_objcflags: use gb_LinkTarget_add_objcflags instead.) 564else 565$(call gb_LinkTarget_get_target,$(1)) : T_OBJCFLAGS := $(2) 566ifeq ($(gb_FULLDEPS),$(true)) 567$(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCFLAGS := $(2) 568endif 569endif 570endef 571 572define gb_LinkTarget_add_objcxxflags 573$(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS += $(2) 574ifeq ($(gb_FULLDEPS),$(true)) 575$(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCXXFLAGS += $(2) 576endif 577endef 578 579define gb_LinkTarget_set_objcxxflags 580ifeq (,) 581$$(call gb_Output_error,\ 582 gb_LinkTarget_set_objcxxflags: use gb_LinkTarget_add_objcxxflags instead.) 583else 584$(call gb_LinkTarget_get_target,$(1)) : T_OBJCXXFLAGS := $(2) 585ifeq ($(gb_FULLDEPS),$(true)) 586$(call gb_LinkTarget_get_dep_target,$(1)) : T_OBJCXXFLAGS := $(2) 587endif 588endif 589endef 590 591define gb_LinkTarget_set_c_optimization 592$(foreach object,$(1),$(eval $(call gb_CObject_get_target,$(object)) : CFLAGS := $(filter-out $(gb_COMPILEROPTFLAGS),$(CFLAGS)) $(2))) 593endef 594 595define gb_LinkTarget_set_cxx_optimization 596$(foreach object,$(1),$(eval $(call gb_CxxObject_get_target,$(object)) : CXXFLAGS := $(filter-out $(gb_COMPILEROPTFLAGS),$(CXXFLAGS)) $(2))) 597endef 598 599define gb_LinkTarget_set_genc_optimization 600$(foreach object,$(1),$(eval $(call gb_GenCObject_get_target,$(object)) : CFLAGS := $(filter-out $(gb_COMPILEROPTFLAGS),$(CFLAGS)) $(2))) 601endef 602 603define gb_LinkTarget_set_gencxx_optimization 604$(foreach object,$(1),$(eval $(call gb_GenCxxObject_get_target,$(object)) : CXXFLAGS := $(filter-out $(gb_COMPILEROPTFLAGS),$(CXXFLAGS)) $(2))) 605endef 606 607define gb_LinkTarget_set_objc_optimization 608$(foreach object,$(1),$(eval $(call gb_ObjCObject_get_target,$(object)) : OBJCFLAGS := $(filter-out $(gb_COMPILEROPTFLAGS),$(OBJCFLAGS)) $(2))) 609endef 610 611define gb_LinkTarget_set_objcxx_optimization 612$(foreach object,$(1),$(eval $(call gb_ObjCxxObject_get_target,$(object)) : OBJCXXFLAGS := $(filter-out $(gb_COMPILEROPTFLAGS),$(OBJCXXFLAGS)) $(2))) 613endef 614 615define gb_LinkTarget_set_include 616$(call gb_LinkTarget_get_headers_target,$(1)) \ 617$(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $(2) 618ifeq ($(gb_FULLDEPS),$(true)) 619$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $(2) 620endif 621 622endef 623 624define gb_LinkTarget_set_include_stl 625$(call gb_LinkTarget_get_headers_target,$(1)) \ 626$(call gb_LinkTarget_get_target,$(1)) : INCLUDE_STL := $(2) 627ifeq ($(gb_FULLDEPS),$(true)) 628$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE_STL := $(2) 629endif 630 631endef 632 633define gb_LinkTarget_add_ldflags 634$(call gb_LinkTarget_get_target,$(1)) : T_LDFLAGS += $(2) 635endef 636 637# real use in RepositoryExternal.mk 638define gb_LinkTarget_set_ldflags 639$(call gb_LinkTarget_get_target,$(1)) : T_LDFLAGS := $(2) 640endef 641 642define gb_LinkTarget_add_api 643$(call gb_LinkTarget_get_external_headers_target,$(1)) :| \ 644 $$(foreach api,$(2),$$(call gb_Package_get_target,$$(api)_inc)) 645$(call gb_LinkTarget_get_headers_target,$(1)) \ 646$(call gb_LinkTarget_get_target,$(1)) : INCLUDE += $$(foreach api,$(2),-I$(OUTDIR)/inc/$$(api)) 647ifeq ($(gb_FULLDEPS),$(true)) 648$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE += $$(foreach api,$(2),-I$(OUTDIR)/inc/$$(api)) 649endif 650 651endef 652 653define gb_LinkTarget_add_private_api 654$(call gb_LinkTarget_get_external_headers_target,$(1)) :| \ 655 $(call gb_UnoPrivateApiTarget_get_target,$(1)/idl.cppumaker.flag) 656$(call gb_LinkTarget_get_headers_target,$(1)) \ 657$(call gb_LinkTarget_get_target,$(1)) : INCLUDE += -I$(call gb_UnoPrivateApiTarget_get_target,$(1)/inc) 658ifeq ($(gb_FULLDEPS),$(true)) 659$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE += -I$(call gb_UnoPrivateApiTarget_get_target,$(1)/inc) 660endif 661 662$(call gb_UnoPrivateApiTarget_get_target,$(1)/idl.cppumaker.flag): $(2) $(3) 663 $(call gb_Output_announce,$@,$(true),PVTIDL,2) 664 -$$(call gb_Helper_abbreviate_dirs_native,\ 665 mkdir -p $$(call gb_UnoPrivateApiTarget_get_target,$(1)/urd) && \ 666 mkdir -p $$(call gb_UnoPrivateApiTarget_get_target,$(1)/rdb) && \ 667 mkdir -p $$(call gb_UnoPrivateApiTarget_get_target,$(1)/inc) && \ 668 $$(gb_UnoApiTarget_IDLCCOMMAND) -I$$(OUTDIR)/idl -O $$(call gb_UnoPrivateApiTarget_get_target,$(1)/urd) \ 669 -verbose -cid -we $(3) && \ 670 $$(gb_UnoApiTarget_REGMERGECOMMAND) $$(call gb_UnoPrivateApiTarget_get_target,$(1)/rdb/registry.rdb) /UCR \ 671 $(patsubst %.idl,%.urd,$$(call gb_UnoPrivateApiTarget_get_target,$(1)/urd)/$(notdir $(3))) && \ 672 $(gb_UnoApiTarget_CPPUMAKERCOMMAND) \ 673 -O $$(call gb_UnoPrivateApiTarget_get_target,$(1)/inc) \ 674 $(foreach unotype,$(4),-T$(unotype)) \ 675 -BUCR \ 676 -C \ 677 $$(call gb_UnoPrivateApiTarget_get_target,$(1)/rdb/registry.rdb) \ 678 $(2) && \ 679 touch $(call gb_UnoPrivateApiTarget_get_target,$(1)/idl.cppumaker.flag)) 680 681$(call gb_LinkTarget_get_clean_target,$(1)) : 682 rm -rf $(call gb_UnoPrivateApiTarget_get_target,$(1)) 683 684endef 685 686# FIXME: multiple?? 687define gb_LinkTarget_set_private_api 688$(foreach api,$(3),$(call gb_LinkTarget_add_private_api,$(1),$(2),$(api),$(4))) 689 690endef 691 692define gb_LinkTarget_set_private_extract_of_public_api 693$(call gb_LinkTarget_get_external_headers_target,$(1)) :| \ 694 $(call gb_UnoPrivateApiExtractTarget_get_target,$(1)/idl.cppumaker.flag) 695$(call gb_LinkTarget_get_headers_target,$(1)) \ 696$(call gb_LinkTarget_get_target,$(1)) : INCLUDE += -I$(call gb_UnoPrivateApiExtractTarget_get_target,$(1)/inc) 697ifeq ($(gb_FULLDEPS),$(true)) 698$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE += -I$(call gb_UnoPrivateApiExtractTarget_get_target,$(1)/inc) 699endif 700 701$(call gb_UnoPrivateApiExtractTarget_get_target,$(1)/idl.cppumaker.flag): $(2) 702 $(call gb_Output_announce,$@,$(true),PVTUNOTYPES,2) 703 -$$(call gb_Helper_abbreviate_dirs_native,\ 704 mkdir -p $$(call gb_UnoPrivateApiExtractTarget_get_target,$(1)/inc) && \ 705 $(gb_UnoApiTarget_CPPUMAKERCOMMAND) \ 706 -O $$(call gb_UnoPrivateApiExtractTarget_get_target,$(1)/inc) \ 707 $(foreach unotype,$(3),-T$(unotype)) \ 708 -BUCR \ 709 -C \ 710 $(2) && \ 711 touch $(call gb_UnoPrivateApiExtractTarget_get_target,$(1)/idl.cppumaker.flag)) 712 713$(call gb_LinkTarget_get_clean_target,$(1)) : 714 rm -rf $(call gb_UnoPrivateApiExtractTarget_get_target,$(1)) 715 716 717endef 718 719gb_BisonTarget_get_source = $(SRCDIR)/$(1).y 720 721# Bison-generated .cxx files are always #include'd into in-module files, 722# and aren't compiled, so they effectively act as generated headers, not generated .cxx. 723 724define gb_LinkTarget_add_bison_file 725 726$(call gb_LinkTarget_get_external_headers_target,$(1)) :| \ 727 $(call gb_BisonTarget_get_target,$(1),$(2)) 728 729$(call gb_LinkTarget_get_headers_target,$(1)) \ 730$(call gb_LinkTarget_get_target,$(1)) : INCLUDE += -I$(dir $(call gb_BisonTarget_get_target,$(1),$(2))) 731ifeq ($(gb_FULLDEPS),$(true)) 732$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE += -I$(dir $(call gb_BisonTarget_get_target,$(1),$(2))) 733endif 734 735$(call gb_BisonTarget_get_target,$(1),$(2)) : $(call gb_BisonTarget_get_source,$(2)) 736 mkdir -p $(dir $(call gb_BisonTarget_get_target,$(1),$(2))) && \ 737 tr -d "\015" < $(call gb_BisonTarget_get_source,$(2)) > $(dir $(call gb_BisonTarget_get_target,$(1),$(2)))/stripped_$(notdir $(call gb_BisonTarget_get_source,$(2))) && \ 738 bison -d -o $(call gb_BisonTarget_get_target,$(1),$(2)) $(dir $(call gb_BisonTarget_get_target,$(1),$(2)))/stripped_$(notdir $(call gb_BisonTarget_get_source,$(2))) 739 740endef 741 742define gb_LinkTarget_add_bison_files 743$(foreach bisonfile,$(2),$(call gb_LinkTarget_add_bison_file,$(1),$(bisonfile))) 744 745endef 746 747 748 749gb_FlexTarget_get_source = $(SRCDIR)/$(1).ll 750 751# Flex-generated .cxx files are always #include'd into in-module files, 752# and aren't compiled, so they effectively act as generated headers, not generated .cxx. 753 754define gb_LinkTarget_add_flex_file 755 756$(call gb_LinkTarget_get_external_headers_target,$(1)) :| \ 757 $(call gb_FlexTarget_get_target,$(1),$(2)) 758 759$(call gb_LinkTarget_get_headers_target,$(1)) \ 760$(call gb_LinkTarget_get_target,$(1)) : INCLUDE += -I$(dir $(call gb_FlexTarget_get_target,$(1),$(2))) 761ifeq ($(gb_FULLDEPS),$(true)) 762$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE += -I$(dir $(call gb_FlexTarget_get_target,$(1),$(2))) 763endif 764 765$(call gb_FlexTarget_get_target,$(1),$(2)) : $(call gb_FlexTarget_get_source,$(2)) 766 mkdir -p $(dir $(call gb_FlexTarget_get_target,$(1),$(2))) && \ 767 tr -d "\015" < $(call gb_FlexTarget_get_source,$(2)) > $(dir $(call gb_FlexTarget_get_target,$(1),$(2)))/stripped_$(notdir $(call gb_FlexTarget_get_source,$(2))) && \ 768 flex -o$(call gb_FlexTarget_get_target,$(1),$(2)) $(dir $(call gb_FlexTarget_get_target,$(1),$(2)))/stripped_$(notdir $(call gb_FlexTarget_get_source,$(2))) 769 770endef 771 772define gb_LinkTarget_add_flex_files 773$(foreach flexfile,$(2),$(call gb_LinkTarget_add_flex_file,$(1),$(flexfile))) 774 775endef 776 777 778 779 780define gb_LinkTarget_add_libs 781$(call gb_LinkTarget_get_target,$(1)) : LIBS += $(2) 782endef 783 784define gb_LinkTarget_add_linked_libs 785ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2))) 786$$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL)) 787$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk)) 788endif 789 790$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(2) 791 792$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$(2),$$(call gb_Library_get_target,$$(lib))) 793$(call gb_LinkTarget_get_external_headers_target,$(1)) : \ 794$$(foreach lib,$(2),$$(call gb_Library_get_headers_target,$$(lib))) 795 796endef 797 798define gb_LinkTarget_add_linked_static_libs 799ifneq (,$$(filter-out $(gb_StaticLibrary_KNOWNLIBS),$(2))) 800$$(eval $$(call gb_Output_info, currently known static libraries are: $(sort $(gb_StaticLibrary_KNOWNLIBS)),ALL)) 801$$(eval $$(call gb_Output_error,Cannot link against static library/libraries $$(filter-out $(gb_StaticLibrary_KNOWNLIBS),$(2)). Static libraries must be registered in Repository.mk)) 802endif 803 804$(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS += $(2) 805 806$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$(2),$$(call gb_StaticLibrary_get_target,$$(lib))) 807$(call gb_LinkTarget_get_external_headers_target,$(1)) : \ 808$$(foreach lib,$(2),$$(call gb_StaticLibrary_get_headers_target,$$(lib))) 809 810endef 811 812# 813# Add external libs for linking. External libaries are not built by any module. 814# 815# The list of libraries is used as is, ie it is not filtered with gb_Library_KNOWNLIBS. 816# 817# An error is signaled, when any of the library names does not look like 818# a base name, ie is prefixed by -l or is folled by .lib or .so. 819# 820# @param target 821# @param libraries 822# A list of (base names of) libraries that will be added to the target 823# local EXTERNAL_LIBS variable and eventually linked in when the 824# target is made. 825# 826define gb_LinkTarget_add_external_libs 827 828# Make sure that all libraries are given as base names. 829ifneq (,$$(filter -l% %.so %.lib, $(2))) 830$$(eval $$(call gb_Output_announce,ERROR: Please give only library basenames to gb_LinkTarget_add_external_libs)) 831$$(eval $$(call gb_Output_announce,ERROR: (no prefixes -l% or lib%, no suffixes %.so or %.lib))) 832$$(eval $$(call gb_Output_announce,ERROR: libraries given: $(2))) 833$$(eval $$(call gb_Output_announce,ERROR: offending: $$(filter -l% lib% %.so %.lib, $(2)))) 834$$(eval $$(call gb_Output_error, )) 835endif 836 837$(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_LIBS += $(2) 838 839$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$(2),$$(call gb_Library_get_target,$$(lib))) 840$(call gb_LinkTarget_get_external_headers_target,$(1)) : \ 841$$(foreach lib,$(2),$$(call gb_Library_get_headers_target,$$(lib))) 842 843endef 844 845 846define gb_LinkTarget_add_asmobject 847$(call gb_LinkTarget_get_target,$(1)) : ASMOBJECTS += $(2) 848$(call gb_LinkTarget_get_clean_target,$(1)) : ASMOBJECTS += $(2) 849 850$(call gb_LinkTarget_get_target,$(1)) : $(call gb_AsmObject_get_target,$(2)) 851 852endef 853 854define gb_LinkTarget_add_cobject 855$(call gb_LinkTarget_get_target,$(1)) : COBJECTS += $(2) 856$(call gb_LinkTarget_get_clean_target,$(1)) : COBJECTS += $(2) 857 858$(call gb_LinkTarget_get_target,$(1)) : $(call gb_CObject_get_target,$(2)) 859$(call gb_CObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1)) 860$(call gb_CObject_get_target,$(2)) : T_CFLAGS += $(3) 861 862ifeq ($(gb_FULLDEPS),$(true)) 863$(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS += $(2) 864$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CObject_get_dep_target,$(2)) 865endif 866 867endef 868 869define gb_LinkTarget_add_cxxobject 870$(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2) 871$(call gb_LinkTarget_get_clean_target,$(1)) : CXXOBJECTS += $(2) 872 873$(call gb_LinkTarget_get_target,$(1)) : $(call gb_CxxObject_get_target,$(2)) 874$(call gb_CxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1)) 875$(call gb_CxxObject_get_target,$(2)) : T_CXXFLAGS += $(3) 876 877ifeq ($(gb_FULLDEPS),$(true)) 878$(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS += $(2) 879$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CxxObject_get_dep_target,$(2)) 880endif 881 882endef 883 884define gb_LinkTarget_add_objcobject 885$(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS += $(2) 886$(call gb_LinkTarget_get_clean_target,$(1)) : OBJCOBJECTS += $(2) 887 888$(call gb_LinkTarget_get_target,$(1)) : $(call gb_ObjCObject_get_target,$(2)) 889$(call gb_ObjCObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1)) 890$(call gb_ObjCObject_get_target,$(2)) : T_OBJCFLAGS += $(3) 891 892ifeq ($(gb_FULLDEPS),$(true)) 893$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS += $(2) 894$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_ObjCObject_get_dep_target,$(2)) 895endif 896 897endef 898 899define gb_LinkTarget_add_objcxxobject 900$(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS += $(2) 901$(call gb_LinkTarget_get_clean_target,$(1)) : OBJCXXOBJECTS += $(2) 902 903$(call gb_LinkTarget_get_target,$(1)) : $(call gb_ObjCxxObject_get_target,$(2)) 904$(call gb_ObjCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1)) 905$(call gb_ObjCxxObject_get_target,$(2)) : T_OBJCXXFLAGS += $(3) 906 907ifeq ($(gb_FULLDEPS),$(true)) 908$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS += $(2) 909$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_ObjCxxObject_get_dep_target,$(2)) 910endif 911 912endef 913 914define gb_LinkTarget_add_generated_cobject 915$(call gb_LinkTarget_get_target,$(1)) : GENCOBJECTS += $(2) 916$(call gb_LinkTarget_get_clean_target,$(1)) : GENCOBJECTS += $(2) 917 918$(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCObject_get_target,$(2)) 919$(call gb_GenCObject_get_source,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1)) 920$(call gb_GenCObject_get_target,$(2)) : T_CFLAGS += $(3) 921 922ifeq ($(gb_FULLDEPS),$(true)) 923$(call gb_LinkTarget_get_dep_target,$(1)) : GENCOBJECTS += $(2) 924$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenCObject_get_dep_target,$(2)) 925endif 926 927endef 928 929define gb_LinkTarget_add_generated_cxx_object 930$(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS += $(2) 931$(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXOBJECTS += $(2) 932 933$(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCxxObject_get_target,$(2)) 934$(call gb_GenCxxObject_get_source,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1)) 935$(call gb_GenCxxObject_get_target,$(2)) : T_CXXFLAGS += $(3) 936 937ifeq ($(gb_FULLDEPS),$(true)) 938$(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS += $(2) 939$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenCxxObject_get_dep_target,$(2)) 940endif 941 942endef 943 944define gb_LinkTarget_add_noexception_object 945$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_NOEXCEPTIONFLAGS)) 946endef 947 948define gb_LinkTarget_add_exception_object 949$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS)) 950endef 951 952define gb_LinkTarget_add_asmobjects 953$(foreach obj,$(2),$(call gb_LinkTarget_add_asmobject,$(1),$(obj),$(3))) 954endef 955 956define gb_LinkTarget_add_cobjects 957$(foreach obj,$(2),$(call gb_LinkTarget_add_cobject,$(1),$(obj),$(3))) 958endef 959 960define gb_LinkTarget_add_cxxobjects 961$(foreach obj,$(2),$(call gb_LinkTarget_add_cxxobject,$(1),$(obj),$(3))) 962endef 963 964define gb_LinkTarget_add_objcobjects 965$(foreach obj,$(2),$(call gb_LinkTarget_add_objcobject,$(1),$(obj),$(3))) 966endef 967 968define gb_LinkTarget_add_objcxxobjects 969$(foreach obj,$(2),$(call gb_LinkTarget_add_objcxxobject,$(1),$(obj),$(3))) 970endef 971 972define gb_LinkTarget_add_noexception_objects 973$(foreach obj,$(2),$(call gb_LinkTarget_add_noexception_object,$(1),$(obj))) 974endef 975 976define gb_LinkTarget_add_exception_objects 977$(foreach obj,$(2),$(call gb_LinkTarget_add_exception_object,$(1),$(obj))) 978endef 979 980define gb_LinkTarget_add_generated_cobjects 981$(foreach obj,$(2),$(call gb_Linktarget_add_generated_cobject,$(1),$(obj),$(3))) 982endef 983 984define gb_LinkTarget_add_generated_exception_object 985$(call gb_LinkTarget_add_generated_cxx_object,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS)) 986endef 987 988define gb_LinkTarget_add_generated_exception_objects 989$(foreach obj,$(2),$(call gb_LinkTarget_add_generated_exception_object,$(1),$(obj))) 990endef 991 992define gb_LinkTarget_set_targettype 993$(call gb_LinkTarget_get_target,$(1)) \ 994$(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE := $(2) 995endef 996 997define gb_LinkTarget_set_versionmap 998$(call gb_LinkTarget_get_target,$(1)) \ 999$(call gb_LinkTarget_get_dep_target,$(1)) : VERSIONMAP := $(2) 1000endef 1001 1002define gb_LinkTarget_set_dlltarget 1003$(call gb_LinkTarget_get_clean_target,$(1)) \ 1004$(call gb_LinkTarget_get_target,$(1)) : DLLTARGET := $(2) 1005endef 1006 1007define gb_LinkTarget_set_auxtargets 1008$(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS := $(2) 1009endef 1010 1011define gb_LinkTarget__add_internal_headers 1012$(call gb_LinkTarget_get_headers_target,$(1)) : $(2) 1013$(if $(word 2, $(strip $(subst /, $() $(),$(1)))), , $(error gb_LinkTarget__add_internal_headers passing top level directory $(1) to gb_LinkTarget_get_external_headers_target )) 1014$(2) :| $(call gb_LinkTarget_get_external_headers_target,$(1)) 1015 1016endef 1017 1018define gb_LinkTarget_add_package_headers 1019$(foreach package,$(2),$(call gb_LinkTarget__add_internal_headers,$(1),$(call gb_Package_get_target,$(package)))) 1020$(call gb_LinkTarget_get_clean_target,$(1)) : $(foreach package,$(2),$(call gb_Package_get_clean_target,$(package))) 1021 1022endef 1023 1024define gb_LinkTarget_add_sdi_headers 1025$(call gb_LinkTarget__add_internal_headers,$(1),$(foreach sdi,$(2),$(call gb_SdiTarget_get_target,$(sdi)))) 1026$(call gb_LinkTarget_get_clean_target,$(1)) : $(foreach sdi,$(2),$(call gb_SdiTarget_get_clean_target,$(sdi))) 1027endef 1028 1029define gb_LinkTarget__add_precompiled_header_impl 1030$(call gb_LinkTarget__add_internal_headers,$(1),$(call gb_PrecompiledHeader_get_target,$(3))) 1031$(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_PrecompiledHeader_get_clean_target,$(3)) 1032$(call gb_PrecompiledHeader_get_target,$(3)) : $(2).cxx 1033 1034$(call gb_LinkTarget__add_internal_headers,$(1),$(call gb_NoexPrecompiledHeader_get_target,$(3))) 1035$(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_NoexPrecompiledHeader_get_clean_target,$(3)) 1036$(call gb_NoexPrecompiledHeader_get_target,$(3)) : $(2).cxx 1037 1038$(call gb_LinkTarget_get_target,$(1)) : PCH_NAME := $(3) 1039$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $(call gb_PrecompiledHeader_get_target,$(3)).obj $(call gb_NoexPrecompiledHeader_get_target,$(3)).obj 1040 1041$(call gb_LinkTarget_get_headers_target,$(1)) \ 1042$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS = $$(DEFS) 1043ifeq ($(gb_FULLDEPS),$(true)) 1044-include \ 1045 $(call gb_PrecompiledHeader_get_dep_target,$(3)) \ 1046 $(call gb_NoexPrecompiledHeader_get_dep_target,$(3)) 1047$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_NAME := $(3) 1048$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS = $$(DEFS) 1049endif 1050 1051endef 1052 1053define gb_LinkTarget_add_precompiled_header 1054ifeq ($(gb_ENABLE_PCH),$(true)) 1055$(call gb_LinkTarget__add_precompiled_header_impl,$(1),$(2),$(notdir $(2))) 1056endif 1057 1058endef 1059 1060# this forwards to functions that must be defined in RepositoryExternal.mk. 1061# $(call gb_LinkTarget_use_external,library,external) 1062define gb_LinkTarget_use_external 1063$(eval $(if $(value gb_LinkTarget__use_$(2)),\ 1064 $(call gb_LinkTarget__use_$(2),$(1)),\ 1065 $(error gb_LinkTarget_use_external: unknown external: $(2)))) 1066endef 1067 1068# $(call gb_LinkTarget_use_externals,library,externals) 1069gb_LinkTarget_use_externals = \ 1070 $(foreach external,$(2),$(call gb_LinkTarget_use_external,$(1),$(external))) 1071 1072 1073# vim: set noet sw=4 ts=4: 1074