2010-04-27 04:39:42 -05:00
|
|
|
#*************************************************************************
|
|
|
|
#
|
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
#
|
2011-01-25 11:19:55 -06:00
|
|
|
# Copyright 2000, 2011 Oracle and/or its affiliates.
|
2010-04-27 04:39:42 -05:00
|
|
|
#
|
|
|
|
# OpenOffice.org - a multi-platform office productivity suite
|
|
|
|
#
|
|
|
|
# This file is part of OpenOffice.org.
|
|
|
|
#
|
|
|
|
# OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
# only, as published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-01-25 11:19:55 -06:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-04-27 04:39:42 -05:00
|
|
|
# GNU Lesser General Public License version 3 for more details
|
|
|
|
# (a copy is included in the LICENSE file that accompanied this code).
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public License
|
2011-01-25 11:19:55 -06:00
|
|
|
# version 3 along with OpenOffice.org. If not, see
|
2010-04-27 04:39:42 -05:00
|
|
|
# <http://www.openoffice.org/license.html>
|
|
|
|
# for a copy of the LGPLv3 License.
|
|
|
|
#
|
|
|
|
#*************************************************************************
|
|
|
|
|
|
|
|
|
2011-03-27 05:09:59 -05:00
|
|
|
# Overview of dependencies and tasks of LinkTarget
|
|
|
|
#
|
|
|
|
# target task depends on
|
2011-04-23 10:35:37 -05:00
|
|
|
# LinkTarget linking CObject CxxObject GenCxxObject ObjCObject ObjCxxObject
|
2011-03-27 05:09:59 -05:00
|
|
|
# LinkTarget/headers
|
2011-04-23 10:35:37 -05:00
|
|
|
# LinkTarget/dep joined dep file CObject/dep CxxObject/dep GenCxxObject/dep ObjCObject/dep ObjCxxObject/dep
|
2011-03-27 05:09:59 -05:00
|
|
|
# | LinkTarget/headers
|
|
|
|
# LinkTarget/headers all headers available LinkTarget/external_headers PCH
|
|
|
|
# including own generated own generated headers
|
|
|
|
# PCH precompiled headers (win) LinkTarget/external_headers
|
|
|
|
# LinkTarget/external_headers all external headers avail. header files of linked libs
|
|
|
|
#
|
|
|
|
# CObject plain c compile | LinkTarget/headers
|
|
|
|
# CxxObject c++ compile | LinkTarget/headers
|
|
|
|
# GenCxxObject C++ compile from | LinkTarget/headers
|
|
|
|
# generated source
|
2011-04-23 10:35:37 -05:00
|
|
|
# ObjCObject objective c compile | LinkTarget/headers
|
2011-03-27 05:09:59 -05:00
|
|
|
# ObjCxxObject objective c++ compile | LinkTarget/headers
|
|
|
|
#
|
2011-04-23 10:35:37 -05:00
|
|
|
# CObject/dep dependencies these targets generate empty dep files
|
2011-03-27 05:09:59 -05:00
|
|
|
# CxxObject/dep dependencies that are populated upon compile
|
|
|
|
# GenCxxObject/dep dependencies
|
2011-04-23 10:35:37 -05:00
|
|
|
# ObjCObject/dep dependencies
|
2011-03-27 05:09:59 -05:00
|
|
|
# ObjCxxObject/dep dependencies
|
|
|
|
|
|
|
|
# LinkTarget/headers means gb_LinkTarget_get_headers_target etc.
|
|
|
|
# dependencies prefixed with | are build-order only dependencies
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-06-23 07:03:44 -05:00
|
|
|
gb_CObject_REPOS := $(gb_REPOS)
|
|
|
|
|
2010-06-25 18:29:37 -05:00
|
|
|
gb_CObject_get_source = $(1)/$(2).c
|
2010-04-27 04:39:42 -05:00
|
|
|
# defined by platform
|
2010-04-28 07:57:07 -05:00
|
|
|
# gb_CObject__command
|
2010-08-04 06:47:50 -05:00
|
|
|
|
2010-11-21 13:02:35 -06:00
|
|
|
# this rule generates an "always rebuild" dep file, to have something to include.
|
|
|
|
# the dep file will be overridden on the fly, when the object is compiled
|
2010-08-04 06:47:50 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
define gb_CObject__command_dep
|
|
|
|
mkdir -p $(dir $(1)) && \
|
2011-03-11 07:30:09 -06:00
|
|
|
echo '$(call gb_CObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1)
|
2010-08-04 06:47:50 -05:00
|
|
|
|
|
|
|
endef
|
|
|
|
else
|
|
|
|
gb_CObject__command_dep =
|
|
|
|
endif
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-06-23 07:03:44 -05:00
|
|
|
define gb_CObject__rules
|
|
|
|
$$(call gb_CObject_get_target,%) : $$(call gb_CObject_get_source,$(1),%)
|
2011-03-11 07:30:09 -06:00
|
|
|
$$(call gb_CObject__command,$$@,$$*,$$<,$$(DEFS),$$(CFLAGS),$$(INCLUDE))
|
2010-06-23 07:03:44 -05:00
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-06-23 07:03:44 -05:00
|
|
|
$$(call gb_CObject_get_dep_target,%) : $$(call gb_CObject_get_source,$(1),%)
|
2011-03-11 07:30:09 -06:00
|
|
|
$$(call gb_CObject__command_dep,$$@,$$*,$$<,$$(DEFS),$$(CFLAGS),$$(INCLUDE))
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
2010-06-23 07:03:44 -05:00
|
|
|
|
|
|
|
endef
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-06-23 07:03:44 -05:00
|
|
|
$(foreach repo,$(gb_CObject_REPOS),$(eval $(call gb_CObject__rules,$(repo))))
|
2010-04-27 04:39:42 -05:00
|
|
|
|
|
|
|
$(call gb_CObject_get_dep_target,%) :
|
2011-03-11 07:30:09 -06:00
|
|
|
$(eval $(call gb_Output_error,Unable to find plain C file $(call gb_CObject_get_source,,$*) in the repositories: $(gb_CObject_REPOS)))
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-04-28 07:57:07 -05:00
|
|
|
gb_CObject_CObject =
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
|
|
|
|
# CxxObject class
|
|
|
|
|
2010-06-23 07:03:44 -05:00
|
|
|
gb_CxxObject_REPOS := $(gb_REPOS)
|
|
|
|
|
|
|
|
gb_CxxObject_get_source = $(1)/$(2).cxx
|
2010-04-27 04:39:42 -05:00
|
|
|
# defined by platform
|
2010-04-28 07:57:07 -05:00
|
|
|
# gb_CxxObject__command
|
2010-08-04 06:49:43 -05:00
|
|
|
|
2010-11-21 13:02:35 -06:00
|
|
|
# This rule generates an "always rebuild" dep file, to have something to
|
|
|
|
# include. The dep file will be overridden on the fly, when the object is
|
|
|
|
# compiled.
|
2010-08-04 06:49:43 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
define gb_CxxObject__command_dep
|
|
|
|
mkdir -p $(dir $(1)) && \
|
2011-03-11 07:30:09 -06:00
|
|
|
echo '$(call gb_CxxObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1)
|
2010-08-04 06:49:43 -05:00
|
|
|
|
|
|
|
endef
|
|
|
|
else
|
|
|
|
gb_CxxObject__command_dep =
|
|
|
|
endif
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-12-03 09:50:49 -06:00
|
|
|
# Only enable PCH if the PCH_CXXFLAGS and the PCH_DEFS (from the linktarget)
|
|
|
|
# are the same as the CXXFLAGS and DEFS we want to use for this object. This
|
|
|
|
# should usually be the case. The DEFS/CXXFLAGS would have too be manually
|
|
|
|
# overridden for one object file for them to differ. PCH_CXXFLAGS/PCH_DEFS
|
|
|
|
# should never be overridden on an object -- they should be the same as for the
|
|
|
|
# whole linktarget. In general it should be cleaner to use a static library
|
|
|
|
# compiled with different flags and link that in rather than mixing different
|
|
|
|
# flags in one linktarget.
|
2010-06-17 10:44:02 -05:00
|
|
|
define gb_CxxObject__set_pchflags
|
|
|
|
ifeq ($(gb_ENABLE_PCH),$(true))
|
|
|
|
ifneq ($(strip $$(PCH_NAME)),)
|
|
|
|
ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)),$$(sort $$(CXXFLAGS) $$(DEFS)))
|
2010-06-22 10:15:08 -05:00
|
|
|
$$@ : PCHFLAGS := $$(call gb_PrecompiledHeader_get_enableflags,$$(PCH_NAME))
|
2010-06-17 10:44:02 -05:00
|
|
|
else
|
|
|
|
ifeq ($$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_NOEXCEPTIONFLAGS)),$$(sort $$(CXXFLAGS) $$(DEFS)))
|
2010-06-22 10:15:08 -05:00
|
|
|
$$@ : PCHFLAGS := $$(call gb_NoexPrecompiledHeader_get_enableflags,$$(PCH_NAME))
|
2010-06-17 10:44:02 -05:00
|
|
|
else
|
|
|
|
$$(info No precompiled header available for $$*.)
|
|
|
|
$$(info precompiled header flags ( ex) : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS)))
|
|
|
|
$$(info precompiled header flags (noex) : $$(sort $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_NOEXCEPTIONFLAGS)))
|
2011-03-11 07:30:09 -06:00
|
|
|
$$(info . object flags : $$(sort $$(CXXFLAGS) $$(DEFS)))
|
2010-06-17 10:44:02 -05:00
|
|
|
$$@ : PCHFLAGS :=
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
2010-06-23 07:03:44 -05:00
|
|
|
define gb_CxxObject__rules
|
|
|
|
$$(call gb_CxxObject_get_target,%) : $$(call gb_CxxObject_get_source,$(1),%)
|
2011-03-11 07:30:09 -06:00
|
|
|
$$(eval $$(gb_CxxObject__set_pchflags))
|
|
|
|
$$(call gb_CxxObject__command,$$@,$$*,$$<)
|
2010-06-23 07:03:44 -05:00
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-06-23 07:03:44 -05:00
|
|
|
$$(call gb_CxxObject_get_dep_target,%) : $$(call gb_CxxObject_get_source,$(1),%)
|
2011-03-11 07:30:09 -06:00
|
|
|
$$(eval $$(gb_CxxObject__set_pchflags))
|
|
|
|
$$(call gb_CxxObject__command_dep,$$@,$$*,$$<)
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-06-23 07:03:44 -05:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach repo,$(gb_CxxObject_REPOS),$(eval $(call gb_CxxObject__rules,$(repo))))
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_CxxObject_get_dep_target,%) :
|
2011-03-11 07:30:09 -06:00
|
|
|
$(eval $(call gb_Output_error,Unable to find C++ file $(call gb_CxxObject_get_source,,$*) in repositories: $(gb_CxxObject_REPOS)))
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
|
|
|
|
2010-04-28 07:57:07 -05:00
|
|
|
gb_CxxObject_CxxObject =
|
|
|
|
|
2010-06-17 10:44:02 -05:00
|
|
|
|
2011-01-27 07:44:14 -06:00
|
|
|
# GenCxxObject class
|
|
|
|
|
|
|
|
gb_GenCxxObject_get_source = $(WORKDIR)/$(1).cxx
|
|
|
|
# defined by platform
|
|
|
|
# gb_CxxObject__command
|
|
|
|
|
|
|
|
# This rule generates an "always rebuild" dep file, to have something to
|
|
|
|
# include. The dep file will be overridden on the fly, when the object is
|
|
|
|
# compiled.
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
define gb_GenCxxObject__command_dep
|
|
|
|
mkdir -p $(dir $(1)) && \
|
2011-03-11 07:30:09 -06:00
|
|
|
echo '$(call gb_GenCxxObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1)
|
2011-01-27 07:44:14 -06:00
|
|
|
endef
|
|
|
|
else
|
|
|
|
gb_GenCxxObject__command_dep =
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(call gb_GenCxxObject_get_target,%) : $(call gb_GenCxxObject_get_source,%)
|
2011-03-11 07:30:09 -06:00
|
|
|
$(call gb_CxxObject__command,$@,$*,$<)
|
2011-01-27 07:44:14 -06:00
|
|
|
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_GenCxxObject_get_dep_target,%) : $(call gb_GenCxxObject_get_source,%)
|
2011-03-11 07:30:09 -06:00
|
|
|
$(call gb_GenCxxObject__command_dep,$@,$*,$<)
|
2011-01-27 07:44:14 -06:00
|
|
|
|
|
|
|
$(call gb_GenCxxObject_get_dep_target,%) :
|
2011-03-11 07:30:09 -06:00
|
|
|
$(eval $(call gb_Output_error,Unable to find generated C++ file $(call gb_GenCxxObject_get_source,$*) in WORKDIR.))
|
2011-01-27 07:44:14 -06:00
|
|
|
endif
|
|
|
|
|
|
|
|
gb_GenCxxObject_GenCxxObject =
|
|
|
|
|
|
|
|
|
2010-04-30 12:38:20 -05:00
|
|
|
# ObjCxxObject class
|
2010-06-23 07:03:44 -05:00
|
|
|
#
|
|
|
|
gb_ObjCxxObject_REPOS := $(gb_REPOS)
|
2010-04-30 12:38:20 -05:00
|
|
|
|
2010-06-23 07:03:44 -05:00
|
|
|
gb_ObjCxxObject_get_source = $(1)/$(2).mm
|
2010-04-30 12:38:20 -05:00
|
|
|
# defined by platform
|
|
|
|
# gb_ObjCxxObject__command
|
2010-08-04 07:10:24 -05:00
|
|
|
|
2010-11-21 13:02:35 -06:00
|
|
|
# this rule generates an "always rebuild" dep file, to have something to include.
|
|
|
|
# the dep file will be overridden on the fly, when the object is compiled
|
2010-08-04 07:10:24 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
define gb_ObjCxxObject__command_dep
|
|
|
|
mkdir -p $(dir $(1)) && \
|
2011-03-11 07:30:09 -06:00
|
|
|
echo '$(call gb_ObjCxxObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1)
|
2010-08-04 07:10:24 -05:00
|
|
|
|
|
|
|
endef
|
|
|
|
else
|
|
|
|
gb_ObjCxxObject__command_dep =
|
|
|
|
endif
|
2010-04-30 12:38:20 -05:00
|
|
|
|
2010-06-23 07:03:44 -05:00
|
|
|
define gb_ObjCxxObject__rules
|
|
|
|
$$(call gb_ObjCxxObject_get_target,%) : $$(call gb_ObjCxxObject_get_source,$(1),%)
|
2011-03-11 07:30:09 -06:00
|
|
|
$$(call gb_ObjCxxObject__command,$$@,$$*,$$<,$$(DEFS),$$(OBJCXXFLAGS),$$(INCLUDE_STL) $$(INCLUDE))
|
2010-06-23 07:03:44 -05:00
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-06-23 07:03:44 -05:00
|
|
|
$$(call gb_ObjCxxObject_get_dep_target,%) : $$(call gb_ObjCxxObject_get_source,$(1),%)
|
2011-03-11 07:30:09 -06:00
|
|
|
$$(call gb_ObjCxxObject__command_dep,$$@,$$*,$$<,$$(DEFS),$$(OBJCXXFLAGS),$$(INCLUDE_STL) $$(INCLUDE))
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
2010-06-23 07:03:44 -05:00
|
|
|
|
|
|
|
endef
|
2010-04-30 12:38:20 -05:00
|
|
|
|
2010-06-23 07:03:44 -05:00
|
|
|
$(foreach repo,$(gb_ObjCxxObject_REPOS),$(eval $(call gb_ObjCxxObject__rules,$(repo))))
|
2010-04-30 12:38:20 -05:00
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-04-30 12:38:20 -05:00
|
|
|
$(call gb_ObjCxxObject_get_dep_target,%) :
|
2011-03-11 07:30:09 -06:00
|
|
|
$(eval $(call gb_Output_error,Unable to find Objective C++ file $(call gb_ObjCxxObject_get_source,,$*) in repositories: $(gb_ObjCxxObject_REPOS)))
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
2010-04-30 12:38:20 -05:00
|
|
|
|
|
|
|
gb_ObjCxxObject_ObjCxxObject =
|
|
|
|
|
2011-04-23 10:35:37 -05:00
|
|
|
# ObjCObject class
|
|
|
|
#
|
|
|
|
gb_ObjCObject_REPOS := $(gb_REPOS)
|
|
|
|
|
|
|
|
gb_ObjCObject_get_source = $(1)/$(2).m
|
|
|
|
# defined by platform
|
|
|
|
# gb_ObjCObject__command
|
|
|
|
|
|
|
|
# this rule generates an "always rebuild" dep file, to have something to include.
|
|
|
|
# the dep file will be overridden on the fly, when the object is compiled
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
define gb_ObjCObject__command_dep
|
|
|
|
mkdir -p $(dir $(1)) && \
|
|
|
|
echo '$(call gb_ObjCObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1)
|
|
|
|
|
|
|
|
endef
|
|
|
|
else
|
|
|
|
gb_ObjCObject__command_dep =
|
|
|
|
endif
|
|
|
|
|
|
|
|
define gb_ObjCObject__rules
|
|
|
|
$$(call gb_ObjCObject_get_target,%) : $$(call gb_ObjCObject_get_source,$(1),%)
|
|
|
|
$$(call gb_ObjCObject__command,$$@,$$*,$$<,$$(DEFS),$$(OBJCFLAGS),$$(INCLUDE_STL) $$(INCLUDE))
|
|
|
|
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$$(call gb_ObjCObject_get_dep_target,%) : $$(call gb_ObjCObject_get_source,$(1),%)
|
|
|
|
$$(call gb_ObjCObject__command_dep,$$@,$$*,$$<,$$(DEFS),$$(OBJCFLAGS),$$(INCLUDE_STL) $$(INCLUDE))
|
|
|
|
endif
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach repo,$(gb_ObjCObject_REPOS),$(eval $(call gb_ObjCObject__rules,$(repo))))
|
|
|
|
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_ObjCObject_get_dep_target,%) :
|
|
|
|
$(eval $(call gb_Output_error,Unable to find Objective C++ file $(call gb_ObjCObject_get_source,,$*) in repositories: $(gb_ObjCObject_REPOS)))
|
|
|
|
endif
|
|
|
|
|
|
|
|
gb_ObjCObject_ObjCObject =
|
|
|
|
|
2010-04-30 12:38:20 -05:00
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
|
|
|
|
# LinkTarget class
|
|
|
|
|
|
|
|
gb_LinkTarget_DEFAULTDEFS := $(gb_GLOBALDEFS)
|
2011-04-16 07:25:37 -05:00
|
|
|
gb_LinkTarget_OBJECTOWNER :=
|
|
|
|
gb_LinkTarget_OBJECTS :=
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
# defined by platform
|
|
|
|
# gb_LinkTarget_CXXFLAGS
|
|
|
|
# gb_LinkTarget_LDFLAGS
|
|
|
|
# gb_LinkTarget_INCLUDE
|
|
|
|
# gb_LinkTarget_INCLUDE_STL
|
|
|
|
|
|
|
|
.PHONY : $(call gb_LinkTarget_get_clean_target,%)
|
|
|
|
$(call gb_LinkTarget_get_clean_target,%) :
|
2011-03-11 07:30:09 -06:00
|
|
|
$(call gb_Output_announce,$*,$(false),LNK,4)
|
|
|
|
RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
|
|
|
|
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
|
|
|
|
$(foreach object,$(COBJECTS),$(call gb_CObject_get_dep_target,$(object))) \
|
|
|
|
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
|
|
|
|
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_dep_target,$(object))) \
|
2011-04-23 10:35:37 -05:00
|
|
|
$(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
|
|
|
|
$(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_dep_target,$(object))) \
|
2011-03-11 07:30:09 -06:00
|
|
|
$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
|
|
|
|
$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_dep_target,$(object))) \
|
|
|
|
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
|
|
|
|
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_dep_target,$(object))) \
|
|
|
|
$(call gb_LinkTarget_get_target,$*) \
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$*) \
|
|
|
|
$(call gb_LinkTarget_get_headers_target,$*) \
|
|
|
|
$(call gb_LinkTarget_get_external_headers_target,$*) \
|
2011-04-05 02:09:52 -05:00
|
|
|
$(call gb_LinkTarget_get_objects_list,$*) \
|
2011-03-11 07:30:09 -06:00
|
|
|
$(DLLTARGET) \
|
|
|
|
$(AUXTARGETS)) && \
|
2011-03-23 10:58:44 -05:00
|
|
|
cat $${RESPONSEFILE} /dev/null | xargs -n 200 rm -f && \
|
2011-03-11 07:30:09 -06:00
|
|
|
rm -f $${RESPONSEFILE}
|
2011-01-27 02:47:18 -06:00
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-11-21 13:02:35 -06:00
|
|
|
# cat the deps of all objects in one file, then we need only open that one file
|
2010-04-28 07:57:07 -05:00
|
|
|
define gb_LinkTarget__command_dep
|
2010-11-12 05:43:33 -06:00
|
|
|
$(call gb_Output_announce,LNK:$(2),$(true),DEP,1)
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_Helper_abbreviate_dirs,\
|
2011-03-11 07:30:09 -06:00
|
|
|
mkdir -p $(dir $(1)) && \
|
|
|
|
RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
|
|
|
|
$(foreach object,$(3),$(call gb_CObject_get_dep_target,$(object))) \
|
|
|
|
$(foreach object,$(4),$(call gb_CxxObject_get_dep_target,$(object))) \
|
2011-04-23 10:35:37 -05:00
|
|
|
$(foreach object,$(5),$(call gb_ObjCObject_get_dep_target,$(object)))\
|
|
|
|
$(foreach object,$(6),$(call gb_ObjCxxObject_get_dep_target,$(object)))\
|
|
|
|
$(foreach object,$(7),$(call gb_GenCxxObject_get_dep_target,$(object)))\
|
2011-03-11 07:30:09 -06:00
|
|
|
) && \
|
2011-03-23 10:58:44 -05:00
|
|
|
cat $${RESPONSEFILE} /dev/null | xargs -n 200 cat > $(1)) && \
|
2011-03-11 07:30:09 -06:00
|
|
|
rm -f $${RESPONSEFILE}
|
2011-01-27 02:47:18 -06:00
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
endef
|
|
|
|
|
2011-04-05 02:09:52 -05:00
|
|
|
define gb_LinkTarget__command_objectlist
|
|
|
|
TEMPFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\
|
|
|
|
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
|
|
|
|
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
|
2011-04-23 10:35:37 -05:00
|
|
|
$(foreach object,$(OBJCOBJECTS),$(call gb_ObjCObject_get_target,$(object))) \
|
2011-04-05 02:09:52 -05:00
|
|
|
$(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \
|
|
|
|
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object)))) && \
|
|
|
|
$(if $(EXTRAOBJECTLISTS),cat $(EXTRAOBJECTLISTS) >> $${TEMPFILE} && ) \
|
|
|
|
mv $${TEMPFILE} $(call gb_LinkTarget_get_objects_list,$(2))
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%) $(gb_Helper_MISCDUMMY)
|
2011-03-11 07:30:09 -06:00
|
|
|
$(call gb_LinkTarget__command,$@,$*)
|
2011-04-05 02:09:52 -05:00
|
|
|
$(call gb_LinkTarget__command_objectlist,$@,$*)
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_dep_target,%)
|
2010-07-07 06:17:37 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,%) : | $(call gb_LinkTarget_get_headers_target,%)
|
2011-04-23 10:35:37 -05:00
|
|
|
$(call gb_LinkTarget__command_dep,$@,$*,$(COBJECTS),$(CXXOBJECTS),$(OBJCOBJECTS),$(OBJCXXOBJECTS),$(GENCXXOBJECTS))
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-11-21 13:02:35 -06:00
|
|
|
# Ok, this is some dark voodoo: When declaring a linktarget with
|
|
|
|
# gb_LinkTarget_LinkTarget we set SELF in the headertarget to name of the
|
|
|
|
# target. When the rule for the headertarget is executed and SELF does not
|
|
|
|
# match the target name, we are depending on a linktarget that was never
|
|
|
|
# declared. In a full build exclusively in gbuild that should never happen.
|
|
|
|
# However, partial gbuild build will not know about how to build lower level
|
|
|
|
# linktargets, just as gbuild can not know about linktargets generated in the
|
|
|
|
# old build.pl/dmake system. Once all is migrated, gbuild should error out
|
|
|
|
# when is is told to depend on a linktarget it does not know about and not
|
|
|
|
# only warn.
|
2010-04-28 07:57:07 -05:00
|
|
|
define gb_LinkTarget__get_external_headers_check
|
2010-04-27 04:39:42 -05:00
|
|
|
ifneq ($$(SELF),$$*)
|
2010-11-14 06:32:14 -06:00
|
|
|
$$(eval $$(call gb_Output_info,LinkTarget $$* not defined: Assuming headers to be there!,ALL))
|
2010-04-27 04:39:42 -05:00
|
|
|
endif
|
2011-01-21 11:38:23 -06:00
|
|
|
$$@ : COMMAND := $$(call gb_Helper_abbreviate_dirs, mkdir -p $$(dir $$@) && touch $$@ && mkdir -p $(call gb_LinkTarget_get_target,)pdb/$$(dir $$*))
|
2010-04-27 04:39:42 -05:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(call gb_LinkTarget_get_external_headers_target,%) :
|
2011-03-11 07:30:09 -06:00
|
|
|
$(eval $(gb_LinkTarget__get_external_headers_check))
|
|
|
|
$(COMMAND)
|
2010-04-27 04:39:42 -05:00
|
|
|
|
|
|
|
$(call gb_LinkTarget_get_headers_target,%) : $(call gb_LinkTarget_get_external_headers_target,%)
|
2011-03-11 07:30:09 -06:00
|
|
|
$(call gb_Helper_abbreviate_dirs,\
|
|
|
|
mkdir -p $(dir $@) && touch $@)
|
2010-04-27 04:39:42 -05:00
|
|
|
|
2010-11-21 13:02:35 -06:00
|
|
|
# Explanation of some of the targets:
|
|
|
|
# - gb_LinkTarget_get_external_headers_target is the targets that guarantees all
|
|
|
|
# headers from linked against libraries are in OUTDIR.
|
|
|
|
# - gb_LinkTarget_get_headers_target is the target that guarantees all headers
|
|
|
|
# from the linked against the libraries and the linktargets own headers
|
|
|
|
# (including generated headers) are in the OUTDIR.
|
|
|
|
# - gb_LinkTarget_get_target links the objects into a file in WORKDIR.
|
|
|
|
# gb_LinkTarget_get_target depends on gb_LinkTarget_get_headers_target which in
|
|
|
|
# turn depends gb_LinkTarget_get_external_headers_target.
|
2011-01-27 07:44:14 -06:00
|
|
|
# gb_LinkTarget_get_target depends additionally on the objects, which in turn
|
2010-11-21 13:02:35 -06:00
|
|
|
# depend build-order only on the gb_LinkTarget_get_headers_target. The build
|
|
|
|
# order-only dependency ensures all headers to be there for compiling and
|
|
|
|
# dependency generation without causing all objects to be rebuild when one
|
|
|
|
# header changes. Only the ones with an explicit dependency in their generated
|
|
|
|
# dependency file will be rebuild.
|
|
|
|
#
|
|
|
|
# gb_LinkTarget_get_target is the target that links the objects into a file in
|
|
|
|
# WORKDIR
|
|
|
|
# Explanation of some of the variables:
|
|
|
|
# - AUXTARGETS are the additionally generated files that need to be cleaned out
|
|
|
|
# on clean.
|
|
|
|
# - PCH_CXXFLAGS and PCH_DEFS are the flags that the precompiled headers will
|
|
|
|
# be compiled with. They should never be overridden in a single object
|
|
|
|
# files.
|
2011-01-13 11:55:57 -06:00
|
|
|
# - TARGETTYPE is the type of linktarget as some platforms need very different
|
|
|
|
# command to link different targettypes.
|
2010-11-21 13:02:35 -06:00
|
|
|
#
|
|
|
|
# Since most variables are set on the linktarget and not on the object, the
|
|
|
|
# object learns about these setting via GNU makes scoping of target variables.
|
|
|
|
# Therefore it is important that objects are only directly depended on by the
|
|
|
|
# linktarget. This for example means that you cannot build a single object
|
|
|
|
# alone, because then you would directly depend on the object.
|
2010-04-27 04:39:42 -05:00
|
|
|
define gb_LinkTarget_LinkTarget
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS :=
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_external_headers_target,$(1)) : SELF := $(1)
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : DLLTARGET :=
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) \
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : COBJECTS :=
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) \
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS :=
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) \
|
2011-04-23 10:35:37 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS :=
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) \
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS :=
|
2011-01-27 07:44:14 -06:00
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) \
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS :=
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : CFLAGS := $$(gb_LinkTarget_CFLAGS)
|
2010-07-07 11:02:28 -05:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
|
2010-06-17 10:44:02 -05:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2011-01-31 05:22:57 -06:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $(gb_COMPILEROPTFLAGS)
|
2011-04-23 10:35:37 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : OBJCFLAGS := $$(gb_LinkTarget_OBJCFLAGS)
|
2010-04-30 12:38:20 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS)
|
2010-11-24 15:19:35 -06:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
|
2010-06-17 10:44:02 -05:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-06-23 07:38:12 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
|
2010-12-09 04:05:31 -06:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE)
|
2010-12-09 04:05:31 -06:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : INCLUDE_STL := $$(gb_LinkTarget_INCLUDE_STL)
|
2011-04-14 08:05:27 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : LDFLAGS := $$(gb_LinkTarget_LDFLAGS) $(gb_LINKEROPTFLAGS)
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS :=
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS :=
|
2011-01-13 11:55:57 -06:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : TARGETTYPE :=
|
2010-06-17 10:44:02 -05:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : PCH_NAME :=
|
2011-01-21 10:03:11 -06:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS :=
|
2011-01-21 11:38:23 -06:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : PDBFILE :=
|
2011-04-05 02:09:52 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS :=
|
2011-03-23 11:27:40 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : NATIVERES :=
|
2010-08-04 06:30:47 -05:00
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-11-12 12:01:52 -06:00
|
|
|
ifneq ($(wildcard $(call gb_LinkTarget_get_dep_target,$(1))),)
|
2010-04-27 04:39:42 -05:00
|
|
|
include $(call gb_LinkTarget_get_dep_target,$(1))
|
2010-11-12 12:01:52 -06:00
|
|
|
else
|
|
|
|
$(firstword $(MAKEFILE_LIST)) : $(call gb_LinkTarget_get_dep_target,$(1))
|
|
|
|
endif
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS :=
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS :=
|
2011-04-23 10:35:37 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS :=
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS :=
|
2011-01-27 07:44:14 -06:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS :=
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : CFLAGS := $$(gb_LinkTarget_CFLAGS)
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS)
|
2011-01-31 05:22:57 -06:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := $$(gb_LinkTarget_CXXFLAGS) $(gb_COMPILEROPTFLAGS)
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXFLAGS := $$(gb_LinkTarget_OBJCXXFLAGS)
|
2011-04-23 10:35:37 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCFLAGS := $$(gb_LinkTarget_OBJCFLAGS)
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS := $$(gb_LinkTarget_DEFAULTDEFS)
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE)
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE_STL := $$(gb_LinkTarget_INCLUDE_STL)
|
2011-01-13 11:55:57 -06:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE :=
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_NAME :=
|
2011-04-05 02:09:52 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : EXTRAOBJECTLISTS :=
|
2010-04-27 04:39:42 -05:00
|
|
|
endif
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_set_defs
|
2010-12-09 08:41:55 -06:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : DEFS := $(2)
|
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS := $(2)
|
|
|
|
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $(2)
|
2010-07-07 11:02:28 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS := $(2)
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_set_cflags
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : CFLAGS := $(2)
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : CFLAGS := $(2)
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_set_cxxflags
|
2010-12-09 08:41:55 -06:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : CXXFLAGS := $(2)
|
2010-06-17 10:44:02 -05:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : PCH_CXXFLAGS := $(2)
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : CXXFLAGS := $(2)
|
2010-07-07 11:02:28 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_CXXFLAGS := $(2)
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
endef
|
|
|
|
|
2010-04-30 12:38:20 -05:00
|
|
|
define gb_LinkTarget_set_objcxxflags
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : OBJCXXFLAGS := $(2)
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-04-30 12:38:20 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXFLAGS := $(2)
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
|
|
|
|
2010-04-30 12:38:20 -05:00
|
|
|
endef
|
|
|
|
|
2011-04-23 10:35:37 -05:00
|
|
|
define gb_LinkTarget_set_objcflags
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : OBJCFLAGS := $(2)
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCFLAGS := $(2)
|
|
|
|
endif
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
define gb_LinkTarget_set_include
|
2010-12-09 04:05:31 -06:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : INCLUDE := $(2)
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $(2)
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
endef
|
|
|
|
|
2010-04-28 07:57:07 -05:00
|
|
|
define gb_LinkTarget_set_include_stl
|
2010-12-09 04:05:31 -06:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : INCLUDE_STL := $(2)
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-04-28 07:57:07 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE_STL := $(2)
|
2010-08-04 06:30:47 -05:00
|
|
|
endif
|
|
|
|
|
2010-04-28 07:57:07 -05:00
|
|
|
endef
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
define gb_LinkTarget_set_ldflags
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : LDFLAGS := $(2)
|
|
|
|
endef
|
|
|
|
|
2011-05-30 11:05:01 -05:00
|
|
|
define gb_LinkTarget_add_api
|
|
|
|
$(call gb_LinkTarget_get_external_headers_target,$(1)) :| \
|
|
|
|
$$(foreach api,$(2),$$(call gb_Package_get_target,$$(api)_inc))
|
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : INCLUDE += $$(foreach api,$(2),-I$(OUTDIR)/inc/$$(api))
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE += $$(foreach api,$(2),-I$(OUTDIR)/inc/$$(api))
|
|
|
|
endif
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
define gb_LinkTarget_add_linked_libs
|
|
|
|
ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
|
2010-11-13 18:21:34 -06:00
|
|
|
$$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
|
|
|
|
$$(eval $$(call gb_Output_error,Cannot link against library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk))
|
2010-04-27 04:39:42 -05:00
|
|
|
endif
|
2010-08-04 06:30:47 -05:00
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : LINKED_LIBS += $(2)
|
|
|
|
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$(2),$$(call gb_Library_get_target,$$(lib)))
|
|
|
|
$(call gb_LinkTarget_get_external_headers_target,$(1)) : \
|
|
|
|
$$(foreach lib,$(2),$$(call gb_Library_get_headers_target,$$(lib)))
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_linked_static_libs
|
|
|
|
ifneq (,$$(filter-out $(gb_StaticLibrary_KNOWNLIBS),$(2)))
|
2010-11-13 18:21:34 -06:00
|
|
|
$$(eval $$(call gb_Output_info, currently known static libraries are: $(sort $(gb_StaticLibrary_KNOWNLIBS)),ALL))
|
|
|
|
$$(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))
|
2010-04-27 04:39:42 -05:00
|
|
|
endif
|
2010-08-04 06:30:47 -05:00
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : LINKED_STATIC_LIBS += $(2)
|
|
|
|
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : $$(foreach lib,$(2),$$(call gb_StaticLibrary_get_target,$$(lib)))
|
|
|
|
$(call gb_LinkTarget_get_external_headers_target,$(1)) : \
|
|
|
|
$$(foreach lib,$(2),$$(call gb_StaticLibrary_get_headers_target,$$(lib)))
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_cobject
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : COBJECTS += $(2)
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : COBJECTS += $(2)
|
|
|
|
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : $(call gb_CObject_get_target,$(2))
|
|
|
|
$(call gb_CObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
|
|
|
|
$(call gb_CObject_get_target,$(2)) : CFLAGS += $(3)
|
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS += $(2)
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CObject_get_dep_target,$(2))
|
|
|
|
endif
|
|
|
|
|
2011-04-16 07:25:37 -05:00
|
|
|
ifeq ($(gb_CHECKOBJECTOWNER),$(true))
|
|
|
|
gb_LinkTarget_OBJECTOWNER += $(call gb_CObject_get_target,$(2)):$(1)
|
|
|
|
gb_LinkTarget_OBJECTS += $(call gb_CObject_get_target,$(2))
|
|
|
|
endif
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_cxxobject
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : CXXOBJECTS += $(2)
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : CXXOBJECTS += $(2)
|
|
|
|
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : $(call gb_CxxObject_get_target,$(2))
|
|
|
|
$(call gb_CxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
|
|
|
|
$(call gb_CxxObject_get_target,$(2)) : CXXFLAGS += $(3)
|
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS += $(2)
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_CxxObject_get_dep_target,$(2))
|
|
|
|
endif
|
|
|
|
|
2011-04-16 07:25:37 -05:00
|
|
|
ifeq ($(gb_CHECKOBJECTOWNER),$(true))
|
|
|
|
gb_LinkTarget_OBJECTOWNER += $(call gb_CxxObject_get_target,$(2)):$(1)
|
|
|
|
gb_LinkTarget_OBJECTS += $(call gb_CxxObject_get_target,$(2))
|
|
|
|
endif
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
endef
|
|
|
|
|
2011-04-23 10:35:37 -05:00
|
|
|
define gb_LinkTarget_add_objcobject
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : OBJCOBJECTS += $(2)
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : OBJCOBJECTS += $(2)
|
|
|
|
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : $(call gb_ObjCObject_get_target,$(2))
|
|
|
|
$(call gb_ObjCObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
|
|
|
|
$(call gb_ObjCObject_get_target,$(2)) : OBJCFLAGS += $(3)
|
|
|
|
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCOBJECTS += $(2)
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_ObjCObject_get_dep_target,$(2))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(gb_CHECKOBJECTOWNER),$(true))
|
|
|
|
gb_LinkTarget_OBJECTOWNER += $(call gb_ObjCObject_get_target,$(2)):$(1)
|
|
|
|
gb_LinkTarget_OBJECTS += $(call gb_ObjCObject_get_target,$(2))
|
|
|
|
endif
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2010-04-30 12:38:20 -05:00
|
|
|
define gb_LinkTarget_add_objcxxobject
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : OBJCXXOBJECTS += $(2)
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : OBJCXXOBJECTS += $(2)
|
|
|
|
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : $(call gb_ObjCxxObject_get_target,$(2))
|
|
|
|
$(call gb_ObjCxxObject_get_target,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
|
|
|
|
$(call gb_ObjCxxObject_get_target,$(2)) : OBJCXXFLAGS += $(3)
|
|
|
|
|
2010-08-04 06:30:47 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS += $(2)
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_ObjCxxObject_get_dep_target,$(2))
|
|
|
|
endif
|
|
|
|
|
2011-04-16 07:25:37 -05:00
|
|
|
ifeq ($(gb_CHECKOBJECTOWNER),$(true))
|
|
|
|
gb_LinkTarget_OBJECTOWNER += $(call gb_ObjCxxObject_get_target,$(2)):$(1)
|
|
|
|
gb_LinkTarget_OBJECTS += $(call gb_ObjCxxObject_get_target,$(2))
|
|
|
|
endif
|
|
|
|
|
2010-04-30 12:38:20 -05:00
|
|
|
endef
|
|
|
|
|
2011-01-27 07:44:14 -06:00
|
|
|
define gb_LinkTarget_add_generated_cxx_object
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : GENCXXOBJECTS += $(2)
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : GENCXXOBJECTS += $(2)
|
|
|
|
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : $(call gb_GenCxxObject_get_target,$(2))
|
|
|
|
$(call gb_GenCxxObject_get_source,$(2)) : | $(call gb_LinkTarget_get_headers_target,$(1))
|
2011-06-05 05:15:41 -05:00
|
|
|
$(call gb_GenCxxObject_get_target,$(2)) : CXXFLAGS += $(3)
|
2011-01-27 07:44:14 -06:00
|
|
|
|
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : GENCXXOBJECTS += $(2)
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : $(call gb_GenCxxObject_get_dep_target,$(2))
|
|
|
|
endif
|
|
|
|
|
2011-04-16 07:25:37 -05:00
|
|
|
ifeq ($(gb_CHECKOBJECTOWNER),$(true))
|
|
|
|
gb_LinkTarget_OBJECTOWNER += $(call gb_GenCxxObject_get_target,$(2)):$(1)
|
|
|
|
gb_LinkTarget_OBJECTS += $(call gb_GenCxxObject_get_target,$(2))
|
|
|
|
endif
|
|
|
|
|
2011-01-27 07:44:14 -06:00
|
|
|
endef
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
define gb_LinkTarget_add_noexception_object
|
2011-01-31 05:22:57 -06:00
|
|
|
$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_NOEXCEPTIONFLAGS) $(gb_COMPILEROPTFLAGS))
|
2010-04-27 04:39:42 -05:00
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_exception_object
|
2011-01-31 05:22:57 -06:00
|
|
|
$(call gb_LinkTarget_add_cxxobject,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(gb_COMPILEROPTFLAGS))
|
2010-04-27 04:39:42 -05:00
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_cobjects
|
|
|
|
$(foreach obj,$(2),$(call gb_LinkTarget_add_cobject,$(1),$(obj),$(3)))
|
|
|
|
endef
|
|
|
|
|
2011-04-05 02:09:52 -05:00
|
|
|
define gb_LinkTarget_add_linktarget_objects
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : $(foreach linktarget,$(2),$(call gb_LinkTarget_get_target,$(linktarget)))
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS += $(foreach linktarget,$(2),$(call gb_LinkTarget_get_objects_list,$(linktarget)))
|
2011-04-04 09:16:54 -05:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
2011-04-05 02:09:52 -05:00
|
|
|
define gb_LinkTarget_add_library_objects
|
2011-04-04 09:16:54 -05:00
|
|
|
ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2)))
|
|
|
|
$$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL))
|
|
|
|
$$(eval $$(call gb_Output_error,Cannot import objects library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk))
|
|
|
|
endif
|
2011-04-05 02:09:52 -05:00
|
|
|
$(call gb_LinkTarget_add_linktarget_objects,$(1),$(foreach lib,$(2),$(call gb_Library_get_linktargetname,$(lib))))
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_executable_objects
|
|
|
|
$(call gb_LinkTarget_add_linktarget_objects,$(1),$(foreach exe,$(2),$(call gb_Executable_get_linktargetname,$(lib))))
|
|
|
|
|
2011-04-04 09:16:54 -05:00
|
|
|
endef
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
define gb_LinkTarget_add_cxxobjects
|
|
|
|
$(foreach obj,$(2),$(call gb_LinkTarget_add_cxxobject,$(1),$(obj),$(3)))
|
|
|
|
endef
|
|
|
|
|
2011-04-23 10:35:37 -05:00
|
|
|
define gb_LinkTarget_add_objcobjects
|
|
|
|
$(foreach obj,$(2),$(call gb_LinkTarget_add_objcobject,$(1),$(obj),$(3)))
|
|
|
|
endef
|
|
|
|
|
2010-04-30 12:38:20 -05:00
|
|
|
define gb_LinkTarget_add_objcxxobjects
|
|
|
|
$(foreach obj,$(2),$(call gb_LinkTarget_add_objcxxobject,$(1),$(obj),$(3)))
|
|
|
|
endef
|
|
|
|
|
2010-04-27 04:39:42 -05:00
|
|
|
define gb_LinkTarget_add_noexception_objects
|
|
|
|
$(foreach obj,$(2),$(call gb_LinkTarget_add_noexception_object,$(1),$(obj)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_exception_objects
|
|
|
|
$(foreach obj,$(2),$(call gb_LinkTarget_add_exception_object,$(1),$(obj)))
|
|
|
|
endef
|
|
|
|
|
2011-04-14 05:38:33 -05:00
|
|
|
define gb_LinkTarget_add_generated_cxxobjects
|
|
|
|
$(foreach obj,$(2),$(call gb_LinkTarget_add_generated_cxx_object,$(1),$(obj),$(3)))
|
|
|
|
endef
|
|
|
|
|
2011-01-27 07:44:14 -06:00
|
|
|
define gb_LinkTarget_add_generated_exception_object
|
2011-06-05 05:15:41 -05:00
|
|
|
$(call gb_LinkTarget_add_generated_cxx_object,$(1),$(2),$(gb_LinkTarget_EXCEPTIONFLAGS) $(gb_COMPILEROPTFLAGS))
|
2011-01-27 07:44:14 -06:00
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_generated_exception_objects
|
|
|
|
$(foreach obj,$(2),$(call gb_LinkTarget_add_generated_exception_object,$(1),$(obj)))
|
|
|
|
endef
|
|
|
|
|
2011-01-13 11:55:57 -06:00
|
|
|
define gb_LinkTarget_set_targettype
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) \
|
2011-01-13 11:55:57 -06:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE := $(2)
|
2010-04-27 04:39:42 -05:00
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_set_dlltarget
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) \
|
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : DLLTARGET := $(2)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_set_auxtargets
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS := $(2)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget__add_internal_headers
|
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) : $(2)
|
|
|
|
$(2) :| $(call gb_LinkTarget_get_external_headers_target,$(1))
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_package_headers
|
2011-01-27 07:44:26 -06:00
|
|
|
$(foreach package,$(2),$(call gb_LinkTarget__add_internal_headers,$(1),$(call gb_Package_get_target,$(package))))
|
2010-04-27 04:39:42 -05:00
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : $(foreach package,$(2),$(call gb_Package_get_clean_target,$(package)))
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_sdi_headers
|
|
|
|
$(call gb_LinkTarget__add_internal_headers,$(1),$(foreach sdi,$(2),$(call gb_SdiTarget_get_target,$(sdi))))
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : $(foreach sdi,$(2),$(call gb_SdiTarget_get_clean_target,$(sdi)))
|
|
|
|
endef
|
|
|
|
|
2010-06-16 09:10:59 -05:00
|
|
|
define gb_LinkTarget__add_precompiled_header_impl
|
|
|
|
$(call gb_LinkTarget__add_internal_headers,$(1),$(call gb_PrecompiledHeader_get_target,$(3)))
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_PrecompiledHeader_get_clean_target,$(3))
|
2010-06-22 10:15:08 -05:00
|
|
|
$(call gb_PrecompiledHeader_get_target,$(3)) : $(2).cxx
|
|
|
|
|
|
|
|
$(call gb_LinkTarget__add_internal_headers,$(1),$(call gb_NoexPrecompiledHeader_get_target,$(3)))
|
|
|
|
$(call gb_LinkTarget_get_clean_target,$(1)) : $(call gb_NoexPrecompiledHeader_get_clean_target,$(3))
|
|
|
|
$(call gb_NoexPrecompiledHeader_get_target,$(3)) : $(2).cxx
|
|
|
|
|
2010-06-17 10:44:02 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : PCH_NAME := $(3)
|
2011-01-21 10:03:11 -06:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : PCHOBJS = $(call gb_PrecompiledHeader_get_target,$(3)).obj $(call gb_NoexPrecompiledHeader_get_target,$(3)).obj
|
|
|
|
|
2010-12-09 04:05:31 -06:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : DEFS := $$(DEFS) -DPRECOMPILED_HEADERS
|
2010-06-22 07:37:57 -05:00
|
|
|
$(call gb_LinkTarget_get_headers_target,$(1)) \
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_target,$(1)) : PCH_DEFS = $$(DEFS)
|
2010-06-22 11:14:05 -05:00
|
|
|
ifeq ($(gb_FULLDEPS),$(true))
|
2010-11-12 12:01:52 -06:00
|
|
|
-include \
|
2011-03-11 07:30:09 -06:00
|
|
|
$(call gb_PrecompiledHeader_get_dep_target,$(3)) \
|
|
|
|
$(call gb_NoexPrecompiledHeader_get_dep_target,$(3))
|
2010-08-04 06:30:47 -05:00
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : DEFS := $$(DEFS) -DPRECOMPILED_HEADERS
|
|
|
|
$(call gb_LinkTarget_get_dep_target,$(1)) : PCH_DEFS = $$(DEFS)
|
2010-06-22 11:14:05 -05:00
|
|
|
endif
|
2010-08-04 06:30:47 -05:00
|
|
|
|
2010-06-16 09:10:59 -05:00
|
|
|
endef
|
|
|
|
|
|
|
|
define gb_LinkTarget_add_precompiled_header
|
|
|
|
ifeq ($(gb_ENABLE_PCH),$(true))
|
|
|
|
$(call gb_LinkTarget__add_precompiled_header_impl,$(1),$(2),$(notdir $(2)))
|
|
|
|
endif
|
2010-08-04 06:30:47 -05:00
|
|
|
|
2010-06-16 09:10:59 -05:00
|
|
|
endef
|
|
|
|
|
2011-03-11 07:30:09 -06:00
|
|
|
# vim: set noet sw=4:
|