bsd.cpu.mk revision 96312
1139749Simp# $FreeBSD: head/share/mk/bsd.cpu.mk 96312 2002-05-10 01:31:40Z obrien $
265312Smsmith
365312Smsmith# Set default baseline values of CPUTYPE based on MACHINE_ARCH -- this is
465312Smsmith# the minimum CPU type we support for each architecture
565312Smsmith
665312Smsmith.if ${MACHINE_ARCH} == "i386"
765312SmsmithCPUTYPE ?= i386
865312Smsmith.elif ${MACHINE_ARCH} == "alpha"
965312SmsmithCPUTYPE ?= ev4
1065312Smsmith.elif ${MACHINE_ARCH} == "ia64"
1165312SmsmithCPUTYPE ?= itanium
1265312Smsmith.elif ${MACHINE_ARCH} == "sparc64"
1365312SmsmithCPUTYPE ?= ultrasparc
1465312Smsmith.endif
1565312Smsmith
1665312Smsmith# Handle aliases (not documented in make.conf to avoid user confusion
1765312Smsmith# between e.g. i586 and pentium)
1865312Smsmith
1965312Smsmith.if ${MACHINE_ARCH} == "i386"
2065312Smsmith. if ${CPUTYPE} == "pentiumpro"
2187826SobrienCPUTYPE = i686
2265312Smsmith. elif ${CPUTYPE} == "pentium"
2365312SmsmithCPUTYPE = i586
2496554Sobrien. elif ${CPUTYPE} == "athlon"
2596554SobrienCPUTYPE = k7
2665312Smsmith. endif
2765312Smsmith.endif
2865312Smsmith
2965312Smsmith# Logic to set up correct gcc optimization flag. This must be included
3065312Smsmith# after /etc/make.conf so it can react to the local value of CPUTYPE
3165312Smsmith# defined therein.
3296554Sobrien
3365312Smsmith.if !defined(NO_CPU_CFLAGS) || !defined(NO_CPU_COPTFLAGS)
3465312Smsmith. if ${MACHINE_ARCH} == "i386"
3565312Smsmith.  if ${CPUTYPE} == "k7"
3665312Smsmith_CPUCFLAGS = -march=k6	# gcc doesn't support athlon yet, but it will
3796554Sobrien.  elif ${CPUTYPE} == "k6-2"
3896554Sobrien_CPUCFLAGS = -march=k6
3996554Sobrien.  elif ${CPUTYPE} == "k6"
4096554Sobrien_CPUCFLAGS = -march=k6
4165312Smsmith.  elif ${CPUTYPE} == "k5"
4296554Sobrien_CPUCFLAGS = -march=pentium
4396554Sobrien.  elif ${CPUTYPE} == "p4"
4465312Smsmith_CPUCFLAGS = -march=pentiumpro
4565312Smsmith.  elif ${CPUTYPE} == "p3"
4665312Smsmith_CPUCFLAGS = -march=pentiumpro
4765312Smsmith.  elif ${CPUTYPE} == "p2"
4865312Smsmith_CPUCFLAGS = -march=pentiumpro
4965312Smsmith.  elif ${CPUTYPE} == "i686"
5065312Smsmith_CPUCFLAGS = -march=pentiumpro
5165312Smsmith.  elif ${CPUTYPE} == "i586/mmx"
5265312Smsmith_CPUCFLAGS = -march=pentium
5365312Smsmith.  elif ${CPUTYPE} == "i586"
5465312Smsmith_CPUCFLAGS = -march=pentium
5565312Smsmith.  elif ${CPUTYPE} == "i486"
5665312Smsmith_CPUCFLAGS = -march=i486
5765312Smsmith.  endif
5865312Smsmith. elif ${MACHINE_ARCH} == "alpha"
5996554Sobrien.  if ${CPUTYPE} == "ev6"
6096554Sobrien_CPUCFLAGS = -mcpu=ev6
6196554Sobrien.  elif ${CPUTYPE} == "pca56"
6296554Sobrien_CPUCFLAGS = -mcpu=pca56
6396554Sobrien.  elif ${CPUTYPE} == "ev56"
6496554Sobrien_CPUCFLAGS = -mcpu=ev56
6596554Sobrien.  elif ${CPUTYPE} == "ev5"
6696554Sobrien_CPUCFLAGS = -mcpu=ev5
6796554Sobrien.  elif ${CPUTYPE} == "ev45"
6896554Sobrien_CPUCFLAGS = -mcpu=ev4		# No -mcpu=ev45 for gcc
6996554Sobrien.  elif ${CPUTYPE} == "ev4"
7065312Smsmith_CPUCFLAGS = -mcpu=ev4
7165312Smsmith.  endif
7265312Smsmith. endif
7365312Smsmith.endif
7465312Smsmith
7596551Sobrien# NB: COPTFLAGS is handled in /usr/src/sys/conf/Makefile.<arch>
7696551Sobrien
7796551Sobrien.if !defined(NO_CPU_CFLAGS)
7865312SmsmithCFLAGS += ${_CPUCFLAGS}
7965312Smsmith.endif
8096554Sobrien
8165312Smsmith# Set up the list of CPU features based on the CPU type.  This is an
8265312Smsmith# unordered list to make it easy for client makefiles to test for the
8396554Sobrien# presence of a CPU feature.
8465312Smsmith
8596554Sobrien.if ${MACHINE_ARCH} == "i386"
8665312Smsmith. if ${CPUTYPE} == "k7"
8765312SmsmithMACHINE_CPU = k7 3dnow mmx k6 k5 i586 i486 i386
8896554Sobrien. elif ${CPUTYPE} == "k6-2"
8965312SmsmithMACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
9065312Smsmith. elif ${CPUTYPE} == "k6"
9165312SmsmithMACHINE_CPU = mmx k6 k5 i586 i486 i386
9296551Sobrien. elif ${CPUTYPE} == "k5"
9365312SmsmithMACHINE_CPU = k5 i586 i486 i386
9465312Smsmith. elif ${CPUTYPE} == "p4"
9565312SmsmithMACHINE_CPU = sse i686 mmx i586 i486 i386
9696551Sobrien. elif ${CPUTYPE} == "p3"
9765312SmsmithMACHINE_CPU = sse i686 mmx i586 i486 i386
9865312Smsmith. elif ${CPUTYPE} == "p2"
9965312SmsmithMACHINE_CPU = i686 mmx i586 i486 i386
10096551Sobrien. elif ${CPUTYPE} == "i686"
10165312SmsmithMACHINE_CPU = i686 i586 i486 i386
10265312Smsmith. elif ${CPUTYPE} == "i586/mmx"
10365312SmsmithMACHINE_CPU = mmx i586 i486 i386
10496554Sobrien. elif ${CPUTYPE} == "i586"
10565312SmsmithMACHINE_CPU = i586 i486 i386
10665312Smsmith. elif ${CPUTYPE} == "i486"
10765312SmsmithMACHINE_CPU = i486 i386
10865312Smsmith. elif ${CPUTYPE} == "i386"
10965312SmsmithMACHINE_CPU = i386
11065312Smsmith. endif
11196614Sobrien.elif ${MACHINE_ARCH} == "alpha"
11296551Sobrien. if ${CPUTYPE} == "ev6"
11365312SmsmithMACHINE_CPU = ev6 ev56 pca56 ev5 ev45 ev4
11496551Sobrien. elif ${CPUTYPE} == "pca56"
11565312SmsmithMACHINE_CPU = pca56 ev56 ev5 ev45 ev4
11665312Smsmith. elif ${CPUTYPE} == "ev56"
11796614SobrienMACHINE_CPU = ev56 ev5 ev45 ev4
11896551Sobrien. elif ${CPUTYPE} == "ev5"
11965312SmsmithMACHINE_CPU = ev5 ev45 ev4
12065312Smsmith. elif ${CPUTYPE} == "ev45"
12196614SobrienMACHINE_CPU = ev45 ev4
12296614Sobrien. elif ${CPUTYPE} == "ev4"
12396551SobrienMACHINE_CPU = ev4
12465312Smsmith. endif
12565312Smsmith.elif ${MACHINE_ARCH} == "ia64"
12696614Sobrien. if ${CPUTYPE} == "itanium"
12796551SobrienMACHINE_CPU = itanium
12865312Smsmith. endif
12965312Smsmith.endif
13096614Sobrien