]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - toolchain/toolchain-wrapper.mk
7f72a0cadec9201bfefdb153dfa9387a8e1f5551
[coffee/buildroot.git] / toolchain / toolchain-wrapper.mk
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_OPTS = \
18         $(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma))
19 TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)'
20
21 ifeq ($(BR2_CCACHE),y)
22 TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
23 endif
24
25 ifeq ($(BR2_x86_x1000),y)
26 TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX
27 endif
28
29 # Avoid FPU bug on XBurst CPUs
30 ifeq ($(BR2_mips_xburst),y)
31 TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
32 endif
33
34 ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
35 TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
36 endif
37
38 define TOOLCHAIN_WRAPPER_BUILD
39         $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
40                 -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
41                 toolchain/toolchain-wrapper.c \
42                 -o $(@D)/toolchain-wrapper
43 endef
44
45 define TOOLCHAIN_WRAPPER_INSTALL
46         $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \
47                 $(HOST_DIR)/bin/toolchain-wrapper
48 endef