summaryrefslogtreecommitdiff
path: root/toolchain/toolchain-wrapper.mk
diff options
context:
space:
mode:
authorArnout Vandecappelle <arnout@mind.be>2015-10-04 13:28:41 +0100
committerPeter Korsgaard <peter@korsgaard.com>2015-10-04 18:22:19 +0200
commitf6ae24379b551cbfc6447b25a241ffa76d366ddc (patch)
tree16214940d57b612b6cd35d8859bff1cf2dac857a /toolchain/toolchain-wrapper.mk
parentad9c7ee554bb8b6f69429e8d1585d0555a42f06c (diff)
toolchain-external: move wrapper to toolchain directory
The toolchain wrapper will be reused for the internal toolchain, so it belongs in the toolchain directory. Also, the ext- prefix is removed from it. The build commands are moved to a new toolchain-wrapper.mk. The wrapper arguments that are also relevant for the internal toolchain wrapper are moved to toolchain-wrapper.mk, the rest stays in toolchain-external.mk. While we're at it, move the building of the toolchain wrapper to the build step of toolchain-external. There is no specific reason to do this, other than that it fits better semantically. Also remove the MESSAGE call, otherwise we'd see: >>> toolchain-external undefined Building >>> toolchain-external undefined Building toolchain wrapper /usr/bin/gcc ... Having an extra "Building toolchain wrapper' message is pointless. The useless condition on $(BR2_TARGET_OPTIMIZATION) is removed. It was always true because it wasn't qstrip'ped first, so clearly it works without that condition as well. Also rewrapped some comments and removed the 'external' reference. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Cc: Fabio Porcedda <fabio.porcedda@gmail.com> Cc: Jérôme Oufella <jerome.oufella@savoirfairelinux.com> Reviewed-by: Romain Naour <romain.naour@openwide.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'toolchain/toolchain-wrapper.mk')
-rw-r--r--toolchain/toolchain-wrapper.mk26
1 files changed, 26 insertions, 0 deletions
diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
new file mode 100644
index 000000000..899947de7
--- /dev/null
+++ b/toolchain/toolchain-wrapper.mk
@@ -0,0 +1,26 @@
+# This file contains the definition of the toolchain wrapper build commands
+
+# We use --hash-style=both to increase the compatibility of the generated
+# binary with older platforms, except for MIPS, where the only acceptable
+# hash style is 'sysv'
+ifeq ($(findstring mips,$(HOSTARCH)),mips)
+TOOLCHAIN_WRAPPER_HASH_STYLE = sysv
+else
+TOOLCHAIN_WRAPPER_HASH_STYLE = both
+endif
+
+TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
+TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
+
+# We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
+# separate argument when used in execv() by the toolchain wrapper.
+TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)",)'
+
+# For simplicity, build directly into the install location
+define TOOLCHAIN_BUILD_WRAPPER
+ $(Q)mkdir -p $(HOST_DIR)/usr/bin
+ $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
+ -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
+ toolchain/toolchain-wrapper.c \
+ -o $(HOST_DIR)/usr/bin/toolchain-wrapper
+endef