Makefile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_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_XTENSA).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_TOOLCHAIN_BINUTILS_GIT),y)
  60. ifeq ($(ADK_TARGET_ARCH_H8300),y)
  61. $(INSTALL_DIR) $(STAGING_TARGET_DIR)/usr/lib/ldscripts
  62. $(CP) $(WRKBUILD)/ld/ldscripts/* $(STAGING_TARGET_DIR)/usr/lib/ldscripts/
  63. endif
  64. endif
  65. ifeq ($(ADK_TARGET_USE_GOLD),y)
  66. (cd $(TOOLCHAIN_DIR)/usr/bin && \
  67. ln -sf $(GNU_TARGET_NAME)-ld.gold $(GNU_TARGET_NAME)-ld)
  68. else
  69. ifeq (ADK_TOOLCHAIN_BINUTILS_2_20_1),)
  70. (cd $(TOOLCHAIN_DIR)/usr/bin && \
  71. ln -sf $(GNU_TARGET_NAME)-ld.bfd $(GNU_TARGET_NAME)-ld)
  72. endif
  73. endif
  74. touch $@
  75. include ${ADK_TOPDIR}/mk/toolchain.mk