fix verbose output with dash as /bin/sh
[openwrt-10.03/.git] / include / host.mk
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
8 -include $(TMP_DIR)/.host.mk
9
10 export TAR
11 TMP_DIR ?= $(TOPDIR)/tmp
12
13 ifneq ($(__host_inc),1)
14 __host_inc:=1
15 $(TMP_DIR)/.host.mk: $(TOPDIR)/include/host.mk
16         @mkdir -p $(TMP_DIR)
17         @( \
18                 HOST_OS=`uname`; \
19                 case "$$HOST_OS" in \
20                         Linux) HOST_ARCH=`uname -m`;; \
21                         *) HOST_ARCH=`uname -p`;; \
22                 esac; \
23                 GNU_HOST_NAME=`gcc -dumpmachine`; \
24                 [ -n "$$GNU_HOST_NAME" ] || \
25                         GNU_HOST_NAME=`$(SCRIPT_DIR)/config.guess`; \
26                 echo "HOST_OS:=$$HOST_OS" > $@; \
27                 echo "HOST_ARCH:=$$HOST_ARCH" >> $@; \
28                 echo "GNU_HOST_NAME:=$$GNU_HOST_NAME" >> $@; \
29                 TAR=`which gtar 2>/dev/null`; \
30                 [ -n "$$TAR" -a -x "$$TAR" ] || TAR=`which tar 2>/dev/null`; \
31                 echo "TAR:=$$TAR" >> $@; \
32                 echo "BASH:=$(shell which bash)" >> $@; \
33                 if find -L /tmp -maxdepth 0 >/dev/null 2>/dev/null; then \
34                         echo 'FIND_L=find -L $$(1)' >>$@; \
35                 else \
36                         echo 'FIND_L=find $$(1) -follow' >> $@; \
37                 fi; \
38         )
39
40 endif
41
42 ifeq ($(HOST_OS),Linux)
43   XARGS:=xargs -r
44 else
45   XARGS:=xargs
46 endif