2 # Copyright (C) 2007-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 TMP_DIR ?
= $(TOPDIR
)/tmp
9 ifeq ($(if
$(TARGET_BUILD
),,$(DUMP
)),)
10 -include $(TMP_DIR
)/.host.mk
13 ifneq ($(__host_inc
),1)
16 try-run
= $(shell set
-e
; \
17 TMP_F
="$(TMP_DIR)/try-run.$$$$.tmp"; \
18 if
($(1)) >/dev
/null
2>&1; then echo
"$(2)"; else echo
"$(3)"; fi
; \
22 host-cc-option
= $(call try-run
, \
23 $(HOSTCC
) $(HOST_CFLAGS
) $(1) -c
-xc
/dev
/null
-o
"$$TMP_F",$(1),$(2) \
26 .PRECIOUS
: $(TMP_DIR
)/.host.mk
27 $(TMP_DIR
)/.host.mk
: $(TOPDIR
)/include/host.mk
32 Linux
) HOST_ARCH
=`uname -m`;; \
33 Darwin
) HOST_ARCH
=`uname -m`;; \
34 *) HOST_ARCH
=`uname -p`;; \
36 GNU_HOST_NAME
=`gcc -dumpmachine`; \
37 [ -z
"$$GNU_HOST_NAME" -o
"$$HOST_OS" = "Darwin" ] && \
38 GNU_HOST_NAME
=`$(TOPDIR)/scripts/config.guess`; \
39 echo
"HOST_OS:=$$HOST_OS" > $@
; \
40 echo
"HOST_ARCH:=$$HOST_ARCH" >> $@
; \
41 echo
"GNU_HOST_NAME:=$$GNU_HOST_NAME" >> $@
; \
42 if gfind
-L
/dev
/null || find
-L
/dev
/null
; then \
43 echo
"FIND_L=find -L \$$(1)" >> $@
; \
45 echo
"FIND_L=find \$$(1) -follow" >> $@
; \
47 ) >/dev
/null
2>/dev
/null