add genext2fs to build ext2 filesystem images
[openwrt-10.03/.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 TARGETS-y:=sed kernel-headers sstrip binutils gcc uClibc ipkg-utils libnotimpl ext2fs squashfs jffs2 lzma
11 TARGETS-$(CONFIG_GDB) += gdb
12
13 TARGETS_DOWNLOAD:=$(patsubst %,%-download,$(TARGETS-y))
14 TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS-y))
15 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS-y))
16
17 all: install
18 download: $(TARGETS_DOWNLOAD)
19 install: $(TARGETS_INSTALL)
20 clean: $(TARGETS_CLEAN)
21
22 kernel-headers-prepare: sed-install
23 uClibc-prepare: kernel-headers-prepare sstrip-install
24 binutils-prepare: uClibc-prepare
25 gcc-prepare: binutils-install
26 uClibc-compile: gcc-compile
27 gcc-install: uClibc-install
28 squashfs-compile: lzma-install
29
30 TOOLCHAIN_STAMP_DIR:=$(STAGING_DIR)/stampfiles
31
32 $(TOOLCHAIN_STAMP_DIR):
33         mkdir -p $@
34
35 $(STAGING_DIR):
36         @mkdir -p $@/lib
37         @mkdir -p $@/include
38         @mkdir -p $@/$(REAL_GNU_TARGET_NAME)
39         @ln -sf ../lib $@/$(REAL_GNU_TARGET_NAME)/lib
40
41 $(TOOL_BUILD_DIR):
42         @mkdir -p $@
43
44 %-download: FORCE
45         $(MAKE) -C $(patsubst %-download,%,$@) download
46
47 %-prepare: $(TOOLCHAIN_STAMP_DIR) $(STAGING_DIR) $(TOOL_BUILD_DIR) FORCE
48         @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
49                 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare; \
50         }
51         @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
52
53 %-compile: %-prepare 
54         @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
55                 $(MAKE) -C $(patsubst %-compile,%,$@) compile; \
56         }
57         @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
58
59 %-install: %-compile
60         @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
61                 $(MAKE) -C $(patsubst %-install,%,$@) install; \
62         }
63         @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
64
65 %-clean: FORCE
66         @$(MAKE) -C $(patsubst %-clean,%,$@) clean
67         @rm -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$(patsubst %-clean,%,$@)-*
68