finally move buildroot-ng to trunk
[openwrt.git] / 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_PREPARE:=$(patsubst %,%-prepare,$(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 squashfs-compile: lzma-install
23
24 TOOL_STAMP_DIR:=$(STAGING_DIR)/stampfiles
25
26 $(TOOL_STAMP_DIR):
27         mkdir -p $@
28
29 $(STAGING_DIR)/include-host:
30         @mkdir -p $@
31         @$(CP) ./include/*.h $@/
32
33 $(TOOL_BUILD_DIR):
34         @mkdir -p $@
35
36 %-download: FORCE
37         $(MAKE) -C $(patsubst %-download,%,$@) download
38
39 %-prepare: $(TOOL_STAMP_DIR) $(STAGING_DIR)/include-host $(TOOL_BUILD_DIR) FORCE
40         @[ -f $(TOOL_STAMP_DIR)/.tool_$@ ] || { \
41                 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare; \
42         }
43         @touch $(TOOL_STAMP_DIR)/.tool_$@
44
45 %-compile: %-prepare 
46         @[ -f $(TOOL_STAMP_DIR)/.tool_$@ ] || { \
47                 $(MAKE) -C $(patsubst %-compile,%,$@) compile; \
48         }
49         @touch $(TOOL_STAMP_DIR)/.tool_$@
50
51 %-install: %-compile
52         @[ -f $(TOOL_STAMP_DIR)/.tool_$@ ] || { \
53                 $(MAKE) -C $(patsubst %-install,%,$@) install; \
54         }
55         @touch $(TOOL_STAMP_DIR)/.tool_$@
56
57 %-clean: FORCE
58         @$(MAKE) -C $(patsubst %-clean,%,$@) clean
59         @rm -f $(TOOL_STAMP_DIR)/.tool_$(patsubst %-clean,%,$@)-*
60