uClibc: Fix threaded use of res_ functions.
[openwrt/svn-archive/archive.git] / toolchain / Makefile
1 #
2 # Copyright (C) 2007-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # Main makefile for the toolchain
8 #
9 # Steps:
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
26 #
27
28 curdir:=toolchain
29
30 # subdirectories to descend into
31 $(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/minimal gcc/initial gcc/final $(LIBC)/headers $(LIBC))
32 ifdef CONFIG_USE_UCLIBC
33 $(curdir)/builddirs += $(LIBC)/utils
34 endif
35 $(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
36 $(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
37
38 # builddir dependencies
39 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
40 $(curdir)/gcc/minimal/compile:=$(curdir)/binutils/install
41 $(curdir)/kernel-headers/install:=$(curdir)/gcc/minimal/install
42 $(curdir)/gcc/initial/prepare:=$(curdir)/gcc/minimal/prepare
43 $(curdir)/gcc/final/prepare:=$(curdir)/gcc/initial/prepare
44
45 $(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/install
46 $(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/install
47 $(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/install
48 $(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/install
49 $(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/install
50 $(curdir)/$(LIBC)/prepare:=$(curdir)/$(LIBC)/headers/prepare
51 $(curdir)/$(LIBC)/utils/prepare:=$(curdir)/$(LIBC)/headers/prepare
52 endif
53
54 ifdef CONFIG_GCC_VERSION_LLVM
55 $(curdir)/builddirs += llvm
56 $(curdir)/gcc/minimal/compile += $(curdir)/llvm/install
57 endif
58
59 ifndef DUMP_TARGET_DB
60 ifneq ($(ARCH),)
61 $(TOOLCHAIN_DIR)/info.mk: .config
62 @for dir in $(TOOLCHAIN_DIR); do ( \
63 $(if $(QUIET),,set -x;) \
64 mkdir -p "$$dir"; \
65 cd "$$dir"; \
66 ln -nsf lib lib64; \
67 ln -nsf lib lib32; \
68 mkdir -p stamp lib usr/include usr/lib ; \
69 ); done
70 @grep GCC_VERSION $@ >/dev/null 2>&1 || $(INSTALL_DATA) $(TOPDIR)/toolchain/info.mk $@
71 @touch $@
72 endif
73 endif
74
75 # prerequisites for the individual targets
76 $(curdir)/ := .config prereq
77 $(curdir)//prepare = $(STAGING_DIR)/.prepared $(TOOLCHAIN_DIR)/info.mk
78 $(curdir)//compile = $(1)/prepare
79 $(curdir)//install = $(1)/compile
80
81 ifndef DUMP_TARGET_DB
82 $(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed:
83 endif
84
85 $(eval $(call stampfile,$(curdir),toolchain,install,$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed,,$(TOOLCHAIN_DIR)))
86 $(eval $(call subdir,$(curdir)))
87