41115834625daf70ef7130e1ab59a159d7bf8752
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / binutils / binutils.mk
1 ################################################################################
2 #
3 # binutils
4 #
5 ################################################################################
6
7 # Version is set when using buildroot toolchain.
8 # If not, we do like other packages
9 BINUTILS_VERSION = $(call qstrip,$(BR2_BINUTILS_VERSION))
10 ifeq ($(BINUTILS_VERSION),)
11 ifeq ($(BR2_arc),y)
12 BINUTILS_VERSION = arc-2014.12
13 else
14 BINUTILS_VERSION = 2.22
15 endif
16 endif # BINUTILS_VERSION
17
18 ifeq ($(BR2_arc),y)
19 BINUTILS_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,$(BINUTILS_VERSION))
20 BINUTILS_SOURCE = binutils-$(BINUTILS_VERSION).tar.gz
21 BINUTILS_FROM_GIT = y
22 endif
23 BINUTILS_SITE ?= $(BR2_GNU_MIRROR)/binutils
24 BINUTILS_SOURCE ?= binutils-$(BINUTILS_VERSION).tar.bz2
25 BINUTILS_EXTRA_CONFIG_OPTIONS = $(call qstrip,$(BR2_BINUTILS_EXTRA_CONFIG_OPTIONS))
26 BINUTILS_INSTALL_STAGING = YES
27 BINUTILS_DEPENDENCIES = $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext)
28 HOST_BINUTILS_DEPENDENCIES =
29 BINUTILS_LICENSE = GPLv3+, libiberty LGPLv2.1+
30 BINUTILS_LICENSE_FILES = COPYING3 COPYING.LIB
31
32 ifeq ($(BINUTILS_FROM_GIT),y)
33 BINUTILS_DEPENDENCIES += host-texinfo host-flex host-bison
34 HOST_BINUTILS_DEPENDENCIES += host-texinfo host-flex host-bison
35 endif
36
37 # When binutils sources are fetched from the binutils-gdb repository,
38 # they also contain the gdb sources, but gdb shouldn't be built, so we
39 # disable it.
40 BINUTILS_DISABLE_GDB_CONF_OPTS = \
41         --disable-sim \
42         --disable-gdb
43
44 # We need to specify host & target to avoid breaking ARM EABI
45 BINUTILS_CONF_OPTS = \
46         --disable-multilib \
47         --disable-werror \
48         --host=$(GNU_TARGET_NAME) \
49         --target=$(GNU_TARGET_NAME) \
50         --enable-install-libiberty \
51         $(BINUTILS_DISABLE_GDB_CONF_OPTS) \
52         $(BINUTILS_EXTRA_CONFIG_OPTIONS)
53
54 # Don't build documentation. It takes up extra space / build time,
55 # and sometimes needs specific makeinfo versions to work
56 BINUTILS_CONF_ENV += ac_cv_prog_MAKEINFO=missing
57 HOST_BINUTILS_CONF_ENV += ac_cv_prog_MAKEINFO=missing
58
59 # Install binutils after busybox to prefer full-blown utilities
60 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
61 BINUTILS_DEPENDENCIES += busybox
62 endif
63
64 # "host" binutils should actually be "cross"
65 # We just keep the convention of "host utility" for now
66 HOST_BINUTILS_CONF_OPTS = \
67         --disable-multilib \
68         --disable-werror \
69         --target=$(GNU_TARGET_NAME) \
70         --disable-shared \
71         --enable-static \
72         --with-sysroot=$(STAGING_DIR) \
73         --enable-poison-system-directories \
74         $(BINUTILS_DISABLE_GDB_CONF_OPTS) \
75         $(BINUTILS_EXTRA_CONFIG_OPTIONS)
76
77 # We just want libbfd, libiberty and libopcodes,
78 # not the full-blown binutils in staging
79 define BINUTILS_INSTALL_STAGING_CMDS
80         $(MAKE) -C $(@D)/bfd DESTDIR=$(STAGING_DIR) install
81         $(MAKE) -C $(@D)/opcodes DESTDIR=$(STAGING_DIR) install
82         $(MAKE) -C $(@D)/libiberty DESTDIR=$(STAGING_DIR) install
83 endef
84
85 # If we don't want full binutils on target
86 ifneq ($(BR2_PACKAGE_BINUTILS_TARGET),y)
87 define BINUTILS_INSTALL_TARGET_CMDS
88         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/bfd DESTDIR=$(TARGET_DIR) install
89         $(MAKE) -C $(@D)/libiberty DESTDIR=$(STAGING_DIR) install
90 endef
91 endif
92
93 XTENSA_CORE_NAME = $(call qstrip, $(BR2_XTENSA_CORE_NAME))
94 ifneq ($(XTENSA_CORE_NAME),)
95 define BINUTILS_XTENSA_PRE_PATCH
96         tar xf $(BR2_XTENSA_OVERLAY_DIR)/xtensa_$(XTENSA_CORE_NAME).tar \
97                 -C $(@D) --strip-components=1 binutils
98 endef
99 BINUTILS_PRE_PATCH_HOOKS += BINUTILS_XTENSA_PRE_PATCH
100 HOST_BINUTILS_PRE_PATCH_HOOKS += BINUTILS_XTENSA_PRE_PATCH
101 endif
102
103 ifeq ($(BR2_BINUTILS_ENABLE_LTO),y)
104 HOST_BINUTILS_CONF_OPTS += --enable-plugins --enable-lto
105 endif
106
107 $(eval $(autotools-package))
108 $(eval $(host-autotools-package))