1
0

Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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.bz2
  13. ifeq ($(PKG_VERSION),2.25.1)
  14. PKG_HASH:=b5b14added7d78a8d1ca70b5cb75fef57ce2197264f4f5835326b0df22ac9f22
  15. endif
  16. ifeq ($(PKG_VERSION),2.26.1)
  17. PKG_HASH:=39c346c87aa4fb14b2f786560aec1d29411b6ec34dce3fe7309fe3dd56949fd8
  18. endif
  19. ifeq ($(PKG_VERSION),2.27)
  20. PKG_HASH:=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
  21. endif
  22. ifeq ($(findstring linaro, $(CONFIG_BINUTILS_VERSION)),linaro)
  23. PKG_SOURCE_URL:=https://releases.linaro.org/14.09/components/toolchain/binutils-linaro/
  24. PKG_REV:=2.24.0-2014.09
  25. PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.xz
  26. PKG_HASH:=e8bdf80bd6a5f3fc7df53245dfc0a678803d4f19c1c7ba2af3f98c8249e612b0
  27. BINUTILS_DIR:=$(PKG_NAME)-linaro-$(PKG_REV)
  28. HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
  29. endif
  30. ifneq ($(CONFIG_BINUTILS_VERSION_2_26_ARC),)
  31. PKG_SOURCE_URL:=https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb/archive/arc-2016.03/
  32. PKG_REV:=2016.03
  33. PKG_SOURCE:=$(PKG_NAME)-arc-$(PKG_REV).tar.gz
  34. PKG_HASH:=6583a0cd5c7251dc895a47c797a9b011e466c23377d2ca7548a707fdb918fba1
  35. BINUTILS_DIR:=$(PKG_NAME)-gdb-arc-$(PKG_REV)
  36. HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
  37. endif
  38. HOST_BUILD_PARALLEL:=1
  39. PATCH_DIR:=./patches/$(PKG_VERSION)
  40. REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
  41. include $(INCLUDE_DIR)/toolchain-build.mk
  42. BINUTILS_CONFIGURE:= \
  43. ./configure \
  44. --prefix=$(TOOLCHAIN_DIR) \
  45. --build=$(GNU_HOST_NAME) \
  46. --host=$(GNU_HOST_NAME) \
  47. --target=$(REAL_GNU_TARGET_NAME) \
  48. --with-sysroot=$(TOOLCHAIN_DIR) \
  49. --enable-deterministic-archives \
  50. --enable-plugins \
  51. --disable-multilib \
  52. --disable-werror \
  53. --disable-nls \
  54. --disable-sim \
  55. --disable-gdb \
  56. $(GRAPHITE_CONFIGURE) \
  57. $(SOFT_FLOAT_CONFIG_OPTION) \
  58. $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
  59. ifneq ($(CONFIG_SSP_SUPPORT),)
  60. BINUTILS_CONFIGURE+= \
  61. --enable-libssp
  62. else
  63. BINUTILS_CONFIGURE+= \
  64. --disable-libssp
  65. endif
  66. ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
  67. BINUTILS_CONFIGURE+= \
  68. --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
  69. endif
  70. define Host/Prepare
  71. $(call Host/Prepare/Default)
  72. ln -snf $(notdir $(HOST_BUILD_DIR)) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  73. $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
  74. $(SED) 's, " Linaro.*,,' $(HOST_BUILD_DIR)/bfd/version.h
  75. endef
  76. define Host/Configure
  77. (cd $(HOST_BUILD_DIR); \
  78. $(BINUTILS_CONFIGURE) \
  79. );
  80. endef
  81. define Host/Compile
  82. +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
  83. endef
  84. define Host/Install
  85. mkdir -p $(TOOLCHAIN_DIR)/initial
  86. $(MAKE) -C $(HOST_BUILD_DIR) \
  87. prefix=$(TOOLCHAIN_DIR)/initial \
  88. install
  89. $(MAKE) -C $(HOST_BUILD_DIR) \
  90. prefix=$(TOOLCHAIN_DIR) \
  91. install
  92. $(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
  93. $(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
  94. $(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
  95. # ARC gcc requires extlib.
  96. # If extlib is not available in "initial" folder
  97. # initial gcc will fail to build libc.
  98. if [ -d $(TOOLCHAIN_DIR)/extlib ]; then \
  99. $(CP) -r $(TOOLCHAIN_DIR)/extlib $(TOOLCHAIN_DIR)/initial/; \
  100. fi
  101. endef
  102. define Host/Clean
  103. rm -rf \
  104. $(HOST_BUILD_DIR) \
  105. $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  106. endef
  107. $(eval $(call HostBuild))