Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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),)
  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. define Host/Configure
  21. mkdir -p $(GCC_BUILD_DIR) $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)
  22. # Important! Required for limits.h to be fixed.
  23. rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
  24. ln -sf ../include $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
  25. rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
  26. ln -sf ../lib $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
  27. $(if $(CONFIG_mips64)$(CONFIG_mips64el)$(CONFIG_x86_64),ln -sf ../lib64 $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib64)
  28. (cd $(GCC_BUILD_DIR) && rm -f config.cache; \
  29. $(GCC_CONFIGURE) \
  30. );
  31. endef
  32. define Host/Compile
  33. $(GCC_MAKE) -C $(GCC_BUILD_DIR) all
  34. endef
  35. define SetupExtraArch
  36. for app in $(TOOLCHAIN_DIR)/bin/$(OPTIMIZE_FOR_CPU)*-{gcc,gcc-*,g++}; do \
  37. [ -e $$$$app ] || continue; \
  38. old_base=$$$$(basename $$$$app); \
  39. new_base=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-$$$${old_base##$(OPTIMIZE_FOR_CPU)-}; \
  40. sed -e "s/@CC_BASE@/$$$$old_base/" \
  41. -e 's/@EXTRA_ARCH_OPTS@/$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_OPTS))/' \
  42. ../files/alternate-arch-cc.in > \
  43. $(TOOLCHAIN_DIR)/bin/$$$$new_base; \
  44. chmod a+x $(TOOLCHAIN_DIR)/bin/$$$$new_base; \
  45. done
  46. endef
  47. define Host/Install
  48. $(_SINGLE)$(GCC_MAKE) -C $(GCC_BUILD_DIR) install
  49. # Set up the symlinks to enable lying about target name.
  50. set -e; \
  51. (cd $(TOOLCHAIN_DIR); \
  52. ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
  53. cd bin; \
  54. for app in $(REAL_GNU_TARGET_NAME)-* ; do \
  55. ln -sf $$$${app} \
  56. $(GNU_TARGET_NAME)$$$${app##$(REAL_GNU_TARGET_NAME)}; \
  57. done; \
  58. );
  59. $(if $(CONFIG_EXTRA_TARGET_ARCH),$(call SetupExtraArch))
  60. endef
  61. $(eval $(call HostBuild))