summaryrefslogtreecommitdiff
path: root/devel/cpuflags/files/cpuflags.NetBSD
blob: d7b613751ef4fef5f79f0e66d7dc285ab9541dbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
# $NetBSD: cpuflags.NetBSD,v 1.5 2001/06/28 22:23:00 abs Exp $

hw_model=`sysctl -n hw.model`

case $hw_model in
    # i386
    *386-class*)	FLAGS='-march=i386'		;;
    *486-class*)	FLAGS='-march=i486'		;;
    *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
    # 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*)	
	# The memorybus in strongarm risc pc machines cannot support
	# certain strongarm instructions, but we cannot tell a shark
	# from such a risc pc via uname or sysctl (Certainly for 1.5)
	if grep -q ofbus0 /var/run/dmesg.boot 2>/dev/null ; then
	    FLAGS="-mcpu=strongarm110"			   # shark
	else
	    FLAGS="-march=armv3m -mtune=strongarm"	   # risc pc
	fi						;;
    #
    *)			echo "Unknown hw.model '$hw_model'" >&2
esac

if [ -n "$FLAGS" ];then
    gcc_ver=`gcc -v 2>&1 | awk '/gcc version/ {print $3}'`
    case $gcc_ver in
	egcs* )
	    gcc_ver=2.8 ;;
    esac

    if [ "$gcc_ver" \< 2.8 ];then		# Old gcc, such as in NetBSD 1.3
	FLAGS=`awk -v "flags=$FLAGS" '
{map["-m"$1] = "-m"$2}
END{print map[flags]}' <<EOD
arch=i386		no-486
arch=i486		486
arch=pentium		486
arch=pentiumpro		486
cpu=supersparc		supersparc
cpu=sparclite		sparclite
cpu=cypress		cypress
cpu=v9			v8
EOD
`
    fi
fi

echo $FLAGS

exit 0