Makefile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(ADK_TOPDIR)/rules.mk
  4. include Makefile.inc
  5. include ../rules.mk
  6. include ${ADK_TOPDIR}/mk/buildhlp.mk
  7. ifeq ($(ADK_TOOLCHAIN_WITH_SSP),y)
  8. CONFOPTS+= --enable-libssp
  9. else
  10. CONFOPTS+= --disable-libssp
  11. endif
  12. ifeq ($(ADK_TOOLCHAIN_WITH_LTO),y)
  13. CONFOPTS+= --enable-lto --enable-plugins
  14. else
  15. CONFOPTS+= --disable-lto --disable-plugins
  16. endif
  17. ifeq ($(ADK_TOOLCHAIN_WITH_GOLD),y)
  18. ifeq ($(ADK_TARGET_USE_GOLD),y)
  19. CONFOPTS+= --enable-gold=default
  20. else
  21. CONFOPTS+= --enable-gold
  22. endif
  23. else
  24. CONFOPTS+= --disable-gold
  25. endif
  26. ifeq ($(ADK_TARGET_ARCH_ARC),y)
  27. CONFOPTS+= --enable-lto --enable-plugins
  28. endif
  29. ifeq ($(ADK_TARGET_ARCH_X86_64)$(ADK_TARGET_CPU_CF),)
  30. CONFOPTS+= --disable-multilib
  31. else
  32. CONFOPTS+= --enable-multilib
  33. endif
  34. ifeq (${ADK_MAKE_PARALLEL},y)
  35. BINUTILS_MAKEOPTS+= -j${ADK_MAKE_JOBS}
  36. endif
  37. $(WRKBUILD)/.configured:
  38. ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
  39. ifeq ($(ADK_TARGET_ABI),)
  40. tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE).tar \
  41. --strip-components=1 -C $(WRKSRC) binutils
  42. else
  43. tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE)_$(ADK_TARGET_ABI).tar \
  44. --strip-components=1 -C $(WRKSRC) binutils
  45. endif
  46. endif
  47. (cd $(WRKBUILD); PATH='$(HOST_PATH)' \
  48. MAKEINFO=true \
  49. M4='${STAGING_HOST_DIR}/usr/bin/m4' \
  50. $(WRKBUILD)/configure \
  51. --prefix=$(TOOLCHAIN_DIR)/usr \
  52. --target=$(GNU_TARGET_NAME) \
  53. --with-sysroot=$(STAGING_TARGET_DIR) \
  54. --disable-dependency-tracking \
  55. --disable-libtool-lock \
  56. --disable-nls \
  57. --disable-sim \
  58. --disable-gdb \
  59. --enable-obsolete \
  60. --disable-werror \
  61. --disable-gprof \
  62. --disable-install-libiberty \
  63. ${CONFOPTS} \
  64. );
  65. PATH='$(HOST_PATH)' $(MAKE) ${BINUTILS_MAKEOPTS} MAKEINFO=true -C $(WRKBUILD) configure-host
  66. touch $@
  67. $(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
  68. PATH='$(HOST_PATH)' $(MAKE) ${BINUTILS_MAKEOPTS} MAKEINFO=true -C $(WRKBUILD) all
  69. touch $@
  70. $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
  71. PATH='$(HOST_PATH)' $(MAKE) MAKEINFO=true -C $(WRKBUILD) install
  72. ifeq ($(ADK_TARGET_ARCH_KVX)$(ADK_TARGET_ARCH_H8300)$(ADK_TARGET_ARCH_NDS32)$(ADK_TARGET_ARCH_SH),y)
  73. $(INSTALL_DIR) $(STAGING_TARGET_DIR)/usr/lib/ldscripts
  74. $(CP) $(WRKBUILD)/ld/ldscripts/* $(STAGING_TARGET_DIR)/usr/lib/ldscripts/
  75. endif
  76. ifeq ($(ADK_TARGET_USE_GOLD),y)
  77. (cd $(TOOLCHAIN_DIR)/usr/bin && \
  78. ln -sf $(GNU_TARGET_NAME)-ld.gold $(GNU_TARGET_NAME)-ld)
  79. else
  80. ifeq (ADK_TOOLCHAIN_BINUTILS_AVR32),)
  81. (cd $(TOOLCHAIN_DIR)/usr/bin && \
  82. ln -sf $(GNU_TARGET_NAME)-ld.bfd $(GNU_TARGET_NAME)-ld)
  83. endif
  84. endif
  85. touch $@
  86. include ${ADK_TOPDIR}/mk/toolchain.mk