bsd.cpu.mk revision 125252
133965Sjdp# $FreeBSD: head/share/mk/bsd.cpu.mk 125252 2004-01-30 19:51:26Z jhb $ 2130561Sobrien 360484Sobrien# Set default CPU compile flags and baseline CPUTYPE for each arch. The 433965Sjdp# compile flags must support the minimum CPU type for each architecture but 533965Sjdp# may tune support for more advanced processors. 633965Sjdp 733965Sjdp.if !defined(CPUTYPE) || empty(CPUTYPE) 833965Sjdp. if ${MACHINE_ARCH} == "i386" 933965Sjdp_CPUCFLAGS = 1033965SjdpMACHINE_CPU = i486 1133965Sjdp. elif ${MACHINE_ARCH} == "alpha" 1233965Sjdp_CPUCFLAGS = -mcpu=ev4 -mtune=ev5 1333965SjdpMACHINE_CPU = ev4 1433965Sjdp.elif ${MACHINE_ARCH} == "amd64" 1533965SjdpMACHINE_CPU = amd64 sse2 sse 1633965Sjdp. elif ${MACHINE_ARCH} == "ia64" 1733965Sjdp_CPUCFLAGS = 1833965SjdpMACHINE_CPU = itanium 1933965Sjdp. elif ${MACHINE_ARCH} == "sparc64" 2033965Sjdp_CPUCFLAGS = 2133965Sjdp. endif 2233965Sjdp.else 2333965Sjdp 2433965Sjdp# Handle aliases (not documented in make.conf to avoid user confusion 2533965Sjdp# between e.g. i586 and pentium) 2633965Sjdp 2777298Sobrien. if ${MACHINE_ARCH} == "i386" 2833965Sjdp. if ${CPUTYPE} == "pentiumpro" 2933965SjdpCPUTYPE = i686 3033965Sjdp. elif ${CPUTYPE} == "pentium" 3177298SobrienCPUTYPE = i586 32130561Sobrien. elif ${CPUTYPE} == "k7" 3333965SjdpCPUTYPE = athlon 3433965Sjdp. endif 3533965Sjdp. endif 3633965Sjdp 3733965Sjdp# Logic to set up correct gcc optimization flag. This must be included 3833965Sjdp# after /etc/make.conf so it can react to the local value of CPUTYPE 3933965Sjdp# defined therein. Consult: 4033965Sjdp# http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html 4133965Sjdp# http://gcc.gnu.org/onlinedocs/gcc/DEC-Alpha-Options.html 4233965Sjdp# http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html 4333965Sjdp# http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html 4433965Sjdp 4533965Sjdp. if ${MACHINE_ARCH} == "i386" 4633965Sjdp. if ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || ${CPUTYPE} == "athlon-4" || ${CPUTYPE} == "athlon-tbird" || ${CPUTYPE} == "athlon" 4733965Sjdp_CPUCFLAGS = -march=${CPUTYPE} 4833965Sjdp. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" || ${CPUTYPE} == "k6" 4933965Sjdp_CPUCFLAGS = -march=${CPUTYPE} 5033965Sjdp. elif ${CPUTYPE} == "k5" 5133965Sjdp_CPUCFLAGS = -march=pentium 5233965Sjdp. elif ${CPUTYPE} == "p4" 5333965Sjdp_CPUCFLAGS = -march=pentium4 5433965Sjdp. elif ${CPUTYPE} == "p3" 5577298Sobrien_CPUCFLAGS = -march=pentium3 5633965Sjdp. elif ${CPUTYPE} == "p2" 5733965Sjdp_CPUCFLAGS = -march=pentium2 5833965Sjdp. elif ${CPUTYPE} == "i686" 5933965Sjdp_CPUCFLAGS = -march=pentiumpro 6033965Sjdp. elif ${CPUTYPE} == "i586/mmx" 6133965Sjdp_CPUCFLAGS = -march=pentium-mmx 6233965Sjdp. elif ${CPUTYPE} == "i586" 6333965Sjdp_CPUCFLAGS = -march=pentium 6433965Sjdp. elif ${CPUTYPE} == "i486" 6533965Sjdp_CPUCFLAGS = -march=i486 6633965Sjdp. endif 6733965Sjdp. elif ${MACHINE_ARCH} == "alpha" 6833965Sjdp. if ${CPUTYPE} == "ev67" 6933965Sjdp_CPUCFLAGS = -mcpu=ev67 7033965Sjdp. elif ${CPUTYPE} == "ev6" 7133965Sjdp_CPUCFLAGS = -mcpu=ev6 7233965Sjdp. elif ${CPUTYPE} == "pca56" 7333965Sjdp_CPUCFLAGS = -mcpu=pca56 7433965Sjdp. elif ${CPUTYPE} == "ev56" 7533965Sjdp_CPUCFLAGS = -mcpu=ev56 7633965Sjdp. elif ${CPUTYPE} == "ev5" 7733965Sjdp_CPUCFLAGS = -mcpu=ev5 7833965Sjdp. elif ${CPUTYPE} == "ev45" 7933965Sjdp_CPUCFLAGS = -mcpu=ev45 8033965Sjdp. elif ${CPUTYPE} == "ev4" 8133965Sjdp_CPUCFLAGS = -mcpu=ev4 8233965Sjdp. endif 8333965Sjdp. endif 8433965Sjdp 8533965Sjdp# Set up the list of CPU features based on the CPU type. This is an 8633965Sjdp# unordered list to make it easy for client makefiles to test for the 8733965Sjdp# presence of a CPU feature. 8833965Sjdp 8933965Sjdp.if ${MACHINE_ARCH} == "i386" 9033965Sjdp. if ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || ${CPUTYPE} == "athlon-4" 9133965SjdpMACHINE_CPU = athlon-xp k7 3dnow sse mmx k6 k5 i586 i486 i386 9233965Sjdp. elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird" 9333965SjdpMACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386 9433965Sjdp. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" 9533965SjdpMACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386 9633965Sjdp. elif ${CPUTYPE} == "k6" 9733965SjdpMACHINE_CPU = mmx k6 k5 i586 i486 i386 9833965Sjdp. elif ${CPUTYPE} == "k5" 9933965SjdpMACHINE_CPU = k5 i586 i486 i386 10033965Sjdp. elif ${CPUTYPE} == "p4" 10133965SjdpMACHINE_CPU = sse2 sse i686 mmx i586 i486 i386 10233965Sjdp. elif ${CPUTYPE} == "p3" 10333965SjdpMACHINE_CPU = sse i686 mmx i586 i486 i386 10433965Sjdp. elif ${CPUTYPE} == "p2" 10533965SjdpMACHINE_CPU = i686 mmx i586 i486 i386 10633965Sjdp. elif ${CPUTYPE} == "i686" 107130561SobrienMACHINE_CPU = i686 i586 i486 i386 108130561Sobrien. elif ${CPUTYPE} == "i586/mmx" 10933965SjdpMACHINE_CPU = mmx i586 i486 i386 11089857Sobrien. elif ${CPUTYPE} == "i586" 11133965SjdpMACHINE_CPU = i586 i486 i386 112130561Sobrien. elif ${CPUTYPE} == "i486" 113130561SobrienMACHINE_CPU = i486 i386 114130561Sobrien. elif ${CPUTYPE} == "i386" 11533965SjdpMACHINE_CPU = i386 116130561Sobrien. endif 11733965Sjdp. elif ${MACHINE_ARCH} == "alpha" 11833965Sjdp. if ${CPUTYPE} == "ev6" 119130561SobrienMACHINE_CPU = ev6 ev56 pca56 ev5 ev45 ev4 12033965Sjdp. elif ${CPUTYPE} == "pca56" 121130561SobrienMACHINE_CPU = pca56 ev56 ev5 ev45 ev4 12233965Sjdp. elif ${CPUTYPE} == "ev56" 123130561SobrienMACHINE_CPU = ev56 ev5 ev45 ev4 12477298Sobrien. elif ${CPUTYPE} == "ev5" 12533965SjdpMACHINE_CPU = ev5 ev45 ev4 12633965Sjdp. elif ${CPUTYPE} == "ev45" 12733965SjdpMACHINE_CPU = ev45 ev4 12833965Sjdp. elif ${CPUTYPE} == "ev4" 12933965SjdpMACHINE_CPU = ev4 13033965Sjdp. endif 13133965Sjdp. elif ${MACHINE_ARCH} == "amd64" 13233965SjdpMACHINE_CPU = amd64 sse2 sse 13333965Sjdp. elif ${MACHINE_ARCH} == "ia64" 13433965Sjdp. if ${CPUTYPE} == "itanium" 13533965SjdpMACHINE_CPU = itanium 13633965Sjdp. endif 13733965Sjdp. endif 13833965Sjdp.endif 13933965Sjdp 14033965Sjdp.if ${MACHINE_ARCH} == "alpha" 14133965Sjdp_CPUCFLAGS += -mieee 14233965Sjdp.endif 14333965Sjdp 14433965Sjdp# NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk 14533965Sjdp 14633965Sjdp.if !defined(NO_CPU_CFLAGS) 14733965SjdpCFLAGS += ${_CPUCFLAGS} 14833965Sjdp.endif 14933965Sjdp