1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 # Steps to build toolchains
5 # 1) build and install binutils
6 # 2) build and install mpfr, mpc, libelf and gmp
7 # 3) build and install minimal gcc c compiler
8 # 4) install kernel-headers
9 # 5) install libc headers
10 # 6) build and install initial static gcc
11 # 7) build and install full libc
12 # 8) build and install full shared gcc
13 # 9) rebuild and install full libc (in case of musl/uclibc)
14 # 10) build and install gdb debugger
16 include $(ADK_TOPDIR
)/rules.mk
18 TARGETS
:=binutils gmp mpfr mpc libelf gcc
20 ifeq ($(ADK_TARGET_LIB_GLIBC
),y
)
24 ifeq ($(ADK_TARGET_LIB_UCLIBC
),y
)
28 ifeq ($(ADK_TARGET_LIB_UCLIBC_NG
),y
)
32 ifeq ($(ADK_TARGET_LIB_MUSL
),y
)
37 ifeq ($(ADK_TARGET_BINFMT_FLAT
),y
)
39 ELF2FLT
:=elf2flt-install
43 ifeq ($(ADK_TARGET_ARCH_ARC
),)
47 ifeq (${ADK_PRELINK},y
)
48 TARGETS
+=prelink-cross
51 DOWNLOAD
:=kernel-headers-download
$(patsubst %,%-download
,$(TARGETS
))
52 TARGETS_INSTALL
:=$(patsubst %,%-install,$(TARGETS
))
53 FIXUP
:=$(patsubst %,%-fixup
,$(CLIB
))
54 TARGETS_CLEAN
:=$(patsubst %,%-clean,$(TARGETS
))
56 install: $(TARGETS_INSTALL
)
57 clean: $(TARGETS_CLEAN
)
61 gcc-prepare
: binutils-install gmp-install mpfr-install mpc-install libelf-install
62 $(CLIB
)-prepare
: gcc-prepare kernel-headers-prepare
63 gcc-configure
: $(CLIB
)-prepare
64 $(CLIB
)-compile
: gcc-configure
65 gcc-compile
: $(CLIB
)-install
66 $(CLIB
)-fixup
: gcc-install
$(GDB
) $(ELF2FLT
)
69 $(TRACE
) toolchain
/$(patsubst %-download
,%,$@
)/download
70 $(MAKE
) -C
$(patsubst %-download
,%,$@
) fetch
73 $(TRACE
) toolchain
/$(patsubst %-prepare
,%,$@
)/prepare
74 @if
test x
"$(patsubst %-prepare,%,$@)" = x
"$(CLIB)"; then \
75 $(MAKE
) -C
$(patsubst %-prepare
,%,$@
) prepare \
78 $(MAKE
) -C
$(patsubst %-prepare
,%,$@
) prepare \
79 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' $(MAKE_TRACE
); \
82 %-configure
: %-prepare
83 $(TRACE
) toolchain
/$(patsubst %-configure
,%,$@
)/configure
84 @if
test x
"$(patsubst %-configure,%,$@)" = x
"$(CLIB)"; then \
85 $(MAKE
) -C
$(patsubst %-configure
,%,$@
) configure \
88 $(MAKE
) -C
$(patsubst %-configure
,%,$@
) configure \
89 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' $(MAKE_TRACE
); \
92 %-compile
: %-configure
93 $(TRACE
) toolchain
/$(patsubst %-compile
,%,$@
)/compile
94 @if
test x
"$(patsubst %-compile,%,$@)" = x
"$(CLIB)"; then \
95 $(MAKE
) -C
$(patsubst %-compile
,%,$@
) compile \
98 $(MAKE
) -C
$(patsubst %-compile
,%,$@
) compile \
99 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' CXXFLAGS
='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE
); \
103 $(TRACE
) toolchain
/$(patsubst %-install,%,$@
)/install
104 @if
test x
"$(patsubst %-install,%,$@)" = x
"$(CLIB)"; then \
105 $(MAKE
) -C
$(patsubst %-install,%,$@
) install \
108 $(MAKE
) -C
$(patsubst %-install,%,$@
) install \
109 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' CXXFLAGS
='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE
); \
113 $(TRACE
) toolchain
/$(patsubst %-fixup
,%,$@
)/fixup
114 @
$(MAKE
) -C
$(patsubst %-fixup
,%,$@
) fixup
$(MAKE_TRACE
)
117 $(TRACE
) toolchain
/$(patsubst %-clean,%,$@
)/clean
118 @
$(MAKE
) -C
$(patsubst %-clean,%,$@
) clean $(MAKE_TRACE
)