X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=blobdiff_plain;f=tools%2FMakefile;h=aca49857d9c5c8a370c098c6c5aa17cfe9e170b5;hp=d3dc5ad5f5fa768ba6fc2287edb6ff7834a1a2ae;hb=21bd199905c57841bff2f2190f67531957dff33a;hpb=7afe3e26ffacbacf5c58efd75def2bc313d23ce4 diff --git a/tools/Makefile b/tools/Makefile index d3dc5ad5f5..aca49857d9 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -12,6 +12,7 @@ curdir:=tools $(curdir)/builddirs := sed sstrip ipkg-utils genext2fs squashfs mtd-utils lzma mkimage firmware-utils patch-cmdline pkg-config automake $(if $(CONFIG_CCACHE),ccache) bison $(if $(CONFIG_powerpc),dtc) lua quilt autoconf # builddir dependencies +$(curdir)/automake/compile := $(curdir)/autoconf/install $(curdir)/squashfs/compile := $(curdir)/lzma/install $(curdir)/quilt/compile := $(curdir)/sed/install @@ -27,11 +28,23 @@ $(STAGING_DIR)/.prepared: $(TMP_DIR)/.build $(INSTALL_DATA) $(TOPDIR)/tools/include/*.h $(STAGING_DIR_HOST)/include/ touch $@ -$(STAGING_DIR_HOST)/bin/find: - [ -x "$(FIND)" ] && ln -sf "$(FIND)" $@ +define PrepareCommand +$(STAGING_DIR_HOST)/bin/$(1): $(STAGING_DIR)/.prepared + @mkdir -p "$$(dir $$@)"; rm -f "$$@" + @export FILE="$$$$(which $(2) 2>/dev/null | grep -v 'not found' | head -n1)"; [ -n "$$$$FILE" ] || { \ + echo "Command $(1) not found."; false; \ + }; ln -s "$$$$FILE" "$$@" -$(curdir)//prepare = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/bin/find -$(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/bin/find +endef + +$(eval $(call PrepareCommand,find,gfind find)) +$(eval $(call PrepareCommand,md5sum,md5sum $(SCRIPT_DIR)/md5sum)) +$(eval $(call PrepareCommand,cp,gcp cp)) +$(eval $(call PrepareCommand,stat,gstat stat)) + +$(curdir)/cmddeps = $(patsubst %,$(STAGING_DIR_HOST)/bin/%,find md5sum cp stat) +$(curdir)//prepare = $(STAGING_DIR)/.prepared $($(curdir)/cmddeps) +$(curdir)//compile = $(STAGING_DIR)/.prepared $($(curdir)/cmddeps) # prerequisites for the individual targets $(curdir)/ := .config prereq