generate md5 checksums of generated firware images. closes #4003
[openwrt/svn-archive/archive.git] / include / host.mk
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
8 TMP_DIR ?= $(TOPDIR)/tmp
9 -include $(TMP_DIR)/.host.mk
10
11 export TAR FIND
12
13 ifneq ($(__host_inc),1)
14 __host_inc:=1
15 .PRECIOUS: $(TMP_DIR)/.host.mk
16 $(TMP_DIR)/.host.mk: $(TOPDIR)/include/host.mk
17 @mkdir -p $(TMP_DIR)
18 @( \
19 HOST_OS=`uname`; \
20 case "$$HOST_OS" in \
21 Linux) HOST_ARCH=`uname -m`;; \
22 *) HOST_ARCH=`uname -p`;; \
23 esac; \
24 GNU_HOST_NAME=`gcc -dumpmachine`; \
25 [ -n "$$GNU_HOST_NAME" ] || \
26 GNU_HOST_NAME=`$(SCRIPT_DIR)/config.guess`; \
27 echo "HOST_OS:=$$HOST_OS" > $@; \
28 echo "HOST_ARCH:=$$HOST_ARCH" >> $@; \
29 echo "GNU_HOST_NAME:=$$GNU_HOST_NAME" >> $@; \
30 TAR=`which gtar 2>/dev/null`; \
31 [ -n "$$TAR" -a -x "$$TAR" ] || TAR=`which tar 2>/dev/null`; \
32 echo "TAR:=$$TAR" >> $@; \
33 FIND=`which gfind 2>/dev/null`; \
34 [ -n "$$FIND" -a -x "$$FIND" ] || FIND=`which find 2>/dev/null`; \
35 echo "FIND:=$$FIND" >> $@; \
36 echo "BASH:=$(shell which bash)" >> $@; \
37 if $$FIND -L /tmp -maxdepth 0 >/dev/null 2>/dev/null; then \
38 echo "FIND_L=$$FIND -L \$$(1)" >>$@; \
39 else \
40 echo "FIND_L=$$FIND \$$(1) -follow" >> $@; \
41 fi; \
42 if xargs --help 2>&1 | grep 'gnu.org' >/dev/null; then \
43 echo 'XARGS:=xargs -r' >> $@; \
44 else \
45 echo 'XARGS:=xargs' >> $@; \
46 fi; \
47 )
48
49 endif