Add ccache if not installed/installable on the host-system
[openwrt.git] / toolchain / Makefile
1 #
2 # Copyright (C) 2006 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 include $(TOPDIR)/rules.mk
10
11 TARGETS-y:=kernel-headers
12 TARGETS-$(CONFIG_GDB) += gdb
13 TARGETS-$(CONFIG_CCACHE) += ccache
14 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
15 TARGETS-y+=binutils gcc uClibc
16 endif
17
18 TARGETS_DOWNLOAD:=$(patsubst %,%-download,$(TARGETS-y))
19 TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS-y))
20 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS-y))
21
22 all: install
23 download: $(TARGETS_DOWNLOAD)
24 install: $(TARGETS_INSTALL)
25 clean: $(TARGETS_CLEAN)
26 $(TARGETS_INSTALL): $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
27
28 uClibc-prepare: ccache-prepare kernel-headers-prepare
29 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
30 binutils-prepare: uClibc-prepare
31 gcc-prepare: binutils-install
32 uClibc-compile: gcc-compile
33 endif
34 gcc-install: uClibc-install
35
36 TOOLCHAIN_STAMP_DIR:=$(STAGING_DIR)/stampfiles
37
38 $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME):
39 @mkdir -p $@
40 @ln -sf ../lib $@/lib
41
42 $(TOOLCHAIN_STAMP_DIR):
43 mkdir -p $@
44
45 $(TOOLCHAIN_BUILD_DIR):
46 @mkdir -p $@
47
48 %-download: FORCE
49 $(MAKE) -C $(patsubst %-download,%,$@) download
50
51 %-prepare: $(TOOLCHAIN_STAMP_DIR) $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME) $(TOOLCHAIN_BUILD_DIR) FORCE
52 @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
53 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare; \
54 }
55 @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
56
57 %-compile: %-prepare
58 @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
59 $(MAKE) -C $(patsubst %-compile,%,$@) compile; \
60 }
61 @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
62
63 %-install: %-compile
64 @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
65 $(MAKE) -C $(patsubst %-install,%,$@) install; \
66 }
67 @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
68
69 %-clean: FORCE
70 @$(MAKE) -C $(patsubst %-clean,%,$@) clean
71 @rm -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$(patsubst %-clean,%,$@)-*
72
This page took 0.050073 seconds and 5 git commands to generate.