Makefile 2.2 KB

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