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