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 = i486 11. elif ${MACHINE_ARCH} == "alpha" 12_CPUCFLAGS = -mcpu=ev4 -mtune=ev5 13MACHINE_CPU = ev4 14.elif ${MACHINE_ARCH} == "amd64" 15MACHINE_CPU = amd64 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" || ${CPUTYPE} == "athlon-xp" || ${CPUTYPE} == "athlon-4" || ${CPUTYPE} == "athlon-tbird" || ${CPUTYPE} == "athlon" 47_CPUCFLAGS = -march=${CPUTYPE} 48. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" || ${CPUTYPE} == "k6" 49_CPUCFLAGS = -march=${CPUTYPE} 50. elif ${CPUTYPE} == "k5" 51_CPUCFLAGS = -march=pentium 52. elif ${CPUTYPE} == "p4" 53# gcc 3.2 is known to produce broken code with -march=pentium4, so it is 54# disabled for now. This is fixed in gcc 3.3. 55_CPUCFLAGS = -march=pentium3 56. elif ${CPUTYPE} == "p3" 57_CPUCFLAGS = -march=pentium3 58. elif ${CPUTYPE} == "p2" 59_CPUCFLAGS = -march=pentium2 60. elif ${CPUTYPE} == "i686" 61_CPUCFLAGS = -march=pentiumpro 62. elif ${CPUTYPE} == "i586/mmx" 63_CPUCFLAGS = -march=pentium-mmx 64. elif ${CPUTYPE} == "i586" 65_CPUCFLAGS = -march=pentium 66. elif ${CPUTYPE} == "i486" 67_CPUCFLAGS = -march=i486 68. endif 69. elif ${MACHINE_ARCH} == "alpha" 70. if ${CPUTYPE} == "ev67" 71_CPUCFLAGS = -mcpu=ev67 72. elif ${CPUTYPE} == "ev6" 73_CPUCFLAGS = -mcpu=ev6 74. elif ${CPUTYPE} == "pca56" 75_CPUCFLAGS = -mcpu=pca56 76. elif ${CPUTYPE} == "ev56" 77_CPUCFLAGS = -mcpu=ev56 78. elif ${CPUTYPE} == "ev5" 79_CPUCFLAGS = -mcpu=ev5 80. elif ${CPUTYPE} == "ev45" 81_CPUCFLAGS = -mcpu=ev45 82. elif ${CPUTYPE} == "ev4" 83_CPUCFLAGS = -mcpu=ev4 84. endif 85. endif 86 87# Set up the list of CPU features based on the CPU type. This is an 88# unordered list to make it easy for client makefiles to test for the 89# presence of a CPU feature. 90 91.if ${MACHINE_ARCH} == "i386" 92. if ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || ${CPUTYPE} == "athlon-4" 93MACHINE_CPU = athlon-xp k7 3dnow sse mmx k6 k5 i586 i486 i386 94. elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird" 95MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386 96. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" 97MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386 98. elif ${CPUTYPE} == "k6" 99MACHINE_CPU = mmx k6 k5 i586 i486 i386 100. elif ${CPUTYPE} == "k5" 101MACHINE_CPU = k5 i586 i486 i386 102. elif ${CPUTYPE} == "p4" 103MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386 104. elif ${CPUTYPE} == "p3" 105MACHINE_CPU = sse i686 mmx i586 i486 i386 106. elif ${CPUTYPE} == "p2" 107MACHINE_CPU = i686 mmx i586 i486 i386 108. elif ${CPUTYPE} == "i686" 109MACHINE_CPU = i686 i586 i486 i386 110. elif ${CPUTYPE} == "i586/mmx" 111MACHINE_CPU = mmx i586 i486 i386 112. elif ${CPUTYPE} == "i586" 113MACHINE_CPU = i586 i486 i386 114. elif ${CPUTYPE} == "i486" 115MACHINE_CPU = i486 i386 116. elif ${CPUTYPE} == "i386" 117MACHINE_CPU = i386 118. endif 119. elif ${MACHINE_ARCH} == "alpha" 120. if ${CPUTYPE} == "ev6" 121MACHINE_CPU = ev6 ev56 pca56 ev5 ev45 ev4 122. elif ${CPUTYPE} == "pca56" 123MACHINE_CPU = pca56 ev56 ev5 ev45 ev4 124. elif ${CPUTYPE} == "ev56" 125MACHINE_CPU = ev56 ev5 ev45 ev4 126. elif ${CPUTYPE} == "ev5" 127MACHINE_CPU = ev5 ev45 ev4 128. elif ${CPUTYPE} == "ev45" 129MACHINE_CPU = ev45 ev4 130. elif ${CPUTYPE} == "ev4" 131MACHINE_CPU = ev4 132. endif 133. elif ${MACHINE_ARCH} == "amd64" 134MACHINE_CPU = amd64 sse2 sse 135. elif ${MACHINE_ARCH} == "ia64" 136. if ${CPUTYPE} == "itanium" 137MACHINE_CPU = itanium 138. endif 139. endif 140.endif 141 142.if ${MACHINE_ARCH} == "alpha" 143_CPUCFLAGS += -mieee 144.endif 145 146# NB: COPTFLAGS is handled in /usr/src/sys/conf/Makefile.<arch> 147 148.if !defined(NO_CPU_CFLAGS) 149CFLAGS += ${_CPUCFLAGS} 150.endif 151