kernel: update kernel 4.4 to version 4.4.11
[lede.git] / include / host.mk
1 #
2 # Copyright (C) 2007-2015 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 ifeq ($(if $(TARGET_BUILD),,$(DUMP)),)
10   -include $(TMP_DIR)/.host.mk
11 endif
12
13 ifneq ($(__host_inc),1)
14 __host_inc:=1
15
16 export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
17
18 try-run = $(shell set -e; \
19         TMP_F="$(TMP_DIR)/try-run.$$$$.tmp"; \
20         if ($(1)) >/dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi; \
21         rm -f "$$TMP_F"; \
22 )
23
24 host-cc-option = $(call try-run, \
25         $(HOSTCC) $(HOST_CFLAGS) $(1) -c -xc /dev/null -o "$$TMP_F",$(1),$(2) \
26 )
27
28 .PRECIOUS: $(TMP_DIR)/.host.mk
29 $(TMP_DIR)/.host.mk: $(TOPDIR)/include/host.mk
30         @mkdir -p $(TMP_DIR)
31         @( \
32                 HOST_OS=`uname`; \
33                 case "$$HOST_OS" in \
34                         Linux) HOST_ARCH=`uname -m`;; \
35                         Darwin) HOST_ARCH=`uname -m`;; \
36                         *) HOST_ARCH=`uname -p`;; \
37                 esac; \
38                 GNU_HOST_NAME=`gcc -dumpmachine`; \
39                 [ -z "$$GNU_HOST_NAME" -o "$$HOST_OS" = "Darwin" ] && \
40                         GNU_HOST_NAME=`$(TOPDIR)/scripts/config.guess`; \
41                 echo "HOST_OS:=$$HOST_OS" > $@; \
42                 echo "HOST_ARCH:=$$HOST_ARCH" >> $@; \
43                 echo "GNU_HOST_NAME:=$$GNU_HOST_NAME" >> $@; \
44                 if gfind -L /dev/null || find -L /dev/null; then \
45                         echo "FIND_L=find -L \$$(1)" >> $@; \
46                 else \
47                         echo "FIND_L=find \$$(1) -follow" >> $@; \
48                 fi \
49         ) >/dev/null 2>/dev/null
50
51 endif