toolchain-wrapper.mk 1.4 KB

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