| Commit | Line | Data |
|---|---|---|
| 650da96a | 1 | # $DragonFly: src/share/mk/bsd.cpu.gcc41.mk,v 1.4 2008/01/05 13:37:15 corecode Exp $ |
| ddf7cc86 SS |
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) | |
| 650da96a | 8 | _CPUCFLAGS = |
| ddf7cc86 | 9 | . if ${MACHINE_ARCH} == "i386" |
| ddf7cc86 | 10 | MACHINE_CPU = i486 |
| 650da96a | 11 | . elif ${MACHINE_ARCH} == "amd64" |
| ddf7cc86 SS |
12 | MACHINE_CPU = amd64 sse2 sse |
| 13 | . endif | |
| 14 | .else | |
| 15 | ||
| 16 | # Handle aliases (not documented in make.conf to avoid user confusion | |
| 17 | # between e.g. i586 and pentium) | |
| 18 | ||
| 19 | . if ${MACHINE_ARCH} == "i386" | |
| 650da96a SS |
20 | . if ${CPUTYPE} == "nocona" |
| 21 | CPUTYPE = prescott | |
| 22 | . elif ${CPUTYPE} == "core" || ${CPUTYPE} == "core2" | |
| 23 | CPUTYPE = prescott | |
| 24 | . elif ${CPUTYPE} == "p4" | |
| 25 | CPUTYPE = pentium4 | |
| 26 | . elif ${CPUTYPE} == "p4m" | |
| 27 | CPUTYPE = pentium4m | |
| 28 | . elif ${CPUTYPE} == "p3" | |
| 29 | CPUTYPE = pentium3 | |
| 30 | . elif ${CPUTYPE} == "p3m" | |
| 31 | CPUTYPE = pentium3m | |
| 32 | . elif ${CPUTYPE} == "p-m" | |
| 33 | CPUTYPE = pentium-m | |
| 34 | . elif ${CPUTYPE} == "p2" | |
| 35 | CPUTYPE = pentium2 | |
| 36 | . elif ${CPUTYPE} == "i686" | |
| 37 | CPUTYPE = pentiumpro | |
| 38 | . elif ${CPUTYPE} == "i586/mmx" | |
| 39 | CPUTYPE = pentium-mmx | |
| 40 | . elif ${CPUTYPE} == "i586" | |
| 41 | CPUTYPE = pentium | |
| 42 | . elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \ | |
| 43 | ${CPUTYPE} == "k8" | |
| 44 | CPUTYPE = athlon-mp | |
| ddf7cc86 SS |
45 | . elif ${CPUTYPE} == "k7" |
| 46 | CPUTYPE = athlon | |
| 47 | . endif | |
| 650da96a SS |
48 | . elif ${MACHINE_ARCH} == "amd64" |
| 49 | . if ${CPUTYPE} == "prescott" || ${CPUTYPE} == "core2" | |
| 50 | CPUTYPE = nocona | |
| 51 | . endif | |
| ddf7cc86 SS |
52 | . endif |
| 53 | ||
| 650da96a | 54 | ############################################################################### |
| ddf7cc86 SS |
55 | # Logic to set up correct gcc optimization flag. This must be included |
| 56 | # after /etc/make.conf so it can react to the local value of CPUTYPE | |
| 57 | # defined therein. Consult: | |
| 650da96a SS |
58 | # http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html |
| 59 | # http://gcc.gnu.org/onlinedocs/gcc/IA-64-Options.html | |
| ddf7cc86 | 60 | # http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html |
| 650da96a SS |
61 | # http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html |
| 62 | # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html | |
| ddf7cc86 SS |
63 | |
| 64 | . if ${MACHINE_ARCH} == "i386" | |
| 650da96a SS |
65 | . if ${CPUTYPE} == "crusoe" |
| 66 | _CPUCFLAGS = -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0 | |
| ddf7cc86 SS |
67 | . elif ${CPUTYPE} == "k5" |
| 68 | _CPUCFLAGS = -march=pentium | |
| 650da96a SS |
69 | . else |
| 70 | _CPUCFLAGS = -march=${CPUTYPE} | |
| 71 | . endif # GCC on 'i386' | |
| 72 | . elif ${MACHINE_ARCH} == "amd64" | |
| 73 | _CPUCFLAGS = -march=${CPUTYPE} | |
| ddf7cc86 SS |
74 | . endif |
| 75 | ||
| 76 | # Set up the list of CPU features based on the CPU type. This is an | |
| 77 | # unordered list to make it easy for client makefiles to test for the | |
| 78 | # presence of a CPU feature. | |
| 79 | ||
| 650da96a SS |
80 | . if ${MACHINE_ARCH} == "i386" |
| 81 | . if ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" | |
| 82 | MACHINE_CPU = athlon-xp athlon k7 3dnow sse2 sse mmx k6 k5 i586 i486 i386 | |
| 83 | . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \ | |
| 84 | ${CPUTYPE} == "athlon-4" | |
| 85 | MACHINE_CPU = athlon-xp athlon k7 3dnow sse mmx k6 k5 i586 i486 i386 | |
| 86 | . elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird" | |
| ddf7cc86 | 87 | MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386 |
| 650da96a | 88 | . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" |
| ddf7cc86 SS |
89 | MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386 |
| 90 | . elif ${CPUTYPE} == "k6" | |
| 91 | MACHINE_CPU = mmx k6 k5 i586 i486 i386 | |
| 92 | . elif ${CPUTYPE} == "k5" | |
| 93 | MACHINE_CPU = k5 i586 i486 i386 | |
| 650da96a SS |
94 | . elif ${CPUTYPE} == "c3" |
| 95 | MACHINE_CPU = 3dnow mmx i586 i486 i386 | |
| 96 | . elif ${CPUTYPE} == "c3-2" | |
| 97 | MACHINE_CPU = sse mmx i586 i486 i386 | |
| 98 | . elif ${CPUTYPE} == "prescott" | |
| 99 | MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386 | |
| 100 | . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m" || ${CPUTYPE} == "pentium-m" | |
| ddf7cc86 | 101 | MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386 |
| 650da96a | 102 | . elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m" |
| ddf7cc86 | 103 | MACHINE_CPU = sse i686 mmx i586 i486 i386 |
| 650da96a | 104 | . elif ${CPUTYPE} == "pentium2" |
| ddf7cc86 | 105 | MACHINE_CPU = i686 mmx i586 i486 i386 |
| 650da96a | 106 | . elif ${CPUTYPE} == "pentiumpro" |
| ddf7cc86 | 107 | MACHINE_CPU = i686 i586 i486 i386 |
| 650da96a | 108 | . elif ${CPUTYPE} == "pentium-mmx" |
| ddf7cc86 | 109 | MACHINE_CPU = mmx i586 i486 i386 |
| 650da96a | 110 | . elif ${CPUTYPE} == "pentium" |
| ddf7cc86 SS |
111 | MACHINE_CPU = i586 i486 i386 |
| 112 | . elif ${CPUTYPE} == "i486" | |
| 113 | MACHINE_CPU = i486 i386 | |
| 114 | . elif ${CPUTYPE} == "i386" | |
| 115 | MACHINE_CPU = i386 | |
| 116 | . endif | |
| 117 | . elif ${MACHINE_ARCH} == "amd64" | |
| 650da96a SS |
118 | . if ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "k8" |
| 119 | MACHINE_CPU = k8 3dnow | |
| 120 | . elif ${CPUTYPE} == "nocona" | |
| 121 | MACHINE_CPU = sse3 | |
| 122 | . endif | |
| 123 | MACHINE_CPU += amd64 sse2 sse mmx | |
| ddf7cc86 SS |
124 | . endif |
| 125 | .endif |