Merge from vendor branch LIBARCHIVE:
[dragonfly.git] / share / mk / bsd.cpu.gcc41.mk
1 # $DragonFly: src/share/mk/bsd.cpu.gcc41.mk,v 1.3 2007/01/19 10:38:59 corecode Exp $
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 = -mtune=pentiumpro
10 MACHINE_CPU = i486
11 .elif ${MACHINE_ARCH} == "amd64"
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"
20 .  if ${CPUTYPE} == "pentiumpro"
21 CPUTYPE = i686
22 .  elif ${CPUTYPE} == "pentium"
23 CPUTYPE = i586
24 .  elif ${CPUTYPE} == "k7"
25 CPUTYPE = athlon
26 .  endif
27 . endif
28
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
35
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} == "pentium-m"
48 _CPUCFLAGS = -march=pentium-m
49 .  elif ${CPUTYPE} == "p3"
50 _CPUCFLAGS = -march=pentium3
51 .  elif ${CPUTYPE} == "p2"
52 _CPUCFLAGS = -march=pentium2
53 .  elif ${CPUTYPE} == "i686"
54 _CPUCFLAGS = -march=pentiumpro
55 .  elif ${CPUTYPE} == "i586/mmx"
56 _CPUCFLAGS = -march=pentium-mmx
57 .  elif ${CPUTYPE} == "i586"
58 _CPUCFLAGS = -march=pentium
59 .  elif ${CPUTYPE} == "i486"
60 _CPUCFLAGS = -march=i486
61 .  endif
62 . endif
63
64 # Set up the list of CPU features based on the CPU type.  This is an
65 # unordered list to make it easy for client makefiles to test for the
66 # presence of a CPU feature.
67
68 .if ${MACHINE_ARCH} == "i386"
69 . if ${CPUTYPE} == "k8" || ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "athlon-fx"
70 MACHINE_CPU = athlon-xp k7 3dnow sse mmx k6 k5 i586 i486 i386
71 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || ${CPUTYPE} == "athlon-4"
72 MACHINE_CPU = athlon-xp k7 3dnow sse mmx k6 k5 i586 i486 i386
73 . elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird"
74 MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386
75 . elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2"
76 MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
77 .  elif ${CPUTYPE} == "k6"
78 MACHINE_CPU = mmx k6 k5 i586 i486 i386
79 .  elif ${CPUTYPE} == "k5"
80 MACHINE_CPU = k5 i586 i486 i386
81 .  elif ${CPUTYPE} == "p4" || ${CPUTYPE} == "pentium-m"
82 MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386
83 .  elif ${CPUTYPE} == "p3"
84 MACHINE_CPU = sse i686 mmx i586 i486 i386
85 .  elif ${CPUTYPE} == "p2"
86 MACHINE_CPU = i686 mmx i586 i486 i386
87 .  elif ${CPUTYPE} == "i686"
88 MACHINE_CPU = i686 i586 i486 i386
89 .  elif ${CPUTYPE} == "i586/mmx"
90 MACHINE_CPU = mmx i586 i486 i386
91 .  elif ${CPUTYPE} == "i586"
92 MACHINE_CPU = i586 i486 i386
93 .  elif ${CPUTYPE} == "i486"
94 MACHINE_CPU = i486 i386
95 .  elif ${CPUTYPE} == "i386"
96 MACHINE_CPU = i386
97 .  else
98 .warning Unknown CPUTYPE=${CPUTYPE}
99 .  endif
100 . elif ${MACHINE_ARCH} == "amd64"
101 MACHINE_CPU = amd64 sse2 sse
102 . endif
103 .endif