summaryrefslogtreecommitdiff
path: root/toolchain/elf2flt/Makefile
blob: 8e5fec5a43bc13592eaf68c769d0252ffe37b3eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.

include $(ADK_TOPDIR)/rules.mk
include Makefile.inc
include ../rules.mk
include $(ADK_TOPDIR)/mk/buildhlp.mk

ifeq ($(ADK_TOOLCHAIN_BINUTILS_GIT),y)
BINUTILS_VERSION:=	git
BFDLIB:=		.libs/libbfd.a
endif
ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_42),y)
BINUTILS_VERSION:=	2.42
BFDLIB:=		.libs/libbfd.a
endif
ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_41),y)
BINUTILS_VERSION:=	2.41
BFDLIB:=		.libs/libbfd.a
endif
ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_40),y)
BINUTILS_VERSION:=	2.40
BFDLIB:=		libbfd.a
endif
ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_39),y)
BINUTILS_VERSION:=	2.39
BFDLIB:=		libbfd.a
endif
ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_28),y)
BINUTILS_VERSION:=	2.28
BFDLIB:=		libbfd.a
endif

$(WRKBUILD)/.configured:
	(cd $(WRKBUILD); PATH='${HOST_PATH}' autoreconf -vif;)
	(cd $(WRKBUILD); \
	CPPFLAGS="-idirafter $(ADK_TOPDIR)/adk/include" \
	./configure --prefix=$(STAGING_HOST_DIR)/usr \
		--target=$(GNU_TARGET_NAME) \
		--with-bfd-include-dir=$(TOOLCHAIN_BUILD_DIR)/w-binutils-$(BINUTILS_VERSION)-1/binutils-$(BINUTILS_VERSION)/bfd \
		--with-binutils-include-dir=$(TOOLCHAIN_BUILD_DIR)/w-binutils-$(BINUTILS_VERSION)-1/binutils-$(BINUTILS_VERSION)/include \
		--with-libbfd=$(TOOLCHAIN_BUILD_DIR)/w-binutils-$(BINUTILS_VERSION)-1/binutils-$(BINUTILS_VERSION)/bfd/$(BFDLIB) \
		--with-libiberty=$(TOOLCHAIN_BUILD_DIR)/w-binutils-$(BINUTILS_VERSION)-1/binutils-$(BINUTILS_VERSION)/libiberty/libiberty.a )
	touch $@

$(WRKBUILD)/.compiled: $(WRKBUILD)/.configured
	$(MAKE) -C $(WRKBUILD) all
	touch $@

$(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
	$(INSTALL_BIN) $(WRKBUILD)/elf2flt $(TOOLCHAIN_DIR)/usr/$(GNU_TARGET_NAME)/bin
	$(INSTALL_BIN) $(WRKBUILD)/flthdr $(TOOLCHAIN_DIR)/usr/$(GNU_TARGET_NAME)/bin
	$(INSTALL_BIN) $(WRKBUILD)/ld-elf2flt $(TOOLCHAIN_DIR)/usr/$(GNU_TARGET_NAME)/bin
	$(INSTALL_DATA) $(WRKBUILD)/elf2flt.ld $(TOOLCHAIN_DIR)/usr/$(GNU_TARGET_NAME)/lib
	rm $(TOOLCHAIN_DIR)/usr/bin/$(GNU_TARGET_NAME)-ld $(TOOLCHAIN_DIR)/usr/$(GNU_TARGET_NAME)/bin/ld
	(cd $(TOOLCHAIN_DIR)/usr/$(GNU_TARGET_NAME)/bin \
		&& ln -sf ld.bfd ld.real \
		&& ln -sf ld-elf2flt ld \
	)
	(cd $(TOOLCHAIN_DIR)/usr/bin && \
		ln -sf ../$(GNU_TARGET_NAME)/bin/elf2flt $(GNU_TARGET_NAME)-elf2flt && \
		ln -sf ../$(GNU_TARGET_NAME)/bin/flthdr $(GNU_TARGET_NAME)-flthdr && \
		ln -sf ../$(GNU_TARGET_NAME)/bin/ld-elf2flt $(GNU_TARGET_NAME)-ld-elf2flt && \
		ln -sf ../$(GNU_TARGET_NAME)/bin/ld-elf2flt $(GNU_TARGET_NAME)-ld )
	(cd $(TOOLCHAIN_DIR)/usr/bin/ && ln -sf $(GNU_TARGET_NAME)-ld.bfd $(GNU_TARGET_NAME)-ld.real )
	touch $@

include $(ADK_TOPDIR)/mk/toolchain.mk