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