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