bsd.cpu.mk revision 103561
172878Skris# $FreeBSD: head/share/mk/bsd.cpu.mk 103561 2002-09-18 20:48:54Z jhb $ 272878Skris 3100772Sjhb# Set default CPU compile flags and baseline CPUTYPE for each arch. The 4100772Sjhb# compile flags must support the minimum CPU type for each architecture but 5100772Sjhb# may tune support for more advanced processors. 672878Skris 7101232Sru.if !defined(CPUTYPE) || empty(CPUTYPE) 8100773Sjhb. if ${MACHINE_ARCH} == "i386" 9100772Sjhb_CPUCFLAGS = -mcpu=pentiumpro 10103560SjhbMACHINE_CPU = i386 11100773Sjhb. elif ${MACHINE_ARCH} == "alpha" 12100772Sjhb_CPUCFLAGS = -mcpu=ev4 -mtune=ev5 13103560SjhbMACHINE_CPU = ev4 14103560Sjhb.elif ${MACHINE_ARCH} == "x86-64" || ${MACHINE_ARCH} == "x86_64" 15103560SjhbMACHINE_CPU = x86-64 sse2 sse 16100773Sjhb. elif ${MACHINE_ARCH} == "ia64" 17100772Sjhb_CPUCFLAGS = 18103560SjhbMACHINE_CPU = itanium 19100773Sjhb. elif ${MACHINE_ARCH} == "sparc64" 20100772Sjhb_CPUCFLAGS = 21100773Sjhb. endif 22100772Sjhb.else 2372878Skris 2472878Skris# Handle aliases (not documented in make.conf to avoid user confusion 2572878Skris# between e.g. i586 and pentium) 2672878Skris 27100773Sjhb. if ${MACHINE_ARCH} == "i386" 28100773Sjhb. if ${CPUTYPE} == "pentiumpro" 2972878SkrisCPUTYPE = i686 30100773Sjhb. elif ${CPUTYPE} == "pentium" 3172878SkrisCPUTYPE = i586 32103045Smux. elif ${CPUTYPE} == "k7" 33103045SmuxCPUTYPE = athlon 34100773Sjhb. endif 3572878Skris. endif 3672878Skris 3796421Sobrien# Logic to set up correct gcc optimization flag. This must be included 3872878Skris# after /etc/make.conf so it can react to the local value of CPUTYPE 3996421Sobrien# defined therein. Consult: 4096421Sobrien# http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html 4196421Sobrien# http://gcc.gnu.org/onlinedocs/gcc/DEC-Alpha-Options.html 4296421Sobrien# http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html 4396421Sobrien# http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html 4472878Skris 4572878Skris. if ${MACHINE_ARCH} == "i386" 46103045Smux. if ${CPUTYPE} == "athlon-mp" 47103045Smux_CPUCFLAGS = -march=athlon-mp 48103045Smux. elif ${CPUTYPE} == "athlon-xp" 49103045Smux_CPUCFLAGS = -march=athlon-xp 50103045Smux. elif ${CPUTYPE} == "athlon-4" 51103045Smux_CPUCFLAGS = -march=athlon-4 52103045Smux. elif ${CPUTYPE} == "athlon-tbird" 53103045Smux_CPUCFLAGS = -march=athlon-tbird 54103045Smux. elif ${CPUTYPE} == "athlon" 5596419Sobrien_CPUCFLAGS = -march=athlon 56103045Smux. elif ${CPUTYPE} == "k6-3" 57103045Smux_CPUCFLAGS = -march=k6-3 5873145Skris. elif ${CPUTYPE} == "k6-2" 59103045Smux_CPUCFLAGS = -march=k6-2 6072878Skris. elif ${CPUTYPE} == "k6" 6174146Skris_CPUCFLAGS = -march=k6 6272878Skris. elif ${CPUTYPE} == "k5" 6374146Skris_CPUCFLAGS = -march=pentium 6473145Skris. elif ${CPUTYPE} == "p4" 65103045Smux_CPUCFLAGS = -march=pentium4 6673145Skris. elif ${CPUTYPE} == "p3" 67103045Smux_CPUCFLAGS = -march=pentium3 6873145Skris. elif ${CPUTYPE} == "p2" 69103045Smux_CPUCFLAGS = -march=pentium2 7072878Skris. elif ${CPUTYPE} == "i686" 7174146Skris_CPUCFLAGS = -march=pentiumpro 7273145Skris. elif ${CPUTYPE} == "i586/mmx" 7398159Ssobomax_CPUCFLAGS = -march=pentium-mmx 7472878Skris. elif ${CPUTYPE} == "i586" 7574146Skris_CPUCFLAGS = -march=pentium 7672878Skris. elif ${CPUTYPE} == "i486" 7794987Sru_CPUCFLAGS = -march=i486 7872878Skris. endif 7972878Skris. elif ${MACHINE_ARCH} == "alpha" 80103048Skris. if ${CPUTYPE} == "ev67" 81103048Skris_CPUCFLAGS = -mcpu=ev67 82103048Skris. elif ${CPUTYPE} == "ev6" 8374146Skris_CPUCFLAGS = -mcpu=ev6 8472878Skris. elif ${CPUTYPE} == "pca56" 8574146Skris_CPUCFLAGS = -mcpu=pca56 8672878Skris. elif ${CPUTYPE} == "ev56" 8774146Skris_CPUCFLAGS = -mcpu=ev56 8872878Skris. elif ${CPUTYPE} == "ev5" 8974146Skris_CPUCFLAGS = -mcpu=ev5 9072878Skris. elif ${CPUTYPE} == "ev45" 91103048Skris_CPUCFLAGS = -mcpu=ev45 9272878Skris. elif ${CPUTYPE} == "ev4" 9374146Skris_CPUCFLAGS = -mcpu=ev4 9472878Skris. endif 9572878Skris. endif 9672878Skris 9772878Skris# Set up the list of CPU features based on the CPU type. This is an 9872878Skris# unordered list to make it easy for client makefiles to test for the 9972878Skris# presence of a CPU feature. 10072878Skris 10172878Skris.if ${MACHINE_ARCH} == "i386" 102103045Smux. if ${CPUTYPE} == "athlon-mp" 103103045SmuxMACHINE_CPU = sse k7 3dnow mmx k6 k5 i586 i486 i386 104103045Smux. elif ${CPUTYPE} == "athlon-xp" 105103045SmuxMACHINE_CPU = sse k7 3dnow mmx k6 k5 i586 i486 i386 106103045Smux. elif ${CPUTYPE} == "athlon-4" 107103045SmuxMACHINE_CPU = sse k7 3dnow mmx k6 k5 i586 i486 i386 108103045Smux. elif ${CPUTYPE} == "athlon-tbird" 10996421SobrienMACHINE_CPU = k7 3dnow mmx k6 k5 i586 i486 i386 110103045Smux. elif ${CPUTYPE} == "athlon" 111103045SmuxMACHINE_CPU = k7 3dnow mmx k6 k5 i586 i486 i386 112103045Smux. elif ${CPUTYPE} == "k6-3" 113103045SmuxMACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386 11473145Skris. elif ${CPUTYPE} == "k6-2" 11574069SsobomaxMACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386 11672878Skris. elif ${CPUTYPE} == "k6" 11774069SsobomaxMACHINE_CPU = mmx k6 k5 i586 i486 i386 11872878Skris. elif ${CPUTYPE} == "k5" 11972878SkrisMACHINE_CPU = k5 i586 i486 i386 12073145Skris. elif ${CPUTYPE} == "p4" 121103045SmuxMACHINE_CPU = sse2 sse i686 mmx i586 i486 i386 12273145Skris. elif ${CPUTYPE} == "p3" 12373145SkrisMACHINE_CPU = sse i686 mmx i586 i486 i386 12473145Skris. elif ${CPUTYPE} == "p2" 12574553SkrisMACHINE_CPU = i686 mmx i586 i486 i386 12672878Skris. elif ${CPUTYPE} == "i686" 12772878SkrisMACHINE_CPU = i686 i586 i486 i386 12873145Skris. elif ${CPUTYPE} == "i586/mmx" 12973145SkrisMACHINE_CPU = mmx i586 i486 i386 13072878Skris. elif ${CPUTYPE} == "i586" 13172878SkrisMACHINE_CPU = i586 i486 i386 13272878Skris. elif ${CPUTYPE} == "i486" 13372878SkrisMACHINE_CPU = i486 i386 13472878Skris. elif ${CPUTYPE} == "i386" 13572878SkrisMACHINE_CPU = i386 13672878Skris. endif 13772878Skris.elif ${MACHINE_ARCH} == "alpha" 13872878Skris. if ${CPUTYPE} == "ev6" 13972878SkrisMACHINE_CPU = ev6 ev56 pca56 ev5 ev45 ev4 14072878Skris. elif ${CPUTYPE} == "pca56" 14172878SkrisMACHINE_CPU = pca56 ev56 ev5 ev45 ev4 14272878Skris. elif ${CPUTYPE} == "ev56" 14372878SkrisMACHINE_CPU = ev56 ev5 ev45 ev4 14472878Skris. elif ${CPUTYPE} == "ev5" 14572878SkrisMACHINE_CPU = ev5 ev45 ev4 14672878Skris. elif ${CPUTYPE} == "ev45" 14772878SkrisMACHINE_CPU = ev45 ev4 14872878Skris. elif ${CPUTYPE} == "ev4" 14972878SkrisMACHINE_CPU = ev4 15072878Skris. endif 151103211Sobrien.elif ${MACHINE_ARCH} == "x86-64" || ${MACHINE_ARCH} == "x86_64" 152103211SobrienMACHINE_CPU = x86-64 sse2 sse 15372878Skris.elif ${MACHINE_ARCH} == "ia64" 15472878Skris. if ${CPUTYPE} == "itanium" 15572878SkrisMACHINE_CPU = itanium 15672878Skris. endif 15772878Skris.endif 158103560Sjhb.endif 159103561Sjhb 160103561Sjhb# NB: COPTFLAGS is handled in /usr/src/sys/conf/Makefile.<arch> 161103561Sjhb 162103561Sjhb.if !defined(NO_CPU_CFLAGS) 163103561SjhbCFLAGS += ${_CPUCFLAGS} 164103561Sjhb.endif 165