bsd.cpu.mk revision 98159
1# $FreeBSD: head/share/mk/bsd.cpu.mk 98159 2002-06-13 08:35:36Z sobomax $
2
3# Set default baseline values of CPUTYPE based on MACHINE_ARCH -- this is
4# the minimum CPU type we support for each architecture
5
6.if ${MACHINE_ARCH} == "i386"
7CPUTYPE ?= i386
8.elif ${MACHINE_ARCH} == "alpha"
9CPUTYPE ?= ev5
10.elif ${MACHINE_ARCH} == "ia64"
11CPUTYPE ?= itanium
12.elif ${MACHINE_ARCH} == "sparc64"
13CPUTYPE ?= ultrasparc
14.endif
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"
21CPUTYPE = i686
22. elif ${CPUTYPE} == "pentium"
23CPUTYPE = i586
24. elif ${CPUTYPE} == "athlon"
25CPUTYPE = k7
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/DEC-Alpha-Options.html
34#	http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html
35#	http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html
36
37.if !defined(NO_CPU_CFLAGS) || !defined(NO_CPU_COPTFLAGS)
38. if ${MACHINE_ARCH} == "i386"
39.  if ${CPUTYPE} == "k7"
40.   if defined(BOOTSTRAPPING)
41_CPUCFLAGS = -march=k6		# gcc 2.95.x didn't support athlon
42.   else
43_CPUCFLAGS = -march=athlon
44.   endif
45.  elif ${CPUTYPE} == "k6-2"
46_CPUCFLAGS = -march=k6
47.  elif ${CPUTYPE} == "k6"
48_CPUCFLAGS = -march=k6
49.  elif ${CPUTYPE} == "k5"
50_CPUCFLAGS = -march=pentium
51.  elif ${CPUTYPE} == "p4"
52_CPUCFLAGS = -march=pentiumpro
53.  elif ${CPUTYPE} == "p3"
54_CPUCFLAGS = -march=pentiumpro
55.  elif ${CPUTYPE} == "p2"
56_CPUCFLAGS = -march=pentiumpro
57.  elif ${CPUTYPE} == "i686"
58_CPUCFLAGS = -march=pentiumpro
59.  elif ${CPUTYPE} == "i586/mmx"
60_CPUCFLAGS = -march=pentium-mmx
61.  elif ${CPUTYPE} == "i586"
62_CPUCFLAGS = -march=pentium
63.  elif ${CPUTYPE} == "i486"
64_CPUCFLAGS = -march=i486
65.  endif
66. elif ${MACHINE_ARCH} == "alpha"
67.  if ${CPUTYPE} == "ev6"
68_CPUCFLAGS = -mcpu=ev6
69.  elif ${CPUTYPE} == "pca56"
70_CPUCFLAGS = -mcpu=pca56
71.  elif ${CPUTYPE} == "ev56"
72_CPUCFLAGS = -mcpu=ev56
73.  elif ${CPUTYPE} == "ev5"
74_CPUCFLAGS = -mcpu=ev5
75.  elif ${CPUTYPE} == "ev45"
76_CPUCFLAGS = -mcpu=ev4		# No -mcpu=ev45 for gcc
77.  elif ${CPUTYPE} == "ev4"
78_CPUCFLAGS = -mcpu=ev4
79.  endif
80. endif
81.endif
82
83# NB: COPTFLAGS is handled in /usr/src/sys/conf/Makefile.<arch>
84
85.if !defined(NO_CPU_CFLAGS)
86CFLAGS += ${_CPUCFLAGS}
87.endif
88
89# Set up the list of CPU features based on the CPU type.  This is an
90# unordered list to make it easy for client makefiles to test for the
91# presence of a CPU feature.
92
93.if ${MACHINE_ARCH} == "i386"
94. if ${CPUTYPE} == "k7"
95MACHINE_CPU = k7 3dnow mmx k6 k5 i586 i486 i386
96. elif ${CPUTYPE} == "k6-2"
97MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
98. elif ${CPUTYPE} == "k6"
99MACHINE_CPU = mmx k6 k5 i586 i486 i386
100. elif ${CPUTYPE} == "k5"
101MACHINE_CPU = k5 i586 i486 i386
102. elif ${CPUTYPE} == "p4"
103MACHINE_CPU = sse i686 mmx i586 i486 i386
104. elif ${CPUTYPE} == "p3"
105MACHINE_CPU = sse i686 mmx i586 i486 i386
106. elif ${CPUTYPE} == "p2"
107MACHINE_CPU = i686 mmx i586 i486 i386
108. elif ${CPUTYPE} == "i686"
109MACHINE_CPU = i686 i586 i486 i386
110. elif ${CPUTYPE} == "i586/mmx"
111MACHINE_CPU = mmx i586 i486 i386
112. elif ${CPUTYPE} == "i586"
113MACHINE_CPU = i586 i486 i386
114. elif ${CPUTYPE} == "i486"
115MACHINE_CPU = i486 i386
116. elif ${CPUTYPE} == "i386"
117MACHINE_CPU = i386
118. endif
119.elif ${MACHINE_ARCH} == "alpha"
120. if ${CPUTYPE} == "ev6"
121MACHINE_CPU = ev6 ev56 pca56 ev5 ev45 ev4
122. elif ${CPUTYPE} == "pca56"
123MACHINE_CPU = pca56 ev56 ev5 ev45 ev4
124. elif ${CPUTYPE} == "ev56"
125MACHINE_CPU = ev56 ev5 ev45 ev4
126. elif ${CPUTYPE} == "ev5"
127MACHINE_CPU = ev5 ev45 ev4
128. elif ${CPUTYPE} == "ev45"
129MACHINE_CPU = ev45 ev4
130. elif ${CPUTYPE} == "ev4"
131MACHINE_CPU = ev4
132. endif
133.elif ${MACHINE_ARCH} == "ia64"
134. if ${CPUTYPE} == "itanium"
135MACHINE_CPU = itanium
136. endif
137.endif
138