Merge from vendor branch FILE:
[dragonfly.git] / share / mk / bsd.cpu.gcc2.mk
1 # $FreeBSD: src/share/mk/bsd.cpu.mk,v 1.2.2.5 2002/07/19 08:09:32 ru Exp $
2 # $DragonFly: src/share/mk/Attic/bsd.cpu.gcc2.mk,v 1.4 2004/06/20 00:43:28 joerg Exp $
3
4 # Set default baseline values of CPUTYPE based on MACHINE_ARCH -- this is
5 # the minimum CPU type we support for each architecture
6
7 _CPUCFLAGS =
8 .if ${MACHINE_ARCH} == "i386"
9 CPUTYPE ?= i386
10 .elif ${MACHINE_ARCH} == "alpha"
11 CPUTYPE ?= ev4
12 .endif
13
14 # Handle aliases (not documented in make.conf to avoid user confusion
15 # between e.g. i586 and pentium)
16
17 .if ${MACHINE_ARCH} == "i386"
18 . if ${CPUTYPE} == "pentiumpro"
19 CPUTYPE = i686
20 . elif ${CPUTYPE} == "pentium"
21 CPUTYPE = i586
22 . elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "k8" || ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "athlon-fx"
23 CPUTYPE = k7
24 . endif
25 .endif
26
27 # Logic to set up correct gcc optimization flag. This must be included
28 # after /etc/make.conf so it can react to the local value of CPUTYPE
29 # defined therein.
30
31 .if !defined(NO_CPU_CFLAGS) || !defined(NO_CPU_COPTFLAGS)
32 . if ${MACHINE_ARCH} == "i386"
33 .  if ${CPUTYPE} == "k7"
34 _CPUCFLAGS = -march=k6  # gcc doesn't support athlon yet, but it will
35 .  elif ${CPUTYPE} == "k6-2"
36 _CPUCFLAGS = -march=k6
37 .  elif ${CPUTYPE} == "k6"
38 _CPUCFLAGS = -march=k6
39 .  elif ${CPUTYPE} == "k5"
40 _CPUCFLAGS = -march=pentium
41 .  elif ${CPUTYPE} == "p4"
42 _CPUCFLAGS = -march=pentiumpro
43 .  elif ${CPUTYPE} == "p3"
44 _CPUCFLAGS = -march=pentiumpro
45 .  elif ${CPUTYPE} == "p2"
46 _CPUCFLAGS = -march=pentiumpro
47 .  elif ${CPUTYPE} == "i686"
48 _CPUCFLAGS = -march=pentiumpro
49 .  elif ${CPUTYPE} == "i586/mmx"
50 _CPUCFLAGS = -march=pentium
51 .  elif ${CPUTYPE} == "i586"
52 _CPUCFLAGS = -march=pentium
53 .  elif ${CPUTYPE} == "i486"
54 _CPUCFLAGS = -march=i486
55 .  endif
56 . elif ${MACHINE_ARCH} == "alpha"
57 .  if ${CPUTYPE} == "ev6"
58 _CPUCFLAGS = -mcpu=ev6
59 .  elif ${CPUTYPE} == "pca56"
60 _CPUCFLAGS = -mcpu=pca56
61 .  elif ${CPUTYPE} == "ev56"
62 _CPUCFLAGS = -mcpu=ev56
63 .  elif ${CPUTYPE} == "ev5"
64 _CPUCFLAGS = -mcpu=ev5
65 .  elif ${CPUTYPE} == "ev45"
66 _CPUCFLAGS = -mcpu=ev4          # No -mcpu=ev45 for gcc
67 .  elif ${CPUTYPE} == "ev4"
68 _CPUCFLAGS = -mcpu=ev4
69 .  endif
70 . endif
71 .endif
72
73 # Set up the list of CPU features based on the CPU type.  This is an
74 # unordered list to make it easy for client makefiles to test for the
75 # presence of a CPU feature.
76
77 .if ${MACHINE_ARCH} == "i386"
78 . if ${CPUTYPE} == "k7"
79 MACHINE_CPU = k7 3dnow mmx k6 k5 i586 i486 i386
80 . elif ${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"
87 MACHINE_CPU = 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 . endif
103 .elif ${MACHINE_ARCH} == "alpha"
104 . if ${CPUTYPE} == "ev6"
105 MACHINE_CPU = ev6 ev56 pca56 ev5 ev45 ev4
106 . elif ${CPUTYPE} == "pca56"
107 MACHINE_CPU = pca56 ev56 ev5 ev45 ev4
108 . elif ${CPUTYPE} == "ev56"
109 MACHINE_CPU = ev56 ev5 ev45 ev4
110 . elif ${CPUTYPE} == "ev5"
111 MACHINE_CPU = ev5 ev45 ev4
112 . elif ${CPUTYPE} == "ev45"
113 MACHINE_CPU = ev45 ev4
114 . elif ${CPUTYPE} == "ev4"
115 MACHINE_CPU = ev4
116 . endif
117 .endif
118