1 # $DragonFly: src/share/mk/Attic/bsd.cpu.gcc40.mk,v 1.2 2006/08/25 22:37:08 swildner Exp $
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.
7 .if !defined(CPUTYPE) || empty(CPUTYPE)
8 . if ${MACHINE_ARCH} == "i386"
9 _CPUCFLAGS = -mtune=pentiumpro
11 .elif ${MACHINE_ARCH} == "amd64"
12 MACHINE_CPU = amd64 sse2 sse
16 # Handle aliases (not documented in make.conf to avoid user confusion
17 # between e.g. i586 and pentium)
19 . if ${MACHINE_ARCH} == "i386"
20 . if ${CPUTYPE} == "pentiumpro"
22 . elif ${CPUTYPE} == "pentium"
24 . elif ${CPUTYPE} == "k7"
29 # Logic to set up correct gcc optimization flag. This must be included
30 # after /etc/make.conf so it can react to the local value of CPUTYPE
31 # defined therein. Consult:
32 # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html
33 # http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html
34 # http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html
36 . if ${MACHINE_ARCH} == "i386"
37 . if ${CPUTYPE} == "k8" || ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "athlon-fx"
38 _CPUCFLAGS = -march=${CPUTYPE}
39 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || ${CPUTYPE} == "athlon-4" || ${CPUTYPE} == "athlon-tbird" || ${CPUTYPE} == "athlon"
40 _CPUCFLAGS = -march=${CPUTYPE}
41 . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" || ${CPUTYPE} == "k6"
42 _CPUCFLAGS = -march=${CPUTYPE}
43 . elif ${CPUTYPE} == "k5"
44 _CPUCFLAGS = -march=pentium
45 . elif ${CPUTYPE} == "p4"
46 _CPUCFLAGS = -march=pentium4
47 . elif ${CPUTYPE} == "p3"
48 _CPUCFLAGS = -march=pentium3
49 . elif ${CPUTYPE} == "p2"
50 _CPUCFLAGS = -march=pentium2
51 . elif ${CPUTYPE} == "i686"
52 _CPUCFLAGS = -march=pentiumpro
53 . elif ${CPUTYPE} == "i586/mmx"
54 _CPUCFLAGS = -march=pentium-mmx
55 . elif ${CPUTYPE} == "i586"
56 _CPUCFLAGS = -march=pentium
57 . elif ${CPUTYPE} == "i486"
58 _CPUCFLAGS = -march=i486
62 # Set up the list of CPU features based on the CPU type. This is an
63 # unordered list to make it easy for client makefiles to test for the
64 # presence of a CPU feature.
66 .if ${MACHINE_ARCH} == "i386"
67 . if ${CPUTYPE} == "k8" || ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "athlon-fx"
68 MACHINE_CPU = athlon-xp k7 3dnow sse mmx k6 k5 i586 i486 i386
69 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || ${CPUTYPE} == "athlon-4"
70 MACHINE_CPU = athlon-xp k7 3dnow sse mmx k6 k5 i586 i486 i386
71 . elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird"
72 MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386
73 . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2"
74 MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
75 . elif ${CPUTYPE} == "k6"
76 MACHINE_CPU = mmx k6 k5 i586 i486 i386
77 . elif ${CPUTYPE} == "k5"
78 MACHINE_CPU = k5 i586 i486 i386
79 . elif ${CPUTYPE} == "p4"
80 MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386
81 . elif ${CPUTYPE} == "p3"
82 MACHINE_CPU = sse i686 mmx i586 i486 i386
83 . elif ${CPUTYPE} == "p2"
84 MACHINE_CPU = i686 mmx i586 i486 i386
85 . elif ${CPUTYPE} == "i686"
86 MACHINE_CPU = i686 i586 i486 i386
87 . elif ${CPUTYPE} == "i586/mmx"
88 MACHINE_CPU = mmx i586 i486 i386
89 . elif ${CPUTYPE} == "i586"
90 MACHINE_CPU = i586 i486 i386
91 . elif ${CPUTYPE} == "i486"
92 MACHINE_CPU = i486 i386
93 . elif ${CPUTYPE} == "i386"
96 . elif ${MACHINE_ARCH} == "amd64"
97 MACHINE_CPU = amd64 sse2 sse