Small bugfix for dependency handling - mostly for base-files and symlinks
[openwrt.git] / tools / Makefile
index d03ab38..513eccc 100644 (file)
@@ -8,6 +8,7 @@
 #
 include $(TOPDIR)/rules.mk
 TARGETS-y:=sed sstrip ipkg-utils ext2fs squashfs mtd-utils lzma mkimage firmware-utils
+TARGETS-$(CONFIG_CCACHE) += ccache
 
 TARGETS_DOWNLOAD:=$(patsubst %,%-download,$(TARGETS-y))
 TARGETS_PREPARE:=$(patsubst %,%-prepare,$(TARGETS-y))
@@ -28,18 +29,29 @@ ifneq ($(shell $(SCRIPT_DIR)/timestamp.pl -p . $(STAMP)),$(STAMP))
   $(STAMP): $(TARGETS_INSTALL)
 endif
 
-$(STAMP):
+$(STAMP): $(TOPDIR)/.config
        mkdir -p $(shell dirname $@)
        touch $@
-       
-$(STAGING_DIR)/include-host:
-       @mkdir -p $@
-       @$(CP) ./include/*.h $@/
+
+TOOL_HOST_INCLUDES:=$(patsubst ./include/%.h,$(STAGING_DIR)/include-host/%.h,$(wildcard ./include/*.h))
+$(TOOL_HOST_INCLUDES): $(STAGING_DIR)/include-host/%.h: ./include/%.h
+       @mkdir -p $(STAGING_DIR)/include-host
+       $(CP) $< $@
 
 $(TOOL_BUILD_DIR):
        @mkdir -p $@
 
-$(eval $(call default_subtargets,$(STAGING_DIR)/include-host $(TOOL_BUILD_DIR)))
+%-prereq %-download %-clean: FORCE
+       $(MAKE) -C $* $(patsubst $*-%,%,$@)
+
+%-prepare: $(TOOL_HOST_INCLUDES) $(TOOL_BUILD_DIR) FORCE
+       $(MAKE) -C $* $(patsubst $*-%,%,$@)
+
+%-compile: %-prepare FORCE
+       $(MAKE) -C $* $(patsubst $*-%,%,$@)
+       
+%-install: %-compile FORCE
+       $(MAKE) -C $* $(patsubst $*-%,%,$@)
 
 ifeq ($(MAKECMDGOALS),install-targets)
 MAKEFLAGS:=$(MAKEFLAGS) -j$(CONFIG_JLEVEL)
This page took 0.0231 seconds and 4 git commands to generate.