]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - toolchain/toolchain-wrapper.mk
toolchain/wrapper: fix code style
[coffee/buildroot.git] / toolchain / toolchain-wrapper.mk
1 ################################################################################
2 #
3 # definition of the toolchain wrapper build commands
4 #
5 ################################################################################
6
7 # We use --hash-style=both to increase the compatibility of the generated
8 # binary with older platforms, except for MIPS, where the only acceptable
9 # hash style is 'sysv'
10 ifeq ($(findstring mips,$(HOSTARCH)),mips)
11 TOOLCHAIN_WRAPPER_HASH_STYLE = sysv
12 else
13 TOOLCHAIN_WRAPPER_HASH_STYLE = both
14 endif
15
16 TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS)
17 TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
18
19 # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
20 # separate argument when used in execv() by the toolchain wrapper.
21 TOOLCHAIN_WRAPPER_OPTS = \
22         $(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma))
23 TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)'
24
25 ifeq ($(BR2_CCACHE),y)
26 TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
27 endif
28
29 ifeq ($(BR2_x86_x1000),y)
30 TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX
31 endif
32
33 # Avoid FPU bug on XBurst CPUs
34 ifeq ($(BR2_mips_xburst),y)
35 TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
36 endif
37
38 ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
39 TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
40 endif
41
42 define TOOLCHAIN_WRAPPER_BUILD
43         $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
44                 -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
45                 toolchain/toolchain-wrapper.c \
46                 -o $(@D)/toolchain-wrapper
47 endef
48
49 define TOOLCHAIN_WRAPPER_INSTALL
50         $(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \
51                 $(HOST_DIR)/bin/toolchain-wrapper
52 endef