Arnout Vandecappelle | f6ae243 | 2015-10-04 13:28:41 +0100 | [diff] [blame] | 1 | # This file contains the definition of the toolchain wrapper build commands |
| 2 | |
| 3 | # We use --hash-style=both to increase the compatibility of the generated |
| 4 | # binary with older platforms, except for MIPS, where the only acceptable |
| 5 | # hash style is 'sysv' |
| 6 | ifeq ($(findstring mips,$(HOSTARCH)),mips) |
| 7 | TOOLCHAIN_WRAPPER_HASH_STYLE = sysv |
| 8 | else |
| 9 | TOOLCHAIN_WRAPPER_HASH_STYLE = both |
| 10 | endif |
| 11 | |
| 12 | TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS) |
| 13 | TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' |
| 14 | |
| 15 | # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a |
| 16 | # separate argument when used in execv() by the toolchain wrapper. |
| 17 | TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)",)' |
| 18 | |
Arnout Vandecappelle | d82f69c | 2015-10-04 16:23:56 +0100 | [diff] [blame] | 19 | ifeq ($(BR2_CCACHE),y) |
| 20 | TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE |
| 21 | endif |
| 22 | |
Arnout Vandecappelle | 1e97b27 | 2015-10-04 16:25:32 +0100 | [diff] [blame^] | 23 | ifeq ($(BR2_CCACHE_USE_BASEDIR),y) |
| 24 | TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"' |
| 25 | endif |
| 26 | |
Arnout Vandecappelle | f6ae243 | 2015-10-04 13:28:41 +0100 | [diff] [blame] | 27 | # For simplicity, build directly into the install location |
| 28 | define TOOLCHAIN_BUILD_WRAPPER |
| 29 | $(Q)mkdir -p $(HOST_DIR)/usr/bin |
| 30 | $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \ |
| 31 | -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \ |
| 32 | toolchain/toolchain-wrapper.c \ |
| 33 | -o $(HOST_DIR)/usr/bin/toolchain-wrapper |
| 34 | endef |