bsd.cpu.mk revision 96421
1# $FreeBSD: head/share/mk/bsd.cpu.mk 96421 2002-05-11 20:18:54Z obrien $
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 ?= ev4
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_CPUCFLAGS = -march=athlon
41.  elif ${CPUTYPE} == "k6-2"
42_CPUCFLAGS = -march=k6
43.  elif ${CPUTYPE} == "k6"
44_CPUCFLAGS = -march=k6
45.  elif ${CPUTYPE} == "k5"
46_CPUCFLAGS = -march=pentium
47.  elif ${CPUTYPE} == "p4"
48_CPUCFLAGS = -march=pentiumpro
49.  elif ${CPUTYPE} == "p3"
50_CPUCFLAGS = -march=pentiumpro
51.  elif ${CPUTYPE} == "p2"
52_CPUCFLAGS = -march=pentiumpro
53.  elif ${CPUTYPE} == "i686"
54_CPUCFLAGS = -march=pentiumpro
55.  elif ${CPUTYPE} == "i586/mmx"
56_CPUCFLAGS = -march=pentium
57.  elif ${CPUTYPE} == "i586"
58_CPUCFLAGS = -march=pentium
59.  elif ${CPUTYPE} == "i486"
60_CPUCFLAGS = -march=i486
61.  endif
62. elif ${MACHINE_ARCH} == "alpha"
63.  if ${CPUTYPE} == "ev6"
64_CPUCFLAGS = -mcpu=ev6
65.  elif ${CPUTYPE} == "pca56"
66_CPUCFLAGS = -mcpu=pca56
67.  elif ${CPUTYPE} == "ev56"
68_CPUCFLAGS = -mcpu=ev56
69.  elif ${CPUTYPE} == "ev5"
70_CPUCFLAGS = -mcpu=ev5
71.  elif ${CPUTYPE} == "ev45"
72_CPUCFLAGS = -mcpu=ev4		# No -mcpu=ev45 for gcc
73.  elif ${CPUTYPE} == "ev4"
74_CPUCFLAGS = -mcpu=ev4
75.  endif
76. endif
77.endif
78
79# NB: COPTFLAGS is handled in /usr/src/sys/conf/Makefile.<arch>
80
81.if !defined(NO_CPU_CFLAGS)
82CFLAGS += ${_CPUCFLAGS}
83.endif
84
85# Set up the list of CPU features based on the CPU type.  This is an
86# unordered list to make it easy for client makefiles to test for the
87# presence of a CPU feature.
88
89.if ${MACHINE_ARCH} == "i386"
90. if ${CPUTYPE} == "k7"
91MACHINE_CPU = k7 3dnow mmx k6 k5 i586 i486 i386
92. elif ${CPUTYPE} == "k6-2"
93MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
94. elif ${CPUTYPE} == "k6"
95MACHINE_CPU = mmx k6 k5 i586 i486 i386
96. elif ${CPUTYPE} == "k5"
97MACHINE_CPU = k5 i586 i486 i386
98. elif ${CPUTYPE} == "p4"
99MACHINE_CPU = sse i686 mmx i586 i486 i386
100. elif ${CPUTYPE} == "p3"
101MACHINE_CPU = sse i686 mmx i586 i486 i386
102. elif ${CPUTYPE} == "p2"
103MACHINE_CPU = i686 mmx i586 i486 i386
104. elif ${CPUTYPE} == "i686"
105MACHINE_CPU = i686 i586 i486 i386
106. elif ${CPUTYPE} == "i586/mmx"
107MACHINE_CPU = mmx i586 i486 i386
108. elif ${CPUTYPE} == "i586"
109MACHINE_CPU = i586 i486 i386
110. elif ${CPUTYPE} == "i486"
111MACHINE_CPU = i486 i386
112. elif ${CPUTYPE} == "i386"
113MACHINE_CPU = i386
114. endif
115.elif ${MACHINE_ARCH} == "alpha"
116. if ${CPUTYPE} == "ev6"
117MACHINE_CPU = ev6 ev56 pca56 ev5 ev45 ev4
118. elif ${CPUTYPE} == "pca56"
119MACHINE_CPU = pca56 ev56 ev5 ev45 ev4
120. elif ${CPUTYPE} == "ev56"
121MACHINE_CPU = ev56 ev5 ev45 ev4
122. elif ${CPUTYPE} == "ev5"
123MACHINE_CPU = ev5 ev45 ev4
124. elif ${CPUTYPE} == "ev45"
125MACHINE_CPU = ev45 ev4
126. elif ${CPUTYPE} == "ev4"
127MACHINE_CPU = ev4
128. endif
129.elif ${MACHINE_ARCH} == "ia64"
130. if ${CPUTYPE} == "itanium"
131MACHINE_CPU = itanium
132. endif
133.endif
134