Makefile 2.2 KB

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