xref: /freebsd/share/mk/host-target.mk (revision d1a0d267b78b542fbd7e6553af2493760f49bfa8)
1# $FreeBSD$
2# RCSid:
3#	$Id: host-target.mk,v 1.7 2014/05/16 17:54:52 sjg Exp $
4
5# Host platform information; may be overridden
6.if !defined(_HOST_OSNAME)
7_HOST_OSNAME !=	uname -s
8.export _HOST_OSNAME
9.endif
10.if !defined(_HOST_OSREL)
11_HOST_OSREL  !=	uname -r
12.export _HOST_OSREL
13.endif
14.if !defined(_HOST_ARCH)
15_HOST_ARCH   !=	uname -p 2>/dev/null || uname -m
16# uname -p may produce garbage on linux
17.if ${_HOST_ARCH:[\#]} > 1
18_HOST_ARCH != uname -m
19.endif
20.export _HOST_ARCH
21.endif
22.if !defined(HOST_MACHINE)
23HOST_MACHINE != uname -m
24.export HOST_MACHINE
25.endif
26
27HOST_OSMAJOR := ${_HOST_OSREL:C/[^0-9].*//}
28HOST_OSTYPE  :=	${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH}
29HOST_OS      :=	${_HOST_OSNAME}
30host_os      :=	${_HOST_OSNAME:tl}
31HOST_TARGET  := ${host_os}${HOST_OSMAJOR}-${_HOST_ARCH}
32
33# tr is insanely non-portable, accommodate the lowest common denominator
34TR ?= tr
35toLower = ${TR} 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
36toUpper = ${TR} 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
37