blob: af39071cf3f5a1cde8f2484f9a014b6d1f451643 [file] [log] [blame]
Arnout Vandecappellef6ae2432015-10-04 13:28:41 +01001# 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'
6ifeq ($(findstring mips,$(HOSTARCH)),mips)
7TOOLCHAIN_WRAPPER_HASH_STYLE = sysv
8else
9TOOLCHAIN_WRAPPER_HASH_STYLE = both
10endif
11
12TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
13TOOLCHAIN_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.
Yann E. MORIN32e26362015-10-21 23:21:07 +020017TOOLCHAIN_WRAPPER_OPTS = \
18 $(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma))
19TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)'
Arnout Vandecappellef6ae2432015-10-04 13:28:41 +010020
Arnout Vandecappelled82f69c2015-10-04 16:23:56 +010021ifeq ($(BR2_CCACHE),y)
22TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
23endif
24
Ray Kinsella968f5d52015-10-19 11:02:52 +000025ifeq ($(BR2_x86_x1000),y)
26TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX
27endif
28
Arnout Vandecappelle1e97b272015-10-04 16:25:32 +010029ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
30TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
31endif
32
Arnout Vandecappellef6ae2432015-10-04 13:28:41 +010033# For simplicity, build directly into the install location
34define TOOLCHAIN_BUILD_WRAPPER
35 $(Q)mkdir -p $(HOST_DIR)/usr/bin
36 $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
37 -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
38 toolchain/toolchain-wrapper.c \
39 -o $(HOST_DIR)/usr/bin/toolchain-wrapper
40endef