move target/default/target_skeleton into package/base-files, put all the default...
[openwrt-10.03/.git] / toolchain / Makefile
1 # Main makefile for the toolchain
2 include $(TOPDIR)/rules.mk
3 TARGETS:=sed utils binutils gcc uClibc ipkg-utils gdb
4
5 TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS))
6 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
7
8 all: install
9 install: $(TARGETS_INSTALL)
10 clean: $(TARGETS_CLEAN)
11
12 uClibc-prepare: kernel-headers-prepare sed-install utils-install
13 binutils-prepare: uClibc-prepare
14 gcc-prepare: binutils-install
15 uClibc-compile: gcc-prepare
16 gcc-compile: uClibc-install
17
18 TOOLCHAIN_STAMP_DIR:=$(STAGING_DIR)/stampfiles
19
20 $(TOOLCHAIN_STAMP_DIR):
21         mkdir -p $(TOOLCHAIN_STAMP_DIR)
22
23 $(STAGING_DIR):
24         @mkdir -p $(STAGING_DIR)/lib
25         @mkdir -p $(STAGING_DIR)/include
26         @mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
27         @ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
28
29 $(TOOL_BUILD_DIR):
30         @mkdir -p $(TOOL_BUILD_DIR)
31
32 %-prepare: $(TOOLCHAIN_STAMP_DIR) $(STAGING_DIR) $(TOOL_BUILD_DIR)
33         @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
34         @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
35
36 %-compile: %-prepare 
37         @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || $(MAKE) -C $(patsubst %-compile,%,$@) compile
38         @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
39
40 %-install: %-compile
41         @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || $(MAKE) -C $(patsubst %-install,%,$@) install
42         @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
43
44 %-clean:
45         @$(MAKE) -C $(patsubst %-clean,%,$@) clean
46         @rm -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$(patsubst %-clean,%,$@)-*
47