1# $FreeBSD$ 2# RCSid: 3# $Id: host-target.mk,v 1.11 2015/10/25 00:07:20 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_MACHINE) 15_HOST_MACHINE != uname -m 16.export _HOST_MACHINE 17.endif 18.if !defined(_HOST_ARCH) 19# for NetBSD prefer $MACHINE (amd64 rather than x86_64) 20.if ${_HOST_OSNAME:NNetBSD} == "" 21_HOST_ARCH := ${_HOST_MACHINE} 22.else 23_HOST_ARCH != uname -p 2> /dev/null || uname -m 24# uname -p may produce garbage on linux 25.if ${_HOST_ARCH:[\#]} > 1 || ${_HOST_ARCH:Nunknown} == "" 26_HOST_ARCH := ${_HOST_MACHINE} 27.endif 28.endif 29.export _HOST_ARCH 30.endif 31.if !defined(HOST_MACHINE) 32HOST_MACHINE := ${_HOST_MACHINE} 33.export HOST_MACHINE 34.endif 35 36HOST_OSMAJOR := ${_HOST_OSREL:C/[^0-9].*//} 37HOST_OSTYPE := ${_HOST_OSNAME:S,/,,g}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH} 38HOST_OS := ${_HOST_OSNAME} 39host_os := ${_HOST_OSNAME:tl} 40HOST_TARGET := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH} 41 42# tr is insanely non-portable, accommodate the lowest common denominator 43TR ?= tr 44toLower = ${TR} 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' 45toUpper = ${TR} 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 46