2 # $Id: host-target.mk,v 1.11 2015/10/25 00:07:20 sjg Exp $
4 # Host platform information; may be overridden
5 .if
!defined
(_HOST_OSNAME
)
6 _HOST_OSNAME
!= uname
-s
9 .if
!defined
(_HOST_OSREL
)
10 _HOST_OSREL
!= uname
-r
13 .if
!defined
(_HOST_MACHINE
)
14 _HOST_MACHINE
!= uname
-m
17 .if
!defined
(_HOST_ARCH
)
18 # for NetBSD prefer $MACHINE (amd64 rather than x86_64)
19 .if
${_HOST_OSNAME
:NNetBSD
} == ""
20 _HOST_ARCH
:= ${_HOST_MACHINE}
22 _HOST_ARCH
!= uname
-p
2> /dev
/null || uname
-m
23 # uname -p may produce garbage on linux
24 .if
${_HOST_ARCH
:[\
#]} > 1 || ${_HOST_ARCH:Nunknown} == ""
25 _HOST_ARCH
:= ${_HOST_MACHINE}
30 .if
!defined
(HOST_MACHINE
)
31 HOST_MACHINE
:= ${_HOST_MACHINE}
35 HOST_OSMAJOR
:= ${_HOST_OSREL
:C
/[^
0-9].
*//}
36 HOST_OSTYPE
:= ${_HOST_OSNAME
:S
,/,,g
}-${_HOST_OSREL
:C
/\
([^\
)]*\
)//}-${_HOST_ARCH}
37 HOST_OS
:= ${_HOST_OSNAME}
38 host_os
:= ${_HOST_OSNAME
:tl
}
39 HOST_TARGET
:= ${host_os
:S
,/,,g
}${HOST_OSMAJOR}-${_HOST_ARCH}
41 # tr is insanely non-portable, accommodate the lowest common denominator
43 toLower
= ${TR} 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
44 toUpper
= ${TR} 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'