Makefile 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. ifeq ($(findstring linaro, $(CONFIG_BINUTILS_VERSION)),linaro)
  12. PKG_SOURCE_URL:=https://releases.linaro.org/14.09/components/toolchain/binutils-linaro/
  13. PKG_REV:=2.24.0-2014.09
  14. PKG_SOURCE:=$(PKG_NAME)-linaro-$(PKG_REV).tar.xz
  15. PKG_MD5SUM:=8f9b2b2e049d59b1b86ce9657802a353
  16. BINUTILS_DIR:=$(PKG_NAME)-linaro-$(PKG_REV)
  17. HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(BINUTILS_DIR)
  18. else
  19. PKG_SOURCE_URL:=@GNU/binutils/
  20. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  21. ifeq ($(PKG_VERSION),2.20.1)
  22. PKG_MD5SUM:=9cdfb9d6ec0578c166d3beae5e15c4e5
  23. endif
  24. endif
  25. HOST_BUILD_PARALLEL:=1
  26. PATCH_DIR:=./patches/$(PKG_VERSION)
  27. REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
  28. include $(INCLUDE_DIR)/toolchain-build.mk
  29. BINUTILS_CONFIGURE:= \
  30. ./configure \
  31. --prefix=$(TOOLCHAIN_DIR) \
  32. --build=$(GNU_HOST_NAME) \
  33. --host=$(GNU_HOST_NAME) \
  34. --target=$(REAL_GNU_TARGET_NAME) \
  35. --with-sysroot=$(TOOLCHAIN_DIR) \
  36. --disable-multilib \
  37. --disable-werror \
  38. --disable-nls \
  39. $(GRAPHITE_CONFIGURE) \
  40. $(SOFT_FLOAT_CONFIG_OPTION) \
  41. $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
  42. ifneq ($(CONFIG_SSP_SUPPORT),)
  43. BINUTILS_CONFIGURE+= \
  44. --enable-libssp
  45. else
  46. BINUTILS_CONFIGURE+= \
  47. --disable-libssp
  48. endif
  49. ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
  50. BINUTILS_CONFIGURE+= \
  51. --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
  52. endif
  53. define Host/Prepare
  54. $(call Host/Prepare/Default)
  55. ln -snf $(notdir $(HOST_BUILD_DIR)) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  56. $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
  57. $(SED) 's, " Linaro.*,,' $(HOST_BUILD_DIR)/bfd/version.h
  58. endef
  59. define Host/Configure
  60. (cd $(HOST_BUILD_DIR); \
  61. $(BINUTILS_CONFIGURE) \
  62. );
  63. endef
  64. define Host/Compile
  65. +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
  66. endef
  67. define Host/Install
  68. mkdir -p $(TOOLCHAIN_DIR)/initial
  69. $(MAKE) -C $(HOST_BUILD_DIR) \
  70. prefix=$(TOOLCHAIN_DIR)/initial \
  71. install
  72. $(call FixupLibdir,$(TOOLCHAIN_DIR)/initial)
  73. $(RM) $(TOOLCHAIN_DIR)/initial/lib/libiberty.a
  74. $(CP) $(TOOLCHAIN_DIR)/initial/. $(TOOLCHAIN_DIR)/
  75. $(CP) $(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
  76. endef
  77. define Host/Clean
  78. rm -rf \
  79. $(HOST_BUILD_DIR) \
  80. $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
  81. endef
  82. $(eval $(call HostBuild))