aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/machine.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/machine.sh')
-rwxr-xr-xcontrib/bmake/machine.sh81
1 files changed, 12 insertions, 69 deletions
diff --git a/contrib/bmake/machine.sh b/contrib/bmake/machine.sh
index 0cf9daeeef3a..14fc5269ad40 100755
--- a/contrib/bmake/machine.sh
+++ b/contrib/bmake/machine.sh
@@ -1,10 +1,12 @@
:
-# derrived from /etc/rc_d/os.sh
+# This is mostly redundant.
+# These days I use the pseudo machine "host" when building for host
+# and $TARGET_HOST for its objdir
# RCSid:
-# $Id: machine.sh,v 1.18 2017/08/13 19:11:28 sjg Exp $
+# $Id: machine.sh,v 1.19 2023/01/17 18:30:21 sjg Exp $
#
-# @(#) Copyright (c) 1994-2002 Simon J. Gerraty
+# @(#) Copyright (c) 1994-2023 Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
@@ -17,82 +19,23 @@
# sjg@crufty.net
#
-OS=`uname`
-OSREL=`uname -r`
-OSMAJOR=`IFS=.; set $OSREL; echo $1`
-machine=`uname -p 2>/dev/null || uname -m`
-MACHINE=
-
-# there is at least one case of `uname -p` outputting
-# a bunch of usless drivel
-case "$machine" in
-unknown|*[!A-Za-z0-9_-]*)
- machine=`uname -m`
- ;;
-esac
-
-# Great! Solaris keeps moving arch(1)
-# we need this here, and it is not always available...
-Which() {
- # some shells cannot correctly handle `IFS`
- # in conjunction with the for loop.
- _dirs=`IFS=:; echo ${2:-$PATH}`
- for d in $_dirs
- do
- test -x $d/$1 && { echo $d/$1; break; }
- done
-}
+# leverage os.sh
+Mydir=`dirname $0`
+. $Mydir/os.sh
+# some further overrides - mostly for MACHINE_ACH
case $OS in
AIX) # from http://gnats.netbsd.org/29386
- OSMAJOR=`uname -v`
- OSMINOR=`uname -r`
- MACHINE=$OS$OSMAJOR.$OSMINOR
MACHINE_ARCH=`bootinfo -T`
;;
-OpenBSD)
- MACHINE=$OS$OSMAJOR.$machine
- arch=`Which arch /usr/bin:/usr/ucb:$PATH`
- MACHINE_ARCH=`$arch -s`;
- ;;
Bitrig)
- MACHINE=$OS$OSMAJOR.$machine
- MACHINE_ARCH=`uname -m`;
- ;;
-*BSD)
- MACHINE=$OS$OSMAJOR.$machine
- ;;
-SunOS)
- arch=`Which arch /usr/bin:/usr/ucb:$PATH`
- test "$arch" && machine_arch=`$arch`
-
- case "$OSREL" in
- 4.0*) MACHINE_ARCH=$machine_arch MACHINE=$machine_arch;;
- 4*) MACHINE_ARCH=$machine_arch;;
- esac
+ MACHINE_ARCH=$MACHINE;
;;
HP-UX)
- MACHINE_ARCH=`IFS="/-."; set $machine; echo $1`
- ;;
-Interix)
- MACHINE=i386
- MACHINE_ARCH=i386
+ MACHINE_ARCH=`IFS="/-."; set $MACHINE; echo $1`
;;
-UnixWare)
- OSREL=`uname -v`
- OSMAJOR=`IFS=.; set $OSREL; echo $1`
- MACHINE_ARCH=`uname -m`
- ;;
-Linux)
- case "$machine" in
- i?86) MACHINE_ARCH=i386;;# does anyone really care about 686 vs 586?
- esac
- ;;
esac
-MACHINE=${MACHINE:-$OS$OSMAJOR}
-MACHINE_ARCH=${MACHINE_ARCH:-$machine}
-
(
case "$0" in
arch*) echo $MACHINE_ARCH;;
@@ -103,4 +46,4 @@ arch*) echo $MACHINE_ARCH;;
esac
;;
esac
-) | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
+) | toLower