1# $FreeBSD$ 2 3# Set default CPU compile flags and baseline CPUTYPE for each arch. The 4# compile flags must support the minimum CPU type for each architecture but 5# may tune support for more advanced processors. 6 7.if !defined(CPUTYPE) || empty(CPUTYPE) 8. if ${MACHINE_ARCH} == "i386" 9_CPUCFLAGS = -mcpu=pentiumpro 10MACHINE_CPU = i386 11. elif ${MACHINE_ARCH} == "alpha" 12_CPUCFLAGS = -mcpu=ev4 -mtune=ev5 13MACHINE_CPU = ev4 14.elif ${MACHINE_ARCH} == "x86-64" || ${MACHINE_ARCH} == "x86_64" 15MACHINE_CPU = x86-64 sse2 sse 16. elif ${MACHINE_ARCH} == "ia64" 17_CPUCFLAGS = 18MACHINE_CPU = itanium 19. elif ${MACHINE_ARCH} == "sparc64" 20_CPUCFLAGS = 21. endif 22.else 23 24# Handle aliases (not documented in make.conf to avoid user confusion 25# between e.g. i586 and pentium) 26 27. if ${MACHINE_ARCH} == "i386" 28. if ${CPUTYPE} == "pentiumpro" 29CPUTYPE = i686 30. elif ${CPUTYPE} == "pentium" 31CPUTYPE = i586 32. elif ${CPUTYPE} == "k7" 33CPUTYPE = athlon 34. endif 35. endif 36 37# Logic to set up correct gcc optimization flag. This must be included 38# after /etc/make.conf so it can react to the local value of CPUTYPE 39# defined therein. Consult: 40# http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html 41# http://gcc.gnu.org/onlinedocs/gcc/DEC-Alpha-Options.html 42# http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html 43# http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html 44 45. if ${MACHINE_ARCH} == "i386" 46. if ${CPUTYPE} == "athlon-mp" 47_CPUCFLAGS = -march=athlon-mp 48. elif ${CPUTYPE} == "athlon-xp" 49_CPUCFLAGS = -march=athlon-xp 50. elif ${CPUTYPE} == "athlon-4" 51_CPUCFLAGS = -march=athlon-4 52. elif ${CPUTYPE} == "athlon-tbird" 53_CPUCFLAGS = -march=athlon-tbird 54. elif ${CPUTYPE} == "athlon" 55_CPUCFLAGS = -march=athlon 56. elif ${CPUTYPE} == "k6-3" 57_CPUCFLAGS = -march=k6-3 58. elif ${CPUTYPE} == "k6-2" 59_CPUCFLAGS = -march=k6-2 60. elif ${CPUTYPE} == "k6" 61_CPUCFLAGS = -march=k6 62. elif ${CPUTYPE} == "k5" 63_CPUCFLAGS = -march=pentium 64. elif ${CPUTYPE} == "p4" 65_CPUCFLAGS = -march=pentium4 66. elif ${CPUTYPE} == "p3" 67_CPUCFLAGS = -march=pentium3 68. elif ${CPUTYPE} == "p2" 69_CPUCFLAGS = -march=pentium2 70. elif ${CPUTYPE} == "i686" 71_CPUCFLAGS = -march=pentiumpro 72. elif ${CPUTYPE} == "i586/mmx" 73_CPUCFLAGS = -march=pentium-mmx 74. elif ${CPUTYPE} == "i586" 75_CPUCFLAGS = -march=pentium 76. elif ${CPUTYPE} == "i486" 77_CPUCFLAGS = -march=i486 78. endif 79. elif ${MACHINE_ARCH} == "alpha" 80. if ${CPUTYPE} == "ev67" 81_CPUCFLAGS = -mcpu=ev67 82. elif ${CPUTYPE} == "ev6" 83_CPUCFLAGS = -mcpu=ev6 84. elif ${CPUTYPE} == "pca56" 85_CPUCFLAGS = -mcpu=pca56 86. elif ${CPUTYPE} == "ev56" 87_CPUCFLAGS = -mcpu=ev56 88. elif ${CPUTYPE} == "ev5" 89_CPUCFLAGS = -mcpu=ev5 90. elif ${CPUTYPE} == "ev45" 91_CPUCFLAGS = -mcpu=ev45 92. elif ${CPUTYPE} == "ev4" 93_CPUCFLAGS = -mcpu=ev4 94. endif 95. endif 96 97# Set up the list of CPU features based on the CPU type. This is an 98# unordered list to make it easy for client makefiles to test for the 99# presence of a CPU feature. 100 101. if ${MACHINE_ARCH} == "i386" 102. if ${CPUTYPE} == "athlon-mp" 103MACHINE_CPU = sse k7 3dnow mmx k6 k5 i586 i486 i386 104. elif ${CPUTYPE} == "athlon-xp" 105MACHINE_CPU = sse k7 3dnow mmx k6 k5 i586 i486 i386 106. elif ${CPUTYPE} == "athlon-4" 107MACHINE_CPU = sse k7 3dnow mmx k6 k5 i586 i486 i386 108. elif ${CPUTYPE} == "athlon-tbird" 109MACHINE_CPU = k7 3dnow mmx k6 k5 i586 i486 i386 110. elif ${CPUTYPE} == "athlon" 111MACHINE_CPU = k7 3dnow mmx k6 k5 i586 i486 i386 112. elif ${CPUTYPE} == "k6-3" 113MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386 114. elif ${CPUTYPE} == "k6-2" 115MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386 116. elif ${CPUTYPE} == "k6" 117MACHINE_CPU = mmx k6 k5 i586 i486 i386 118. elif ${CPUTYPE} == "k5" 119MACHINE_CPU = k5 i586 i486 i386 120. elif ${CPUTYPE} == "p4" 121MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386 122. elif ${CPUTYPE} == "p3" 123MACHINE_CPU = sse i686 mmx i586 i486 i386 124. elif ${CPUTYPE} == "p2" 125MACHINE_CPU = i686 mmx i586 i486 i386 126. elif ${CPUTYPE} == "i686" 127MACHINE_CPU = i686 i586 i486 i386 128. elif ${CPUTYPE} == "i586/mmx" 129MACHINE_CPU = mmx i586 i486 i386 130. elif ${CPUTYPE} == "i586" 131MACHINE_CPU = i586 i486 i386 132. elif ${CPUTYPE} == "i486" 133MACHINE_CPU = i486 i386 134. elif ${CPUTYPE} == "i386" 135MACHINE_CPU = i386 136. endif 137. elif ${MACHINE_ARCH} == "alpha" 138. if ${CPUTYPE} == "ev6" 139MACHINE_CPU = ev6 ev56 pca56 ev5 ev45 ev4 140. elif ${CPUTYPE} == "pca56" 141MACHINE_CPU = pca56 ev56 ev5 ev45 ev4 142. elif ${CPUTYPE} == "ev56" 143MACHINE_CPU = ev56 ev5 ev45 ev4 144. elif ${CPUTYPE} == "ev5" 145MACHINE_CPU = ev5 ev45 ev4 146. elif ${CPUTYPE} == "ev45" 147MACHINE_CPU = ev45 ev4 148. elif ${CPUTYPE} == "ev4" 149MACHINE_CPU = ev4 150. endif 151. elif ${MACHINE_ARCH} == "x86-64" || ${MACHINE_ARCH} == "x86_64" 152MACHINE_CPU = x86-64 sse2 sse 153. elif ${MACHINE_ARCH} == "ia64" 154. if ${CPUTYPE} == "itanium" 155MACHINE_CPU = itanium 156. endif 157. endif 158.endif 159 160# NB: COPTFLAGS is handled in /usr/src/sys/conf/Makefile.<arch> 161 162.if !defined(NO_CPU_CFLAGS) 163CFLAGS += ${_CPUCFLAGS} 164.endif 165