2 # Copyright (C) 2007-2009 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 # Main makefile for the toolchain
10 # 1) toolchain/binutils/install
11 # build & install binutils
12 # 2) toolchain/gcc/prepare
13 # build & install a minimal gcc, needed for steps 3 & 4
14 # 3) toolchain/kernel-headers/install
15 # install kernel headers, needed for step 4
16 # 4) toolchain/libc/prepare
17 # build & install libc headers & support files, needed for step 5
18 # 5) toolchain/gcc/compile
19 # build & install an initial gcc, needed for step 6
20 # 6) toolchain/libc/compile
21 # build & install the final libc
22 # 7) toolchain/gcc/install
23 # build & install the final gcc
24 # 8) toolchain/libc/install
25 # build & install libc utilities
30 # subdirectories to descend into
31 $(curdir
)/builddirs
:= $(if
$(CONFIG_GDB
),gdb
) $(if
$(CONFIG_INSIGHT
),insight
) $(if
$(CONFIG_EXTERNAL_TOOLCHAIN
),,kernel-headers binutils gcc
$(LIBC
) $(if
$(CONFIG_GLIBC_PORTS
),glibc-ports
))
32 $(curdir
)/builddirs-compile
:=$($(curdir
)/builddirs-prepare
)
33 $(curdir
)/builddirs-install
:=$($(curdir
)/builddirs-compile
)
35 # builddir dependencies
36 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN
),)
37 $(curdir
)/$(LIBC
)/prepare
:=$(curdir
)/kernel-headers
/install
38 $(curdir
)/gcc
/prepare
:=$(curdir
)/binutils
/install
39 $(curdir
)/kernel-headers
/install:=$(curdir
)/gcc
/prepare
40 $(curdir
)/gcc
/compile
:=$(curdir
)/$(LIBC
)/prepare
41 $(curdir
)/$(LIBC
)/compile
:=$(curdir
)/gcc
/compile
42 $(curdir
)/gcc
/install:=$(curdir
)/$(LIBC
)/compile
43 $(curdir
)/$(LIBC
)/install:=$(curdir
)/gcc
/install
44 ifneq ($(CONFIG_GLIBC_PORTS
),)
45 $(curdir
)/glibc
/prepare
:=$(curdir
)/glibc-ports
/prepare
49 ifdef CONFIG_GCC_VERSION_LLVM
50 $(curdir
)/builddirs
+= llvm
51 $(curdir
)/gcc
/prepare
+= $(curdir
)/llvm
/install
55 $(TOOLCHAIN_DIR
)/info.mk
: .config
56 @for
dir in
$(TOOLCHAIN_DIR
); do
( \
60 mkdir
-p stamp lib usr
/include usr
/lib
; \
62 @grep GCC_VERSION
$@
>/dev
/null
2>&1 ||
$(INSTALL_DATA
) $(TOPDIR
)/toolchain
/info.mk
$@
66 # prerequisites for the individual targets
67 $(curdir
)/ := .config prereq
68 $(curdir
)//prepare
= $(STAGING_DIR
)/.prepared
$(TOOLCHAIN_DIR
)/info.mk
69 $(curdir
)//compile
= $(1)/prepare
70 $(curdir
)//install = $(1)/compile
72 $(TOOLCHAIN_DIR
)/stamp
/.gcc-initial_installed
:
74 $(eval
$(call stampfile
,$(curdir
),toolchain
,install,$(TOOLCHAIN_DIR
)/stamp
/.gcc-initial_installed
,,$(TOOLCHAIN_DIR
)))
75 $(eval
$(call subdir
,$(curdir
)))