09710d4b9ef03a66519f6ad58ccbef7a760420d4
[openwrt/openwrt.git] / package / 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 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
27
28 PKG_BUILD_PARALLEL:=1
29
30 include $(INCLUDE_DIR)/package.mk
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
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 --prefix=/usr \
55 --disable-multilib \
56 --disable-werror \
57 --disable-nls \
58 --enable-shared \
59 $(SOFT_FLOAT_CONFIG_OPTION) \
60 $(call qstrip,$(CONFIG_EXTRA_BINUTILS_CONFIG_OPTIONS))
61
62 TARGET_CFLAGS += $(FPIC)
63 TARGET_LDFLAGS := -L$(PKG_BUILD_DIR)/libiberty $(TARGET_LDFLAGS)
64
65 define Build/Configure
66 $(call Build/Configure/Default)
67 $(call Build/Compile/Default, \
68 configure-bfd \
69 configure-binutils \
70 configure-etc \
71 configure-gas \
72 configure-gprof \
73 configure-intl \
74 configure-ld \
75 configure-libiberty \
76 configure-opcodes \
77 )
78 $(MAKE) CFLAGS="$(TARGET_CFLAGS)" -C $(PKG_BUILD_DIR)/bfd/po Makefile
79 endef
80
81 define Build/InstallDev
82 $(INSTALL_DIR) $(1)/usr/{lib,include}
83 $(CP) \
84 $(PKG_INSTALL_DIR)/usr/lib/* \
85 $(1)/usr/lib/
86 $(CP) \
87 $(PKG_BUILD_DIR)/include/*.h \
88 $(1)/usr/include/
89 $(CP) \
90 $(PKG_INSTALL_DIR)/usr/include/* \
91 $(1)/usr/include/
92 rm -f $(1)/usr/include/gdbm.h
93 endef
94
95 define Build/Compile
96 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/bfd/doc/ CFLAGS="-I$(PKG_BUILD_DIR)/include" chew
97 $(call Build/Compile/Default)
98 endef
99
100 define Package/objdump/install
101 $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib
102 $(CP) $(PKG_INSTALL_DIR)/usr/bin/objdump $(1)/usr/bin/
103 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopcodes*.so $(1)/usr/lib/
104 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libbfd*.so $(1)/usr/lib/
105 endef
106
107 define Package/binutils/install
108 $(INSTALL_DIR) $(1)/usr $(1)/bin
109 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ $(1)/usr/
110 mv $(1)/usr/bin/strings $(1)/bin/strings
111 rm -f $(1)/usr/bin/objdump
112 endef
113
114 $(eval $(call BuildPackage,binutils))
115 $(eval $(call BuildPackage,objdump))