Makefile 3.3 KB

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