Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. GCC_VARIANT:=final
  2. include ../common.mk
  3. GCC_CONFIGURE += \
  4. --enable-languages=$(TARGET_LANGUAGES) \
  5. --enable-shared \
  6. --enable-threads \
  7. --with-slibdir=$(TOOLCHAIN_DIR)/lib
  8. ifneq ($(CONFIG_GCC_VERSION_4_5)$(CONFIG_GCC_VERSION_4_6),)
  9. GCC_CONFIGURE += \
  10. --enable-lto \
  11. --with-libelf=$(TOPDIR)/staging_dir/host
  12. endif
  13. ifneq ($(CONFIG_TLS_SUPPORT),)
  14. GCC_CONFIGURE += \
  15. --enable-tls
  16. else
  17. GCC_CONFIGURE += \
  18. --disable-tls
  19. endif
  20. ifneq ($(CONFIG_SJLJ_EXCEPTIONS),)
  21. GCC_CONFIGURE += \
  22. --enable-sjlj-exceptions
  23. endif
  24. define Host/Configure
  25. mkdir -p $(GCC_BUILD_DIR) $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)
  26. # Important! Required for limits.h to be fixed.
  27. rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
  28. ln -sf ../include $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
  29. rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
  30. ln -sf ../lib $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
  31. $(if $(CONFIG_mips64)$(CONFIG_mips64el)$(CONFIG_x86_64),ln -sf ../lib64 $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib64)
  32. (cd $(GCC_BUILD_DIR) && rm -f config.cache; \
  33. $(GCC_CONFIGURE) \
  34. );
  35. endef
  36. define Host/Compile
  37. $(GCC_MAKE) -C $(GCC_BUILD_DIR) all
  38. endef
  39. define SetupExtraArch
  40. for app in $(TOOLCHAIN_DIR)/bin/$(OPTIMIZE_FOR_CPU)*-{gcc,gcc-*,g++}; do \
  41. [ -e $$$$app ] || continue; \
  42. old_base=$$$$(basename $$$$app); \
  43. new_base=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-$$$${old_base##$(OPTIMIZE_FOR_CPU)-}; \
  44. sed -e "s/@CC_BASE@/$$$$old_base/" \
  45. -e 's/@EXTRA_ARCH_OPTS@/$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_OPTS))/' \
  46. ../files/alternate-arch-cc.in > \
  47. $(TOOLCHAIN_DIR)/bin/$$$$new_base; \
  48. chmod a+x $(TOOLCHAIN_DIR)/bin/$$$$new_base; \
  49. done
  50. endef
  51. define Host/Install
  52. $(_SINGLE)$(GCC_MAKE) -C $(GCC_BUILD_DIR) install
  53. # Set up the symlinks to enable lying about target name.
  54. set -e; \
  55. (cd $(TOOLCHAIN_DIR); \
  56. ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
  57. cd bin; \
  58. for app in $(REAL_GNU_TARGET_NAME)-* ; do \
  59. ln -sf $$$${app} \
  60. $(GNU_TARGET_NAME)$$$${app##$(REAL_GNU_TARGET_NAME)}; \
  61. done; \
  62. );
  63. $(if $(CONFIG_EXTRA_TARGET_ARCH),$(call SetupExtraArch))
  64. endef
  65. $(eval $(call HostBuild))