2 # Copyright (C) 2006 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
9 include $(TOPDIR)/rules.mk
11 TARGETS-y:=kernel-headers
12 TARGETS-$(CONFIG_GDB) += gdb
13 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
14 TARGETS-y+=binutils gcc uClibc
17 TARGETS_DOWNLOAD:=$(patsubst %,%-download,$(TARGETS-y))
18 TARGETS_PREPARE:=$(patsubst %,%-prepare,$(TARGETS-y))
19 TARGETS_COMPILE:=$(patsubst %,%-compile,$(TARGETS-y))
20 TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS-y))
21 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS-y))
22 STAMP:=$(STAGING_DIR)/stampfiles/.toolchain_installed
25 download: $(TARGETS_DOWNLOAD)
26 compile: $(TARGETS_COMPILE)
28 clean: $(TARGETS_CLEAN)
30 ifneq ($(shell $(SCRIPT_DIR)/timestamp.pl -p . $(STAMP)),$(STAMP))
31 $(STAMP): $(TARGETS_INSTALL)
34 uClibc-prepare: kernel-headers-prepare
35 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
36 binutils-prepare: uClibc-prepare
37 gcc-prepare: binutils-install
38 uClibc-compile: gcc-compile
40 gcc-install: uClibc-install
43 mkdir -p $(shell dirname $@)
46 $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME):
50 $(TOOLCHAIN_BUILD_DIR):
53 %-prereq %-download %-clean: FORCE
54 $(MAKE) -C $* $(patsubst $*-%,%,$@)
56 %-prepare: $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) $(TOOLCHAIN_BUILD_DIR)
57 $(MAKE) -C $* $(patsubst $*-%,%,$@)
59 %-compile: %-prepare FORCE
60 $(MAKE) -C $* $(patsubst $*-%,%,$@)
62 %-install: %-compile FORCE
63 $(MAKE) -C $* $(patsubst $*-%,%,$@)