summaryrefslogtreecommitdiffstats
path: root/package/pkg-cmake.mk
diff options
context:
space:
mode:
authorSamuel Martin <s.martin49@gmail.com>2014-06-01 11:24:24 +0200
committerPeter Korsgaard <peter@korsgaard.com>2014-06-01 22:15:43 +0200
commit9033d90118689a50b13b3764a927ec1b202624bf (patch)
treed22e74d2644ae7c82c217c16a652f67dcc37cdb3 /package/pkg-cmake.mk
parent85fea5d9538e8ea1d1f83c7aa517ffebff7a4f1f (diff)
downloadbuildroot-9033d90118689a50b13b3764a927ec1b202624bf.tar.gz
buildroot-9033d90118689a50b13b3764a927ec1b202624bf.zip
pkg-cmake.mk: do not hardcode absolute path in toolchainfile.cmake
The patch allows sharing or moving the toolchains. This is a step toward making the toolchain/sdk relocatable. Closes #6818 [Peter: reword comment as suggested by Thomas] Signed-off-by: Samuel Martin <s.martin49@gmail.com> Cc: Uwe Strempel <u.strempel@googlemail.com> Cc: Arnout Vandecappelle <arnout@mind.be> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'package/pkg-cmake.mk')
-rw-r--r--package/pkg-cmake.mk11
1 files changed, 7 insertions, 4 deletions
diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index ca56b48995..a84aa0b302 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -158,14 +158,17 @@ host-cmake-package = $(call inner-cmake-package,host-$(pkgname),$(call UPPERCASE
# Generation of the CMake toolchain file
################################################################################
+# In order to allow the toolchain to be relocated, we calculate the HOST_DIR
+# based on the toolchainfile.cmake file's location: $(HOST_DIR)/usr/share/buildroot
+# In all the other variables, HOST_DIR will be replaced by RELOCATED_HOST_DIR,
+# so we have to strip "$(HOST_DIR)/" from the paths that contain it.
$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake:
@mkdir -p $(@D)
sed \
- -e 's:@@HOST_DIR@@:$(call qstrip,$(HOST_DIR)):' \
- -e 's:@@STAGING_DIR@@:$(call qstrip,$(STAGING_DIR)):' \
+ -e 's:@@STAGING_SUBDIR@@:$(call qstrip,$(STAGING_SUBDIR)):' \
-e 's:@@TARGET_CFLAGS@@:$(call qstrip,$(TARGET_CFLAGS)):' \
-e 's:@@TARGET_CXXFLAGS@@:$(call qstrip,$(TARGET_CXXFLAGS)):' \
- -e 's:@@TARGET_CC_NOCCACHE@@:$(call qstrip,$(TARGET_CC_NOCCACHE)):' \
- -e 's:@@TARGET_CXX_NOCCACHE@@:$(call qstrip,$(TARGET_CXX_NOCCACHE)):' \
+ -e 's:@@TARGET_CC_NOCCACHE@@:$(subst $(HOST_DIR)/,,$(call qstrip,$(TARGET_CC_NOCCACHE))):' \
+ -e 's:@@TARGET_CXX_NOCCACHE@@:$(subst $(HOST_DIR)/,,$(call qstrip,$(TARGET_CXX_NOCCACHE))):' \
$(TOPDIR)/support/misc/toolchainfile.cmake.in \
> $@
OpenPOWER on IntegriCloud