[packages/electric-fence] also build and stage static library - depends on GLIBC...
[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:=5
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                 --prefix=/usr \
51                 --disable-multilib \
52                 --disable-werror \
53                 --disable-nls \
54                 --enable-shared \
55                 $(SOFT_FLOAT_CONFIG_OPTION) \
56                 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
57
58 TARGET_CFLAGS += $(FPIC)
59 TARGET_LDFLAGS := -L$(PKG_BUILD_DIR)/libiberty $(TARGET_LDFLAGS)
60
61 define Build/Configure
62         $(call Build/Configure/Default)
63         $(call Build/Compile/Default, \
64                 configure-bfd \
65                 configure-binutils \
66                 configure-etc \
67                 configure-gas \
68                 configure-gprof \
69                 configure-intl \
70                 configure-ld \
71                 configure-libiberty \
72                 configure-opcodes \
73         )
74         $(MAKE) CFLAGS="$(TARGET_CFLAGS)" -C $(PKG_BUILD_DIR)/bfd/po Makefile
75 endef
76
77 define Build/InstallDev
78         $(INSTALL_DIR) $(1)/usr/{lib,include}
79         $(CP) \
80                 $(PKG_INSTALL_DIR)/usr/lib/* \
81                 $(1)/usr/lib/
82         $(CP) \
83                 $(PKG_BUILD_DIR)/include/*.h \
84                 $(1)/usr/include/
85         $(CP) \
86                 $(PKG_INSTALL_DIR)/usr/include/* \
87                 $(1)/usr/include/
88         rm -f $(1)/usr/include/gdbm.h
89 endef
90
91 define Build/Compile
92         $(MAKE) -C $(PKG_BUILD_DIR)/bfd/doc/ CFLAGS="-I$(PKG_BUILD_DIR)/include" chew
93         $(call Build/Compile/Default)
94 endef
95
96 define Package/objdump/install
97         $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
98         $(CP) $(PKG_INSTALL_DIR)/usr/bin/objdump $(1)/usr/bin/
99         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopcodes*.so $(1)/usr/lib/
100         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so $(1)/usr/lib/
101 endef
102
103 define Package/binutils/install
104         $(INSTALL_DIR) $(1)/usr $(1)/bin
105         $(CP) $(PKG_INSTALL_DIR)/usr/bin/ $(1)/usr/
106         mv $(1)/usr/bin/strings $(1)/bin/strings
107         rm -f $(1)/usr/bin/objdump
108 endef
109
110 $(eval $(call BuildPackage,binutils))
111 $(eval $(call BuildPackage,objdump))