[packages] binutils: fix linking to libiberty (#9048)
[packages.git] / devel / binutils / Makefile
1 #
2 # Copyright (C) 2006-2011 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=binutils
11 PKG_VERSION:=$(strip $(subst ",, $(CONFIG_BINUTILS_VERSION)))
12 #"))
13 PKG_RELEASE:=3
14
15 PKG_SOURCE_URL:=@GNU/binutils
16 PKG_SOURCE:=binutils-$(PKG_VERSION).tar.bz2
17 PKG_MD5SUM:=
18
19 PATCH_DIR:=$(TOPDIR)/toolchain/binutils/patches/$(PKG_VERSION)
20
21 PKG_FIXUP:=autoreconf
22 PKG_LIBTOOL_PATHS:=. gas bfd opcodes gprof binutils ld libiberty gold intl
23 PKG_REMOVE_FILES:=libtool.m4
24 PKG_INSTALL:=1
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/binutils
29   SECTION:=devel
30   CATEGORY:=Development
31   TITLE:=binutils
32   DEPENDS:=+objdump
33 endef
34
35 define Package/objdump
36   SECTION:=devel
37   CATEGORY:=Development
38   TITLE:=objdump
39   DEPENDS:=+zlib 
40 endef
41
42 define Package/binutils/description
43   The Binutils package contains a linker, an assembler, and other tools for handling object files
44 endef
45
46 CONFIGURE_ARGS = \
47                 --target=$(REAL_GNU_TARGET_NAME) \
48                 --host=$(REAL_GNU_TARGET_NAME) \
49                 --build=$(GNU_HOST_NAME) \
50                 --with-sysroot=$(PKG_INSTALL_DIR) \
51                 --prefix=/usr \
52                 --disable-multilib \
53                 --disable-werror \
54                 --disable-nls \
55                 --enable-shared \
56                 $(SOFT_FLOAT_CONFIG_OPTION) \
57                 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
58
59 TARGET_CFLAGS += $(FPIC)
60 TARGET_LDFLAGS := -L$(PKG_BUILD_DIR)/libiberty $(TARGET_LDFLAGS)
61
62 define Build/Configure
63         $(call Build/Configure/Default)
64         $(call Build/Compile/Default, \
65                 configure-bfd \
66                 configure-binutils \
67                 configure-etc \
68                 configure-gas \
69                 configure-gprof \
70                 configure-intl \
71                 configure-ld \
72                 configure-libiberty \
73                 configure-opcodes \
74         )
75         $(MAKE) CFLAGS="$(TARGET_CFLAGS)"-C $(PKG_BUILD_DIR)/bfd/po Makefile
76 endef
77
78 define Build/InstallDev
79         $(INSTALL_DIR) $(1)/usr/{lib,include}
80         $(CP) \
81                 $(PKG_INSTALL_DIR)/usr/lib/* \
82                 $(1)/usr/lib/
83         $(CP) \
84                 $(PKG_BUILD_DIR)/include/*.h \
85                 $(1)/usr/include/
86         $(CP) \
87                 $(PKG_INSTALL_DIR)/usr/include/* \
88                 $(1)/usr/include/
89         rm -f $(1)/usr/include/gdbm.h
90 endef
91
92 define Build/Compile
93         $(MAKE) -C $(PKG_BUILD_DIR)/bfd/doc/ CFLAGS="-I$(PKG_BUILD_DIR)/include" chew
94         $(call Build/Compile/Default)
95 endef
96
97 define Package/objdump/install
98         $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
99         $(CP) $(PKG_INSTALL_DIR)/usr/bin/objdump $(1)/usr/bin/
100         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopcodes*.so $(1)/usr/lib/
101         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so $(1)/usr/lib/
102 endef
103
104 define Package/binutils/install
105         $(INSTALL_DIR) $(1)/usr
106         $(CP) $(PKG_INSTALL_DIR)/usr/bin/ $(1)/usr/
107         rm -f $(1)/usr/bin/objdump
108 endef
109
110 $(eval $(call BuildPackage,binutils))
111 $(eval $(call BuildPackage,objdump))