1
0

Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #
  2. # Copyright (C) 2006-2013 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=binutils
  9. PKG_VERSION:=$(call qstrip,$(CONFIG_BINUTILS_VERSION))
  10. BIN_VERSION:=$(PKG_VERSION)
  11. PKG_SOURCE_URL:=@GNU/binutils/
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  13. TAR_OPTIONS += --exclude='*.rej'
  14. ifeq ($(PKG_VERSION),2.29.1)
  15. PKG_HASH:=e7010a46969f9d3e53b650a518663f98a5dde3c3ae21b7d71e5e6803bc36b577
  16. endif
  17. ifeq ($(PKG_VERSION),2.31.1)
  18. PKG_HASH:=5d20086ecf5752cc7d9134246e9588fa201740d540f7eb84d795b1f7a93bca86
  19. endif
  20. ifeq ($(PKG_VERSION),2.32)
  21. PKG_HASH:=0ab6c55dd86a92ed561972ba15b9b70a8b9f75557f896446c82e8b36e473ee04
  22. endif
  23. ifneq ($(CONFIG_BINUTILS_VERSION_2_29_ARC),)
  24. PKG_REV:=arc-2017.09-release
  25. PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/$(PKG_REV)/
  26. PKG_SOURCE:=$(PKG_NAME)-$(PKG_REV).tar.gz
  27. PKG_HASH:=2ea086fd5521e942926dd6ff6922ce31c29ee7ffc754fca3d06385e0f27600f8
  28. BINUTILS_DIR:=$(PKG_NAME)-gdb-$(PKG_REV)
  29. HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
  30. endif
  31. HOST_BUILD_PARALLEL:=1
  32. PATCH_DIR:=./patches/$(PKG_VERSION)
  33. include $(INCLUDE_DIR)/toolchain-build.mk
  34. BINUTILS_CONFIGURE:= \
  35. ./configure \
  36. --prefix=$(TOOLCHAIN_DIR) \
  37. --build=$(GNU_HOST_NAME) \
  38. --host=$(GNU_HOST_NAME) \
  39. --target=$(REAL_GNU_TARGET_NAME) \
  40. --with-sysroot=$(TOOLCHAIN_DIR) \
  41. --enable-deterministic-archives \
  42. --enable-plugins \
  43. --disable-multilib \
  44. --disable-werror \
  45. --disable-nls \
  46. --disable-sim \
  47. --disable-gdb \
  48. $(GRAPHITE_CONFIGURE) \
  49. $(SOFT_FLOAT_CONFIG_OPTION) \
  50. $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
  51. ifneq ($(CONFIG_SSP_SUPPORT),)
  52. BINUTILS_CONFIGURE+= \
  53. --enable-libssp
  54. else
  55. BINUTILS_CONFIGURE+= \
  56. --disable-libssp
  57. endif
  58. ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
  59. BINUTILS_CONFIGURE+= \
  60. --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
  61. endif
  62. define Host/Prepare
  63. $(call Host/Prepare/Default)
  64. ln -snf $(notdir $(HOST_BUILD_DIR)) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  65. $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
  66. $(SED) 's, " Linaro.*,,' $(HOST_BUILD_DIR)/bfd/version.h
  67. endef
  68. define Host/Configure
  69. (cd $(HOST_BUILD_DIR); \
  70. $(BINUTILS_CONFIGURE) \
  71. );
  72. endef
  73. define Host/Compile
  74. +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
  75. endef
  76. define Host/Install
  77. mkdir -p $(TOOLCHAIN_DIR)/initial
  78. $(MAKE) -C $(HOST_BUILD_DIR) \
  79. prefix=$(TOOLCHAIN_DIR)/initial \
  80. install
  81. $(MAKE) -C $(HOST_BUILD_DIR) \
  82. prefix=$(TOOLCHAIN_DIR) \
  83. install
  84. $(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
  85. $(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
  86. $(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(HOST_BUILD_PREFIX)/bin/readelf
  87. # ARC gcc requires extlib.
  88. # If extlib is not available in "initial" folder
  89. # initial gcc will fail to build libc.
  90. if [ -d $(TOOLCHAIN_DIR)/extlib ]; then \
  91. $(CP) -r $(TOOLCHAIN_DIR)/extlib $(TOOLCHAIN_DIR)/initial/; \
  92. fi
  93. endef
  94. define Host/Clean
  95. rm -rf \
  96. $(HOST_BUILD_DIR) \
  97. $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  98. endef
  99. $(eval $(call HostBuild))