build system refactoring in preparation for allowing packages to do host-build steps
[openwrt/svn-archive/archive.git] / toolchain / binutils / Makefile
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
12 PKG_SOURCE_URL:=@GNU/binutils/
13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
14
15 ifeq ($(PKG_VERSION),2.17)
16 PKG_MD5SUM:=e26e2e06b6e4bf3acf1dc8688a94c0d1
17 endif
18 ifeq ($(PKG_VERSION),2.18)
19 PKG_MD5SUM:=9d22ee4dafa3a194457caf4706f9cf01
20 endif
21 ifeq ($(PKG_VERSION),2.19)
22 PKG_MD5SUM:=17a52219dee5a76c1a9d9b0bfd337d66
23 endif
24 ifeq ($(PKG_VERSION),2.19.1)
25 PKG_MD5SUM:=09a8c5821a2dfdbb20665bc0bd680791
26 endif
27
28 PATCH_DIR:=./patches/$(PKG_VERSION)
29
30 REAL_STAGING_DIR_HOST:=$(STAGING_DIR_HOST)
31 STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
32 BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
33
34 override CONFIG_AUTOREBUILD=
35
36 include $(INCLUDE_DIR)/host-build.mk
37
38 BINUTILS_CONFIGURE:= \
39 ./configure \
40 --prefix=$(TOOLCHAIN_DIR)/usr \
41 --build=$(GNU_HOST_NAME) \
42 --host=$(GNU_HOST_NAME) \
43 --target=$(REAL_GNU_TARGET_NAME) \
44 --with-sysroot=$(TOOLCHAIN_DIR) \
45 --disable-multilib \
46 --disable-werror \
47 --disable-nls \
48 $(SOFT_FLOAT_CONFIG_OPTION) \
49 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS)) \
50
51 ifneq ($(CONFIG_SSP_SUPPORT),)
52 BINUTILS_CONFIGURE+= \
53 --enable-libssp
54 else
55 BINUTILS_CONFIGURE+= \
56 --disable-libssp
57 endif
58
59 ifneq ($(CONFIG_EXTRA_TARGET_ARCH),)
60 BINUTILS_CONFIGURE+= \
61 --enable-targets=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-linux-$(TARGET_SUFFIX)
62 endif
63
64 define Host/Prepare
65 $(call Host/Prepare/Default)
66 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
67 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
68 endef
69
70 define Host/Configure
71 (cd $(HOST_BUILD_DIR); \
72 $(BINUTILS_CONFIGURE) \
73 );
74 endef
75
76 define Host/Compile
77 $(MAKE) -C $(HOST_BUILD_DIR) all
78 endef
79
80 define Host/Install
81 $(MAKE) -C $(HOST_BUILD_DIR) install
82 $(CP) $(TOOLCHAIN_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-readelf $(REAL_STAGING_DIR_HOST)/bin/readelf
83 endef
84
85 define Host/Clean
86 rm -rf \
87 $(HOST_BUILD_DIR) \
88 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
89 endef
90
91 $(eval $(call HostBuild))