| 1 | # |
| 2 | # Copyright (C) 2006-2009 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 | |
| 9 | PKG_NAME:=binutils |
| 10 | PKG_VERSION:=$(call qstrip,$(CONFIG_BINUTILS_VERSION)) |
| 11 | BIN_VERSION:=$(PKG_VERSION) |
| 12 | |
| 13 | PKG_SOURCE_URL:=@GNU/binutils/ |
| 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 |
| 15 | |
| 16 | ifeq ($(PKG_VERSION),2.18) |
| 17 | PKG_MD5SUM:=9d22ee4dafa3a194457caf4706f9cf01 |
| 18 | endif |
| 19 | ifeq ($(PKG_VERSION),2.19.1) |
| 20 | PKG_MD5SUM:=09a8c5821a2dfdbb20665bc0bd680791 |
| 21 | endif |
| 22 | ifeq ($(PKG_VERSION),2.19.1+cs) |
| 23 | BIN_VERSION:=20090205 |
| 24 | PKG_SOURCE:=$(PKG_NAME)-$(BIN_VERSION).tar.bz2 |
| 25 | PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources |
| 26 | PKG_MD5SUM:=040740e8c864dd1a15886753f9c0bc0b |
| 27 | HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/binutils-$(BIN_VERSION) |
| 28 | endif |
| 29 | ifeq ($(PKG_VERSION),2.20) |
| 30 | PKG_MD5SUM:=ee2d3e996e9a2d669808713360fa96f8 |
| 31 | endif |
| 32 | ifeq ($(PKG_VERSION),2.20.1) |
| 33 | PKG_MD5SUM:=9cdfb9d6ec0578c166d3beae5e15c4e5 |
| 34 | endif |
| 35 | |
| 36 | PATCH_DIR:=./patches/$(PKG_VERSION) |
| 37 | |
| 38 | REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST) |
| 39 | |
| 40 | include $(INCLUDE_DIR)/toolchain-build.mk |
| 41 | |
| 42 | BINUTILS_CONFIGURE:= \ |
| 43 | ./configure \ |
| 44 | --prefix=$(TOOLCHAIN_DIR)/usr \ |
| 45 | --build=$(GNU_HOST_NAME) \ |
| 46 | --host=$(GNU_HOST_NAME) \ |
| 47 | --target=$(REAL_GNU_TARGET_NAME) \ |
| 48 | --with-sysroot=$(TOOLCHAIN_DIR) \ |
| 49 | --disable-multilib \ |
| 50 | --disable-werror \ |
| 51 | --disable-nls \ |
| 52 | $(if $(CONFIG_GCC_VERSION_4_4), \ |
| 53 | --with-ppl=$(REAL_STAGING_DIR_HOST) \ |
| 54 | --with-cloog=$(REAL_STAGING_DIR_HOST) \ |
| 55 | ) \ |
| 56 | $(SOFT_FLOAT_CONFIG_OPTION) \ |
| 57 | $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS)) \ |
| 58 | |
| 59 | ifneq ($(CONFIG_SSP_SUPPORT),) |
| 60 | BINUTILS_CONFIGURE+= \ |
| 61 | --enable-libssp |
| 62 | else |
| 63 | BINUTILS_CONFIGURE+= \ |
| 64 | --disable-libssp |
| 65 | endif |
| 66 | |
| 67 | ifneq ($(CONFIG_EXTRA_TARGET_ARCH),) |
| 68 | BINUTILS_CONFIGURE+= \ |
| 69 | --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX) |
| 70 | endif |
| 71 | |
| 72 | define Host/Prepare |
| 73 | $(call Host/Prepare/Default) |
| 74 | ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) |
| 75 | $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/ |
| 76 | endef |
| 77 | |
| 78 | define Host/Configure |
| 79 | (cd $(HOST_BUILD_DIR); \ |
| 80 | $(BINUTILS_CONFIGURE) \ |
| 81 | ); |
| 82 | endef |
| 83 | |
| 84 | define Host/Compile |
| 85 | $(MAKE) -C $(HOST_BUILD_DIR) all |
| 86 | endef |
| 87 | |
| 88 | define Host/Install |
| 89 | $(MAKE) -C $(HOST_BUILD_DIR) install |
| 90 | $(CP) $(TOOLCHAIN_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf |
| 91 | endef |
| 92 | |
| 93 | define Host/Clean |
| 94 | rm -rf \ |
| 95 | $(HOST_BUILD_DIR) \ |
| 96 | $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) |
| 97 | endef |
| 98 | |
| 99 | $(eval $(call HostBuild)) |
| 100 | |