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_BUILD_COMPILER_LLVM
),y
)
26 ifeq ($(ADK_TARGET_LIB_GLIBC
),y
)
30 ifeq ($(ADK_TARGET_LIB_UCLIBC_NG
),y
)
34 ifeq ($(ADK_TARGET_LIB_MUSL
),y
)
38 ifeq ($(ADK_TARGET_LIB_NEWLIB
),y
)
43 ifeq ($(ADK_TARGET_BINFMT_FLAT
)$(ADK_TARGET_OS_FROSTED
),y
)
45 ELF2FLT
:=elf2flt-install
48 ifeq ($(ADK_TOOLCHAIN_WITH_GDB
),y
)
49 # disable gdb for some architectures
50 ifeq ($(ADK_TARGET_ARCH_ARC
)$(ADK_TARGET_ARCH_CR16
)$(ADK_TARGET_ARCH_EPIPHANY
)$(ADK_TARGET_ARCH_METAG
)$(ADK_TARGET_ARCH_NDS32
)$(ADK_TARGET_ARCH_OR1K
),)
56 ifeq (${ADK_PRELINK},y
)
57 TARGETS
+=prelink-cross
60 DOWNLOAD
:=kernel-headers-download
$(patsubst %,%-download
,$(TARGETS
))
61 TARGETS_INSTALL
:=$(patsubst %,%-install,$(TARGETS
))
62 FINAL
:=$(patsubst %,%-final
,$(COMPILER
))
63 TARGETS_CLEAN
:=$(patsubst %,%-clean,$(TARGETS
))
65 install: $(TARGETS_INSTALL
)
66 clean: $(TARGETS_CLEAN
)
71 ifeq ($(ADK_BUILD_COMPILER_LLVM
),y
)
72 $(COMPILER
)-configure
: binutils-install
74 $(COMPILER
)-configure
: binutils-install gmp-install mpfr-install mpc-install
77 ifeq ($(ADK_TARGET_LIB_NEWLIB
),y
)
78 $(CLIB
)-install: $(COMPILER
)-configure
80 $(CLIB
)-install: $(COMPILER
)-configure kernel-headers-configure
82 $(COMPILER
)-install: $(ELF2FLT
) $(CLIB
)-install
83 $(COMPILER
)-final
: $(COMPILER
)-install $(GDB
)
86 $(START_TRACE
) "toolchain/$(patsubst %-download,%,$@)/download.. "
87 $(MAKE
) -C
$(patsubst %-download
,%,$@
) fetch
92 $(START_TRACE
) "toolchain/$(patsubst %-prepare,%,$@)/prepare.. "
93 @if
test x
"$(patsubst %-prepare,%,$@)" = x
"$(CLIB)"; then \
94 $(MAKE
) -C
$(patsubst %-prepare
,%,$@
) prepare \
97 $(MAKE
) -C
$(patsubst %-prepare
,%,$@
) prepare \
98 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' $(MAKE_TRACE
); \
103 %-configure
: %-prepare
104 $(START_TRACE
) "toolchain/$(patsubst %-configure,%,$@)/configure.. "
105 @if
test x
"$(patsubst %-configure,%,$@)" = x
"$(CLIB)"; then \
106 $(MAKE
) -C
$(patsubst %-configure
,%,$@
) configure \
109 $(MAKE
) -C
$(patsubst %-configure
,%,$@
) configure \
110 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' $(MAKE_TRACE
); \
115 %-compile
: %-configure
116 $(START_TRACE
) "toolchain/$(patsubst %-compile,%,$@)/compile.. "
117 @if
test x
"$(patsubst %-compile,%,$@)" = x
"$(CLIB)"; then \
118 $(MAKE
) -C
$(patsubst %-compile
,%,$@
) compile \
121 $(MAKE
) -C
$(patsubst %-compile
,%,$@
) compile \
122 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' CXXFLAGS
='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE
); \
128 $(START_TRACE
) "toolchain/$(patsubst %-install,%,$@)/install.. "
129 @if
test x
"$(patsubst %-install,%,$@)" = x
"$(CLIB)"; then \
130 $(MAKE
) -C
$(patsubst %-install,%,$@
) install \
133 $(MAKE
) -C
$(patsubst %-install,%,$@
) install \
134 CC
='$(HOST_CC)' CFLAGS
='$(HOST_CFLAGS)' CXXFLAGS
='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE
); \
140 $(START_TRACE
) "toolchain/$(patsubst %-final,%,$@)/final.. "
141 @
$(MAKE
) -C
$(patsubst %-final
,%,$@
) final
$(MAKE_TRACE
)
146 $(START_TRACE
) "toolchain/$(patsubst %-clean,%,$@)/clean.. "
147 @
$(MAKE
) -C
$(patsubst %-clean,%,$@
) clean $(MAKE_TRACE
)