Merge branches 'master' and 'suser_to_priv'
[dragonfly.git] / share / mk / bsd.cpu.gcc34.mk
blobe2097a01fb5d7f51420b1827ad7f367160313ea1
1 # $DragonFly: src/share/mk/bsd.cpu.gcc34.mk,v 1.4 2007/01/19 10:38:59 corecode 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
10 MACHINE_CPU = i486
11 .elif ${MACHINE_ARCH} == "amd64"
12 MACHINE_CPU = amd64 sse2 sse
13 . elif ${MACHINE_ARCH} == "ia64"
14 _CPUCFLAGS =
15 MACHINE_CPU = itanium
16 . elif ${MACHINE_ARCH} == "sparc64"
17 _CPUCFLAGS =
18 . endif
19 .else
21 # Handle aliases (not documented in make.conf to avoid user confusion
22 # between e.g. i586 and pentium)
24 . if ${MACHINE_ARCH} == "i386"
25 . if ${CPUTYPE} == "pentiumpro"
26 CPUTYPE = i686
27 . elif ${CPUTYPE} == "pentium"
28 CPUTYPE = i586
29 . elif ${CPUTYPE} == "k7"
30 CPUTYPE = athlon
31 . endif
32 . endif
34 # Logic to set up correct gcc optimization flag. This must be included
35 # after /etc/make.conf so it can react to the local value of CPUTYPE
36 # defined therein. Consult:
37 # http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html
38 # http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html
39 # http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html
41 . if ${MACHINE_ARCH} == "i386"
42 . if ${CPUTYPE} == "k8" || ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "athlon-fx"
43 _CPUCFLAGS = -march=${CPUTYPE}
44 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || ${CPUTYPE} == "athlon-4" || ${CPUTYPE} == "athlon-tbird" || ${CPUTYPE} == "athlon"
45 _CPUCFLAGS = -march=${CPUTYPE}
46 . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" || ${CPUTYPE} == "k6"
47 _CPUCFLAGS = -march=${CPUTYPE}
48 . elif ${CPUTYPE} == "k5"
49 _CPUCFLAGS = -march=pentium
50 . elif ${CPUTYPE} == "p4"
51 _CPUCFLAGS = -march=pentium4
52 . elif ${CPUTYPE} == "pentium-m"
53 _CPUCFLAGS = -march=pentium-m
54 . elif ${CPUTYPE} == "p3"
55 _CPUCFLAGS = -march=pentium3
56 . elif ${CPUTYPE} == "p2"
57 _CPUCFLAGS = -march=pentium2
58 . elif ${CPUTYPE} == "i686"
59 _CPUCFLAGS = -march=pentiumpro
60 . elif ${CPUTYPE} == "i586/mmx"
61 _CPUCFLAGS = -march=pentium-mmx
62 . elif ${CPUTYPE} == "i586"
63 _CPUCFLAGS = -march=pentium
64 . elif ${CPUTYPE} == "i486"
65 _CPUCFLAGS = -march=i486
66 . endif
67 . endif
69 # Set up the list of CPU features based on the CPU type. This is an
70 # unordered list to make it easy for client makefiles to test for the
71 # presence of a CPU feature.
73 .if ${MACHINE_ARCH} == "i386"
74 . if ${CPUTYPE} == "k8" || ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "athlon-fx"
75 MACHINE_CPU = athlon-xp k7 3dnow sse mmx k6 k5 i586 i486 i386
76 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || ${CPUTYPE} == "athlon-4"
77 MACHINE_CPU = athlon-xp k7 3dnow sse mmx k6 k5 i586 i486 i386
78 . elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird"
79 MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386
80 . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2"
81 MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
82 . elif ${CPUTYPE} == "k6"
83 MACHINE_CPU = mmx k6 k5 i586 i486 i386
84 . elif ${CPUTYPE} == "k5"
85 MACHINE_CPU = k5 i586 i486 i386
86 . elif ${CPUTYPE} == "p4" || ${CPUTYPE} == "pentium-m"
87 MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386
88 . elif ${CPUTYPE} == "p3"
89 MACHINE_CPU = sse i686 mmx i586 i486 i386
90 . elif ${CPUTYPE} == "p2"
91 MACHINE_CPU = i686 mmx i586 i486 i386
92 . elif ${CPUTYPE} == "i686"
93 MACHINE_CPU = i686 i586 i486 i386
94 . elif ${CPUTYPE} == "i586/mmx"
95 MACHINE_CPU = mmx i586 i486 i386
96 . elif ${CPUTYPE} == "i586"
97 MACHINE_CPU = i586 i486 i386
98 . elif ${CPUTYPE} == "i486"
99 MACHINE_CPU = i486 i386
100 . elif ${CPUTYPE} == "i386"
101 MACHINE_CPU = i386
102 . else
103 .warning Unknown CPUTYPE=${CPUTYPE}
104 . endif
105 . elif ${MACHINE_ARCH} == "amd64"
106 MACHINE_CPU = amd64 sse2 sse
107 . elif ${MACHINE_ARCH} == "ia64"
108 . if ${CPUTYPE} == "itanium"
109 MACHINE_CPU = itanium
110 . else
111 .warning Unknown CPUTYPE=${CPUTYPE}
112 . endif
113 . endif
114 .endif