41635be7c3
-mcpu=cypress for my little ELC
103 lines
2.9 KiB
Bash
Executable file
103 lines
2.9 KiB
Bash
Executable file
#!/bin/sh
|
|
# $NetBSD: cpuflags.NetBSD,v 1.16 2002/01/01 17:01:26 abs Exp $
|
|
|
|
if [ -x /sbin/sysctl ] ;then
|
|
SYSCTL=/sbin/sysctl
|
|
else
|
|
SYSCTL=/usr/sbin/sysctl # NetBSD 1.3
|
|
fi
|
|
|
|
hw_model=`$SYSCTL -n hw.model`
|
|
hw_machine=`$SYSCTL -n hw.machine`
|
|
|
|
# We're almost certainly crosscompiling
|
|
if [ -n "$MACHINE" -a $hw_machine != "$MACHINE" ]; then
|
|
echo
|
|
exit
|
|
fi
|
|
|
|
case $hw_model in
|
|
# i386
|
|
*386-class*) FLAGS='-march=i386' ;;
|
|
*486-class*) FLAGS='-march=i486' ;;
|
|
*AMD\ K6*) FLAGS='-march=k6' ;;
|
|
*586-class*) FLAGS='-march=pentium' ;;
|
|
*686-class*) FLAGS='-march=pentiumpro' ;;
|
|
#
|
|
# sparc
|
|
MB86904* | MB86907*) FLAGS="-mcpu=supersparc" ;; # ss5
|
|
TMS390Z50*) FLAGS="-mcpu=supersparc" ;; # ss10/ss20
|
|
MB86930* | MB86934*) FLAGS="-mcpu=sparclite" ;; # from gcc
|
|
MB86900/1A*) FLAGS="-mcpu=cypress" ;; # ss1+
|
|
CY7C601*) FLAGS="-mcpu=cypress" ;; # ss2
|
|
W8601/8701*) FLAGS="-mcpu=cypress" ;; # elc
|
|
# under 1.5.1 -mcpu=ultrasparc chokes egcs-2.91.66 compiling perl
|
|
SUNW,UltraSPARC*) FLAGS="-mcpu=v9" ;; # Ultra
|
|
#
|
|
# arm32
|
|
ARM610*) FLAGS="-mcpu=arm610" ;; # risc pc
|
|
ARM710*) FLAGS="-mcpu=arm710" ;; # risc pc
|
|
SA-110*)
|
|
case $hw_machine in # arm32 split post 1.5
|
|
cats|dnard|hpcarm|netwinder)
|
|
FLAGS="-mcpu=strongarm110" ;;
|
|
acorn32)
|
|
FLAGS="-march=armv3m -mtune=strongarm" ;;
|
|
*)
|
|
# The memorybus in strongarm risc pc machines cannot support
|
|
# certain strongarm instructions, but in 1.5 and earlier all
|
|
# strongarm machines are 'arm32', so uname and sysctl no use
|
|
if egrep -q ofbus0|footbridge0 /var/run/dmesg.boot 2>/dev/null \
|
|
; then
|
|
FLAGS="-mcpu=strongarm110" # dnard/cats
|
|
else
|
|
FLAGS="-march=armv3m -mtune=strongarm" # risc pc
|
|
fi
|
|
esac ;;
|
|
#
|
|
# alpha / vax / unknown
|
|
*)
|
|
case $hw_machine in
|
|
alpha)
|
|
# cpu0 at mainbus0: ID 0 (primary), 21164A-0 (unknown ...
|
|
if egrep -q '^cpu0.*21164A' /var/run/dmesg.boot 2>/dev/null \
|
|
; then
|
|
FLAGS="-mcpu=21164a"
|
|
fi
|
|
# Need to confirm how other CPUs probe
|
|
;; # No VAX specific gcc flags :(
|
|
vax)
|
|
;; # No VAX specific gcc flags :(
|
|
*)
|
|
echo "Unknown hw.model '$hw_model'" >&2
|
|
echo "Please send machine details to abs@netbsd.org" >&2
|
|
esac
|
|
esac
|
|
|
|
# Fixup flags for old gcc
|
|
if [ -n "$FLAGS" ]; then
|
|
gcc_ver=`gcc -v 2>&1 | awk '/gcc version/ {sub("egcs-","");print $3}'`
|
|
FLAGS=`awk -v "flags=$FLAGS" -v "gcc_ver=$gcc_ver" '
|
|
{if (gcc_ver < $1){map[$2] = ""$3}}
|
|
END{if (flags in map) {print map[flags]}else {print flags}}
|
|
' <<EOD
|
|
2.90 -mcpu=21164a
|
|
2.90 -march=i386 -mno-486
|
|
2.90 -march=i486 -m486
|
|
2.90 -march=pentium -m486
|
|
2.90 -march=pentiumpro -m486
|
|
2.90 -mcpu=supersparc -msupersparc
|
|
2.90 -mcpu=sparclite -msparclite
|
|
2.90 -mcpu=cypress -mcypress
|
|
2.90 -mcpu=v9 -mv8
|
|
2.90 -mcpu=arm610 -m6
|
|
2.90 -mcpu=strongarm110 -m6
|
|
2.90 -mcpu=arm710 -m6
|
|
2.95 -march=k6 -march=pentium
|
|
EOD
|
|
`
|
|
fi
|
|
|
|
echo $FLAGS
|
|
|
|
exit 0
|