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
42 # disable gdb for arc and avr32
43 ifeq ($(ADK_TARGET_ARCH_ARC
),)
48 DOWNLOAD
:=kernel-headers-download
$(patsubst %,%-download
,$(TARGETS
))
49 TARGETS_INSTALL
:=$(patsubst %,%-install,$(TARGETS
))
50 FIXUP
:=$(patsubst %,%-fixup
,$(CLIB
))
51 TARGETS_CLEAN
:=$(patsubst %,%-clean,$(TARGETS
))
53 install: $(TARGETS_INSTALL
)
54 clean: $(TARGETS_CLEAN
)
58 gcc-prepare
: binutils-install gmp-install mpfr-install mpc-install libelf-install
59 $(CLIB
)-prepare
: gcc-prepare kernel-headers-prepare
60 gcc-configure
: $(CLIB
)-prepare
61 $(CLIB
)-compile
: gcc-configure
62 gcc-compile
: $(CLIB
)-install
63 $(CLIB
)-fixup
: gcc-install
$(GDB
) $(ELF2FLT
)
66 $(TRACE
) toolchain
/$(patsubst %-download
,%,$@
)/download
67 $(MAKE
) -C
$(patsubst %-download
,%,$@
) fetch
70 $(TRACE
) toolchain
/$(patsubst %-prepare
,%,$@
)/prepare
71 @if
test x
"$(patsubst %-prepare,%,$@)" = x
"$(CLIB)"; then \
72 $(MAKE
) -C
$(patsubst %-prepare
,%,$@
) prepare \
75 $(MAKE
) -C
$(patsubst %-prepare
,%,$@
) prepare \
76 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' $(MAKE_TRACE
); \
79 %-configure
: %-prepare
80 $(TRACE
) toolchain
/$(patsubst %-configure
,%,$@
)/configure
81 @if
test x
"$(patsubst %-configure,%,$@)" = x
"$(CLIB)"; then \
82 $(MAKE
) -C
$(patsubst %-configure
,%,$@
) configure \
85 $(MAKE
) -C
$(patsubst %-configure
,%,$@
) configure \
86 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' $(MAKE_TRACE
); \
89 %-compile
: %-configure
90 $(TRACE
) toolchain
/$(patsubst %-compile
,%,$@
)/compile
91 @if
test x
"$(patsubst %-compile,%,$@)" = x
"$(CLIB)"; then \
92 $(MAKE
) -C
$(patsubst %-compile
,%,$@
) compile \
95 $(MAKE
) -C
$(patsubst %-compile
,%,$@
) compile \
96 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' CXXFLAGS
='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE
); \
100 $(TRACE
) toolchain
/$(patsubst %-install,%,$@
)/install
101 @if
test x
"$(patsubst %-install,%,$@)" = x
"$(CLIB)"; then \
102 $(MAKE
) -C
$(patsubst %-install,%,$@
) install \
105 $(MAKE
) -C
$(patsubst %-install,%,$@
) install \
106 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' CXXFLAGS
='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE
); \
110 $(TRACE
) toolchain
/$(patsubst %-fixup
,%,$@
)/fixup
111 @
$(MAKE
) -C
$(patsubst %-fixup
,%,$@
) fixup
$(MAKE_TRACE
)
114 $(TRACE
) toolchain
/$(patsubst %-clean,%,$@
)/clean
115 @
$(MAKE
) -C
$(patsubst %-clean,%,$@
) clean $(MAKE_TRACE
)