xref: /OK3568_Linux_fs/buildroot/package/elf2flt/elf2flt.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# elf2flt
4#
5################################################################################
6
7ELF2FLT_VERSION = 7e33f28df198c46764021ed14408bd262751e148
8ELF2FLT_SITE = $(call github,uclinux-dev,elf2flt,$(ELF2FLT_VERSION))
9ELF2FLT_LICENSE = GPL-2.0+
10ELF2FLT_LICENSE_FILES = LICENSE.TXT
11
12HOST_ELF2FLT_DEPENDENCIES = host-binutils host-zlib
13
14# 0003-elf2flt-handle-binutils-2.34.patch
15HOST_ELF2FLT_AUTORECONF = YES
16
17# It is not exactly a host variant, but more a cross variant, which is
18# why we pass a special --target option.
19HOST_ELF2FLT_CONF_OPTS = \
20	--with-bfd-include-dir=$(HOST_BINUTILS_DIR)/bfd/ \
21	--with-binutils-include-dir=$(HOST_BINUTILS_DIR)/include/ \
22	--with-libbfd=$(HOST_BINUTILS_DIR)/bfd/libbfd.a \
23	--with-libiberty=$(HOST_BINUTILS_DIR)/libiberty/libiberty.a \
24	--target=$(GNU_TARGET_NAME) \
25	--disable-werror
26
27HOST_ELF2FLT_LIBS = -lz
28
29ifeq ($(BR2_GCC_ENABLE_LTO),y)
30HOST_ELF2FLT_LIBS += -ldl
31endif
32
33HOST_ELF2FLT_CONF_ENV = LIBS="$(HOST_ELF2FLT_LIBS)"
34
35# Hardlinks between binaries in different directories cause a problem
36# with rpath fixup, so we de-hardlink those binaries, and replace them
37# with copies instead. Note that elf2flt will rename ld to ld.real
38# before installing its own ld, but we already took care of the
39# original ld from binutils so that it is already de-hardlinked. So
40# ld is now the one from elf2flt, and we want to de-hardlinke it.
41ELF2FLT_TOOLS = elf2flt flthdr ld
42define HOST_ELF2FLT_FIXUP_HARDLINKS
43	$(foreach tool,$(ELF2FLT_TOOLS),\
44		rm -f $(HOST_DIR)/$(GNU_TARGET_NAME)/bin/$(tool) && \
45		cp -a $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-$(tool) \
46			$(HOST_DIR)/$(GNU_TARGET_NAME)/bin/$(tool)
47	)
48endef
49HOST_ELF2FLT_POST_INSTALL_HOOKS += HOST_ELF2FLT_FIXUP_HARDLINKS
50
51$(eval $(host-autotools-package))
52