Add wrapper around aclocal which also search in the targets staging dir aclocal
[openwrt/svn-archive/archive.git] / tools / Makefile
1 #
2 # Copyright (C) 2007 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 curdir:=tools
10
11 # subdirectories to descend into
12 $(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
13
14 # builddir dependencies
15 $(curdir)/squashfs/compile := $(curdir)/lzma/install
16 $(curdir)/quilt/compile := $(curdir)/sed/install
17
18 # preparatory work
19 $(STAGING_DIR)/.prepared: $(TMP_DIR)/.build
20 @for dir in $(STAGING_DIR) $(STAGING_DIR_HOST); do ( \
21 set -x; \
22 mkdir -p "$$dir"; \
23 cd "$$dir"; \
24 mkdir -p bin lib include stamp; \
25 ); done
26 mkdir -p $(BUILD_DIR_HOST)/stamp $(BUILD_DIR)/stamp
27 $(INSTALL_DATA) $(TOPDIR)/tools/include/*.h $(STAGING_DIR_HOST)/include/
28 touch $@
29
30 $(STAGING_DIR_HOST)/bin/md5sum: $(STAGING_DIR)/.prepared
31 @MD5SUM=`which md5sum 2>/dev/null`; \
32 if [ "$@" != "$$MD5SUM" ]; then \
33 if [ -x "$$MD5SUM" ]; then \
34 ln -sf "$$MD5SUM" "$@"; \
35 else \
36 cp $(SCRIPT_DIR)/md5sum $(STAGING_DIR_HOST)/bin/; \
37 fi; \
38 fi
39
40 $(STAGING_DIR_HOST)/bin/find: $(STAGING_DIR)/.prepared
41 if [ -x "$(FIND)" -a "$(FIND)" != "$@" ]; then \
42 ln -sf "$(FIND)" $@; \
43 fi
44
45
46 $(curdir)/cmddeps = $(patsubst %,$(STAGING_DIR_HOST)/bin/%,find md5sum)
47 $(curdir)//prepare = $(STAGING_DIR)/.prepared $($(curdir)/cmddeps)
48 $(curdir)//compile = $(STAGING_DIR)/.prepared $($(curdir)/cmddeps)
49
50 # prerequisites for the individual targets
51 $(curdir)/ := .config prereq
52 $(curdir)//install = $(1)/compile
53
54 $(eval $(call stampfile,$(curdir),tools,install))
55 $(eval $(call subdir,$(curdir)))