packages/binutils: fix build for arm targets (closes #6978)
[openwrt/svn-archive/archive.git] / devel / binutils / Makefile
1 #
2 # Copyright (C) 2006-2010 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:=$(strip $(subst ",, $(CONFIG_BINUTILS_VERSION)))
11 #"))
12 PKG_RELEASE:=3
13
14 PKG_SOURCE_URL:=@GNU/binutils
15 PKG_SOURCE:=binutils-$(PKG_VERSION).tar.bz2
16 PKG_MD5SUM:=
17
18 PATCH_DIR:=$(TOPDIR)/toolchain/binutils/patches/$(PKG_VERSION)
19
20 PKG_FIXUP:=libtool
21 PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof binutils ld
22 PKG_INSTALL:=1
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/libbfd
27 SECTION:=devel
28 CATEGORY:=Development
29 TITLE:=libbfd
30 endef
31
32 define Package/binutils
33 SECTION:=devel
34 CATEGORY:=Development
35 TITLE:=binutils
36 DEPENDS:=+objdump
37 endef
38
39 define Package/objdump
40 SECTION:=devel
41 CATEGORY:=Development
42 TITLE:=objdump
43 DEPENDS:=+zlib +libbfd
44 endef
45
46 define Package/binutils/description
47 The Binutils package contains a linker, an assembler, and other tools for handling object files
48 endef
49
50 CONFIGURE_ARGS = \
51 --target=$(REAL_GNU_TARGET_NAME) \
52 --host=$(REAL_GNU_TARGET_NAME) \
53 --build=$(GNU_HOST_NAME) \
54 --with-sysroot=$(PKG_INSTALL_DIR) \
55 --prefix=/usr \
56 --disable-multilib \
57 --disable-werror \
58 --disable-nls \
59 $(SOFT_FLOAT_CONFIG_OPTION) \
60 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
61
62 TARGET_CFLAGS += $(FPIC)
63
64 define Build/Configure
65 $(call Build/Configure/Default)
66 $(call Build/Compile/Default, \
67 configure-bfd \
68 configure-binutils \
69 configure-etc \
70 configure-gas \
71 configure-gprof \
72 configure-intl \
73 configure-ld \
74 configure-libiberty \
75 configure-opcodes \
76 )
77 $(MAKE) -C $(PKG_BUILD_DIR)/bfd/po Makefile
78 endef
79
80 define Build/InstallDev
81 $(INSTALL_DIR) $(1)/usr/{lib,include}
82 $(CP) \
83 $(PKG_INSTALL_DIR)/usr/lib/* \
84 $(1)/usr/lib/
85 $(CP) \
86 $(PKG_BUILD_DIR)/include/*.h \
87 $(1)/usr/include/
88 $(CP) \
89 $(PKG_INSTALL_DIR)/usr/include/* \
90 $(1)/usr/include/
91 rm -f $(1)/usr/include/gdbm.h
92 endef
93
94 define Build/Compile
95 $(MAKE) -C $(PKG_BUILD_DIR)/bfd/doc/ CFLAGS="-I$(PKG_BUILD_DIR)/include" chew
96 $(call Build/Compile/Default)
97 endef
98
99 define Package/libbfd/install
100 $(INSTALL_DIR) $(1)/usr/lib
101 $(CP) \
102 $(PKG_INSTALL_DIR)/usr/lib/libopcodes-$(PKG_VERSION).so \
103 $(PKG_INSTALL_DIR)/usr/lib/libbfd-$(PKG_VERSION).so \
104 $(1)/usr/lib/
105 endef
106
107 define Package/objdump/install
108 $(INSTALL_DIR) $(1)/usr/bin
109 $(CP) $(PKG_INSTALL_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/objdump $(1)/usr/bin/
110 endef
111
112 define Package/binutils/install
113 $(INSTALL_DIR) $(1)/usr
114 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ $(1)/usr/
115 $(CP) $(PKG_INSTALL_DIR)/usr/$(REAL_GNU_TARGET_NAME) $(1)/usr
116 rm -f $(1)/usr/bin/objdump
117 endef
118
119 $(eval $(call BuildPackage,libbfd))
120 $(eval $(call BuildPackage,binutils))
121 $(eval $(call BuildPackage,objdump))