2015-06-13 19:20:56 +00:00
|
|
|
# $FreeBSD$
|
2012-08-22 19:25:57 +00:00
|
|
|
# RCSid:
|
2016-01-25 18:43:21 +00:00
|
|
|
# $Id: host-target.mk,v 1.11 2015/10/25 00:07:20 sjg Exp $
|
2012-08-22 19:25:57 +00:00
|
|
|
|
|
|
|
# Host platform information; may be overridden
|
|
|
|
.if !defined(_HOST_OSNAME)
|
|
|
|
_HOST_OSNAME != uname -s
|
|
|
|
.export _HOST_OSNAME
|
|
|
|
.endif
|
|
|
|
.if !defined(_HOST_OSREL)
|
|
|
|
_HOST_OSREL != uname -r
|
|
|
|
.export _HOST_OSREL
|
|
|
|
.endif
|
2016-01-25 18:43:21 +00:00
|
|
|
.if !defined(_HOST_MACHINE)
|
|
|
|
_HOST_MACHINE != uname -m
|
|
|
|
.export _HOST_MACHINE
|
|
|
|
.endif
|
2012-08-22 19:25:57 +00:00
|
|
|
.if !defined(_HOST_ARCH)
|
2016-01-25 18:43:21 +00:00
|
|
|
# for NetBSD prefer $MACHINE (amd64 rather than x86_64)
|
|
|
|
.if ${_HOST_OSNAME:NNetBSD} == ""
|
|
|
|
_HOST_ARCH := ${_HOST_MACHINE}
|
|
|
|
.else
|
|
|
|
_HOST_ARCH != uname -p 2> /dev/null || uname -m
|
2012-08-22 19:25:57 +00:00
|
|
|
# uname -p may produce garbage on linux
|
2016-01-25 18:43:21 +00:00
|
|
|
.if ${_HOST_ARCH:[\#]} > 1 || ${_HOST_ARCH:Nunknown} == ""
|
|
|
|
_HOST_ARCH := ${_HOST_MACHINE}
|
|
|
|
.endif
|
2012-08-22 19:25:57 +00:00
|
|
|
.endif
|
|
|
|
.export _HOST_ARCH
|
|
|
|
.endif
|
2014-05-16 17:50:57 +00:00
|
|
|
.if !defined(HOST_MACHINE)
|
2016-01-25 18:43:21 +00:00
|
|
|
HOST_MACHINE := ${_HOST_MACHINE}
|
2014-05-16 17:50:57 +00:00
|
|
|
.export HOST_MACHINE
|
|
|
|
.endif
|
2012-08-22 19:25:57 +00:00
|
|
|
|
|
|
|
HOST_OSMAJOR := ${_HOST_OSREL:C/[^0-9].*//}
|
2016-01-25 18:43:21 +00:00
|
|
|
HOST_OSTYPE := ${_HOST_OSNAME:S,/,,g}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH}
|
2012-08-22 19:25:57 +00:00
|
|
|
HOST_OS := ${_HOST_OSNAME}
|
|
|
|
host_os := ${_HOST_OSNAME:tl}
|
2016-01-25 18:43:21 +00:00
|
|
|
HOST_TARGET := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH}
|
2012-08-22 19:25:57 +00:00
|
|
|
|
|
|
|
# tr is insanely non-portable, accommodate the lowest common denominator
|
|
|
|
TR ?= tr
|
|
|
|
toLower = ${TR} 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
|
|
|
|
toUpper = ${TR} 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|