summaryrefslogtreecommitdiff
path: root/devel/cpuflags/files/cpuflags.NetBSD
blob: 7ec692e5dfe017d56ad3e6bb12693fe0ceedb6d9 (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
65
66
67
#!/bin/sh
# $NetBSD: cpuflags.NetBSD,v 1.3 2001/06/07 16:05:10 abs Exp $

gcc_ver=`gcc -v 2>&1 | awk '/gcc version/ {print $3}'`
hw_model=`sysctl -n hw.model`

case $gcc_ver in
    egcs* )
	gcc_ver=2.8 ;;
esac

if [ "$gcc_ver" \< 2.8 ];then		# Old gcc, such as in NetBSD 1.3

    case $hw_model in
	# i386
	*386-class*)		FLAGS='-mno-486'		;;
	*486-class*)		FLAGS='-m486'			;;
	*586-class*)		FLAGS='-m486'			;;
	*686-class*)		FLAGS='-m486'			;;
	#
	# sparc
	MB86904* | MB86907*)	FLAGS="-msupersparc"		;; # ss5
	TMS390Z50*)		FLAGS="-msupersparc"		;; # ss10/ss20
	MB86930* | MB86934*)	FLAGS="-msparclite"		;; # from gcc
	MB86900/1A*)		FLAGS="-mcypress"		;; # ss1+
	#
	# arm
	SA-110*)		FLAGS=""			;; # shark
	#
	*)			echo "Unknown hw.model '$hw_model'" >&2
    esac

else					# Modern gcc

    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+
	#
	# 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

fi
echo $FLAGS

exit 0