host.mk 1.1 KB

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