move tools from toolchain/ to tools/
[openwrt/svn-archive/archive.git] / openwrt / tools / 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 host tools
8 #
9 include $(TOPDIR)/rules.mk
10 TARGETS-y:=sed sstrip ipkg-utils ext2fs squashfs mtd-utils lzma mkimage
11
12 TARGETS_DOWNLOAD:=$(patsubst %,%-download,$(TARGETS-y))
13 TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS-y))
14 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS-y))
15
16 all: install
17 download: $(TARGETS_DOWNLOAD)
18 install: $(TARGETS_INSTALL)
19 clean: $(TARGETS_CLEAN)
20
21 squashfs-compile: lzma-install
22
23 TOOL_STAMP_DIR:=$(STAGING_DIR)/stampfiles
24
25 $(TOOL_STAMP_DIR):
26 mkdir -p $@
27
28 $(STAGING_DIR):
29 @mkdir -p $@/lib
30 @mkdir -p $@/include
31 @mkdir -p $@/$(REAL_GNU_TARGET_NAME)
32 @ln -sf ../lib $@/$(REAL_GNU_TARGET_NAME)/lib
33
34 $(TOOL_BUILD_DIR):
35 @mkdir -p $@
36
37 %-download: FORCE
38 $(MAKE) -C $(patsubst %-download,%,$@) download
39
40 %-prepare: $(TOOL_STAMP_DIR) $(STAGING_DIR) $(TOOL_BUILD_DIR) FORCE
41 @[ -f $(TOOL_STAMP_DIR)/.tool_$@ ] || { \
42 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare; \
43 }
44 @touch $(TOOL_STAMP_DIR)/.tool_$@
45
46 %-compile: %-prepare
47 @[ -f $(TOOL_STAMP_DIR)/.tool_$@ ] || { \
48 $(MAKE) -C $(patsubst %-compile,%,$@) compile; \
49 }
50 @touch $(TOOL_STAMP_DIR)/.tool_$@
51
52 %-install: %-compile
53 @[ -f $(TOOL_STAMP_DIR)/.tool_$@ ] || { \
54 $(MAKE) -C $(patsubst %-install,%,$@) install; \
55 }
56 @touch $(TOOL_STAMP_DIR)/.tool_$@
57
58 %-clean: FORCE
59 @$(MAKE) -C $(patsubst %-clean,%,$@) clean
60 @rm -f $(TOOL_STAMP_DIR)/.tool_$(patsubst %-clean,%,$@)-*
61