xref: /freebsd/contrib/bmake/mk/host-target.mk (revision f4b37ed0f8b307b1f3f0f630ca725d68f1dff30d)
1# RCSid:
2#	$Id: host-target.mk,v 1.7 2014/05/16 17:54:52 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.if !defined(HOST_MACHINE)
22HOST_MACHINE != uname -m
23.export HOST_MACHINE
24.endif
25
26HOST_OSMAJOR := ${_HOST_OSREL:C/[^0-9].*//}
27HOST_OSTYPE  :=	${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH}
28HOST_OS      :=	${_HOST_OSNAME}
29host_os      :=	${_HOST_OSNAME:tl}
30HOST_TARGET  := ${host_os}${HOST_OSMAJOR}-${_HOST_ARCH}
31
32# tr is insanely non-portable, accommodate the lowest common denominator
33TR ?= tr
34toLower = ${TR} 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
35toUpper = ${TR} 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
36