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 and gmp
7 # 3) build and install initial gcc
8 # 4) install kernel-headers
9 # 5) build and install full libc
10 # 6) build and install full gcc
11 # 7) build and install gdb debugger
13 include $(ADK_TOPDIR
)/rules.mk
15 ifeq ($(ADK_BUILD_COMPILER_GCC
),y
)
16 TARGETS
:=binutils gmp mpfr mpc
20 ifeq ($(ADK_TARGET_LIB_GLIBC
),y
)
24 ifeq ($(ADK_TARGET_LIB_UCLIBC_NG
),y
)
28 ifeq ($(ADK_TARGET_LIB_MUSL
),y
)
32 ifeq ($(ADK_TARGET_LIB_NEWLIB
),y
)
37 ifeq ($(ADK_TARGET_BINFMT_FLAT
),y
)
39 ELF2FLT
:=elf2flt-install
42 ifeq ($(ADK_TOOLCHAIN_WITH_GDB
),y
)
43 # disable gdb for some architectures
44 ifeq ($(ADK_TARGET_ARCH_CR16
)$(ADK_TARGET_ARCH_EPIPHANY
)$(ADK_TARGET_ARCH_METAG
)$(ADK_TARGET_ARCH_NDS32
),)
50 ifeq (${ADK_PRELINK},y
)
51 TARGETS
+=prelink-cross
54 DOWNLOAD
:=$(ADK_TARGET_OS
)-headers-download
$(patsubst %,%-download
,$(TARGETS
))
55 TARGETS_INSTALL
:=$(patsubst %,%-install,$(TARGETS
))
56 FINAL
:=$(patsubst %,%-final
,$(COMPILER
))
57 TARGETS_CLEAN
:=$(patsubst %,%-clean,$(TARGETS
))
59 install: $(TARGETS_INSTALL
)
60 clean: $(TARGETS_CLEAN
)
64 $(COMPILER
)-configure
: binutils-install gmp-install mpfr-install mpc-install
66 ifeq ($(ADK_TARGET_LIB_NEWLIB
),y
)
67 $(CLIB
)-install: $(COMPILER
)-configure
69 $(CLIB
)-install: $(COMPILER
)-configure
$(ADK_TARGET_OS
)-headers-configure
71 $(COMPILER
)-install: $(ELF2FLT
) $(CLIB
)-install
72 $(COMPILER
)-final
: $(COMPILER
)-install $(GDB
)
75 $(START_TRACE
) "toolchain/$(patsubst %-download,%,$@)/download.. "
76 $(MAKE
) -C
$(patsubst %-download
,%,$@
) fetch
81 $(START_TRACE
) "toolchain/$(patsubst %-prepare,%,$@)/prepare.. "
82 @if
test x
"$(patsubst %-prepare,%,$@)" = x
"$(CLIB)"; then \
83 $(MAKE
) -C
$(patsubst %-prepare
,%,$@
) prepare \
86 $(MAKE
) -C
$(patsubst %-prepare
,%,$@
) prepare \
87 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' $(MAKE_TRACE
); \
92 %-configure
: %-prepare
93 $(START_TRACE
) "toolchain/$(patsubst %-configure,%,$@)/configure.. "
94 @if
test x
"$(patsubst %-configure,%,$@)" = x
"$(CLIB)"; then \
95 $(MAKE
) -C
$(patsubst %-configure
,%,$@
) configure \
98 $(MAKE
) -C
$(patsubst %-configure
,%,$@
) configure \
99 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' $(MAKE_TRACE
); \
104 %-compile
: %-configure
105 $(START_TRACE
) "toolchain/$(patsubst %-compile,%,$@)/compile.. "
106 @if
test x
"$(patsubst %-compile,%,$@)" = x
"$(CLIB)"; then \
107 $(MAKE
) -C
$(patsubst %-compile
,%,$@
) compile \
110 $(MAKE
) -C
$(patsubst %-compile
,%,$@
) compile \
111 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' CXXFLAGS
='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE
); \
117 $(START_TRACE
) "toolchain/$(patsubst %-install,%,$@)/install.. "
118 @if
test x
"$(patsubst %-install,%,$@)" = x
"$(CLIB)"; then \
119 $(MAKE
) -C
$(patsubst %-install,%,$@
) install \
122 $(MAKE
) -C
$(patsubst %-install,%,$@
) install \
123 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' CXXFLAGS
='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE
); \
129 $(START_TRACE
) "toolchain/$(patsubst %-final,%,$@)/final.. "
130 @
$(MAKE
) -C
$(patsubst %-final
,%,$@
) final
$(MAKE_TRACE
)
135 $(START_TRACE
) "toolchain/$(patsubst %-clean,%,$@)/clean.. "
136 @
$(MAKE
) -C
$(patsubst %-clean,%,$@
) clean $(MAKE_TRACE
)