Makefile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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_X86_64)$(ADK_TARGET_CPU_CF),)
  27. CONFOPTS+= --disable-multilib
  28. else
  29. CONFOPTS+= --enable-multilib
  30. endif
  31. ifeq (${ADK_MAKE_PARALLEL},y)
  32. BINUTILS_MAKEOPTS+= -j${ADK_MAKE_JOBS}
  33. endif
  34. ifeq (${ADK_STATIC_TOOLCHAIN},y)
  35. BINUTILS_STATIC_MAKEOPTS+=LDFLAGS='$(HOST_STATIC_LLDFLAGS)'
  36. endif
  37. $(WRKBUILD)/.configured:
  38. ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
  39. tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE).tar \
  40. --strip-components=1 -C $(WRKSRC) binutils
  41. endif
  42. (cd $(WRKBUILD); PATH='$(HOST_PATH)' MAKEINFO=true \
  43. $(WRKBUILD)/configure \
  44. --prefix=$(TOOLCHAIN_DIR)/usr \
  45. --target=$(GNU_TARGET_NAME) \
  46. --with-sysroot=$(STAGING_TARGET_DIR) \
  47. --disable-dependency-tracking \
  48. --disable-libtool-lock \
  49. --disable-nls \
  50. --disable-sim \
  51. --disable-gdb \
  52. --disable-werror \
  53. --disable-install-libiberty \
  54. ${CONFOPTS} \
  55. );
  56. PATH='$(HOST_PATH)' $(MAKE) ${BINUTILS_MAKEOPTS} MAKEINFO=true -C $(WRKBUILD) configure-host
  57. touch $@
  58. $(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
  59. PATH='$(HOST_PATH)' $(MAKE) ${BINUTILS_MAKEOPTS} MAKEINFO=true ${BINUTILS_STATIC_MAKEOPTS} -C $(WRKBUILD) all
  60. touch $@
  61. $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
  62. PATH='$(HOST_PATH)' $(MAKE) MAKEINFO=true -C $(WRKBUILD) install
  63. ifeq ($(ADK_TARGET_ARCH_H8300)$(ADK_TARGET_ARCH_NDS32)$(ADK_TARGET_CPU_SH_J2),y)
  64. $(INSTALL_DIR) $(STAGING_TARGET_DIR)/usr/lib/ldscripts
  65. $(CP) $(WRKBUILD)/ld/ldscripts/* $(STAGING_TARGET_DIR)/usr/lib/ldscripts/
  66. endif
  67. ifeq ($(ADK_TARGET_USE_GOLD),y)
  68. (cd $(TOOLCHAIN_DIR)/usr/bin && \
  69. ln -sf $(GNU_TARGET_NAME)-ld.gold $(GNU_TARGET_NAME)-ld)
  70. else
  71. ifeq (ADK_TOOLCHAIN_BINUTILS_2_20_1),)
  72. (cd $(TOOLCHAIN_DIR)/usr/bin && \
  73. ln -sf $(GNU_TARGET_NAME)-ld.bfd $(GNU_TARGET_NAME)-ld)
  74. endif
  75. endif
  76. touch $@
  77. include ${ADK_TOPDIR}/mk/toolchain.mk