aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2006-03-08 06:35:00 -0500
committerRalf Baechle <ralf@linux-mips.org>2006-03-21 08:27:47 -0500
commit59b3e8e9aac69d2d02853acac7e2affdfbabca50 (patch)
treed66a8b17f62dfea581923bf1685477809b4d74a7
parent0cea043b56443aef8a77539cdd79451f5d55009d (diff)
[MIPS] Makefile crapectomy.
Dump all the ridiculously complicated stuff that was needed support compilers older and newer than 3.0. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Thiemo Seufer <ths@networkno.de>
-rw-r--r--arch/mips/Makefile208
1 files changed, 39 insertions, 169 deletions
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index c626dd5942f6..9a69e0f0ab76 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -12,10 +12,6 @@
12# for "archclean" cleaning up for this architecture. 12# for "archclean" cleaning up for this architecture.
13# 13#
14 14
15as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \
16 -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \
17 else echo "$(2)"; fi ;)
18
19cflags-y := 15cflags-y :=
20 16
21# 17#
@@ -38,12 +34,10 @@ else
38endif 34endif
39 35
40ifdef CONFIG_32BIT 36ifdef CONFIG_32BIT
41gcc-abi = 32
42tool-prefix = $(32bit-tool-prefix) 37tool-prefix = $(32bit-tool-prefix)
43UTS_MACHINE := mips 38UTS_MACHINE := mips
44endif 39endif
45ifdef CONFIG_64BIT 40ifdef CONFIG_64BIT
46gcc-abi = 64
47tool-prefix = $(64bit-tool-prefix) 41tool-prefix = $(64bit-tool-prefix)
48UTS_MACHINE := mips64 42UTS_MACHINE := mips64
49endif 43endif
@@ -52,40 +46,28 @@ ifdef CONFIG_CROSSCOMPILE
52CROSS_COMPILE := $(tool-prefix) 46CROSS_COMPILE := $(tool-prefix)
53endif 47endif
54 48
55CHECKFLAGS-y += -D__linux__ -D__mips__ \
56 -D_MIPS_SZINT=32 \
57 -D_ABIO32=1 \
58 -D_ABIN32=2 \
59 -D_ABI64=3
60CHECKFLAGS-$(CONFIG_32BIT) += -D_MIPS_SIM=_ABIO32 \
61 -D_MIPS_SZLONG=32 \
62 -D_MIPS_SZPTR=32 \
63 -D__PTRDIFF_TYPE__=int
64CHECKFLAGS-$(CONFIG_64BIT) += -m64 -D_MIPS_SIM=_ABI64 \
65 -D_MIPS_SZLONG=64 \
66 -D_MIPS_SZPTR=64 \
67 -D__PTRDIFF_TYPE__="long int"
68CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN) += -D__MIPSEB__
69CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN) += -D__MIPSEL__
70
71CHECKFLAGS = $(CHECKFLAGS-y)
72
73ifdef CONFIG_32BIT 49ifdef CONFIG_32BIT
74gas-abi = 32
75ld-emul = $(32bit-emul) 50ld-emul = $(32bit-emul)
76vmlinux-32 = vmlinux 51vmlinux-32 = vmlinux
77vmlinux-64 = vmlinux.64 52vmlinux-64 = vmlinux.64
53
54cflags-y += -mabi=32
78endif 55endif
79 56
80ifdef CONFIG_64BIT 57ifdef CONFIG_64BIT
81gas-abi = 64
82ld-emul = $(64bit-emul) 58ld-emul = $(64bit-emul)
83vmlinux-32 = vmlinux.32 59vmlinux-32 = vmlinux.32
84vmlinux-64 = vmlinux 60vmlinux-64 = vmlinux
85 61
62cflags-y += -mabi=64
63ifdef CONFIG_BUILD_ELF64
86cflags-y += $(call cc-option,-mno-explicit-relocs) 64cflags-y += $(call cc-option,-mno-explicit-relocs)
65else
66cflags-y += $(call cc-option,-msym32)
67endif
87endif 68endif
88 69
70
89# 71#
90# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel 72# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel
91# code since it only slows down the whole thing. At some point we might make 73# code since it only slows down the whole thing. At some point we might make
@@ -107,162 +89,44 @@ MODFLAGS += -mlong-calls
107# carefully avoid to add it redundantly because gcc 3.3/3.4 complains 89# carefully avoid to add it redundantly because gcc 3.3/3.4 complains
108# when fed the toolchain default! 90# when fed the toolchain default!
109# 91#
110cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB) 92cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB -D__MIPSEB__)
111cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL) 93cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL -D__MIPSEL__)
112 94
113cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ 95cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
114 -fno-omit-frame-pointer 96 -fno-omit-frame-pointer
115 97
116# 98#
117# Use: $(call set_gccflags,<cpu0>,<isa0>,<cpu1>,<isa1>,<isa2>)
118#
119# <cpu0>,<isa0> -- preferred CPU and ISA designations (may require
120# recent tools)
121# <cpu1>,<isa1> -- fallback CPU and ISA designations (have to work
122# with up to the oldest supported tools)
123# <isa2> -- an ISA designation used as an ABI selector for
124# gcc versions that do not support "-mabi=32"
125# (depending on the CPU type, either "mips1" or
126# "mips2")
127#
128set_gccflags = $(shell \
129while :; do \
130 cpu=$(1); isa=-$(2); \
131 for gcc_opt in -march= -mcpu=; do \
132 $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
133 -xc /dev/null > /dev/null 2>&1 && \
134 break 2; \
135 done; \
136 cpu=$(3); isa=-$(4); \
137 for gcc_opt in -march= -mcpu=; do \
138 $(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
139 -xc /dev/null > /dev/null 2>&1 && \
140 break 2; \
141 done; \
142 break; \
143done; \
144gcc_abi=-mabi=$(gcc-abi); gcc_cpu=$$cpu; \
145if $(CC) $$gcc_abi -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then \
146 gcc_isa=$$isa; \
147else \
148 gcc_abi=; gcc_isa=-$(5); \
149fi; \
150gas_abi=-Wa,-$(gcc-abi); gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \
151while :; do \
152 for gas_opt in -Wa,-march= -Wa,-mcpu=; do \
153 $(CC) $$gas_abi $$gas_opt$$cpu $$gas_isa -Wa,-Z -c \
154 -o /dev/null -xassembler /dev/null > /dev/null 2>&1 && \
155 break 2; \
156 done; \
157 gas_abi=; gas_opt=; gas_cpu=; gas_isa=; \
158 break; \
159done; \
160if test "$(gcc-abi)" != "$(gas-abi)"; then \
161 gas_abi="-Wa,-$(gas-abi) -Wa,-mgp$(gcc-abi)"; \
162fi; \
163if test "$$gcc_opt" = -march= && test -n "$$gcc_abi"; then \
164 $(CC) $$gcc_abi $$gcc_opt$$gcc_cpu -S -o /dev/null \
165 -xc /dev/null > /dev/null 2>&1 && \
166 gcc_isa=; \
167fi; \
168echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa)
169
170#
171# CPU-dependent compiler/assembler options for optimization. 99# CPU-dependent compiler/assembler options for optimization.
172# 100#
173cflags-$(CONFIG_CPU_R3000) += \ 101cflags-$(CONFIG_CPU_R3000) += -march=r3000
174 $(call set_gccflags,r3000,mips1,r3000,mips1,mips1) 102cflags-$(CONFIG_CPU_TX39XX) += -march=r3900
175CHECKFLAGS-$(CONFIG_CPU_R3000) += -D_MIPS_ISA=_MIPS_ISA_MIPS1 103cflags-$(CONFIG_CPU_R6000) += -march=r6000 -Wa,--trap
176 104cflags-$(CONFIG_CPU_R4300) += -march=r4300 -Wa,--trap
177cflags-$(CONFIG_CPU_TX39XX) += \ 105cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap
178 $(call set_gccflags,r3900,mips1,r3000,mips1,mips1) 106cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap
179CHECKFLAGS-$(CONFIG_CPU_TX39XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS1 107cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap
180 108cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips2 -mtune=r4600) \
181cflags-$(CONFIG_CPU_R6000) += \ 109 -Wa,-mips32 -Wa,--trap
182 $(call set_gccflags,r6000,mips2,r6000,mips2,mips2) \ 110cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips2 -mtune=r4600) \
183 -Wa,--trap 111 -Wa,-mips32r2 -Wa,--trap
184CHECKFLAGS-$(CONFIG_CPU_R6000) += -D_MIPS_ISA=_MIPS_ISA_MIPS2 112cflags-$(CONFIG_CPU_MIPS64_R1) += $(call cc-option,-march=mips64,-mips2 -mtune=r4600) \
185 113 -Wa,-mips64 -Wa,--trap
186cflags-$(CONFIG_CPU_R4300) += \ 114cflags-$(CONFIG_CPU_MIPS64_R2) += $(call cc-option,-march=mips64r2,-mips2 -mtune=r4600 ) \
187 $(call set_gccflags,r4300,mips3,r4300,mips3,mips2) \ 115 -Wa,-mips64r2 -Wa,--trap
188 -Wa,--trap 116cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap
189CHECKFLAGS-$(CONFIG_CPU_R4300) += -D_MIPS_ISA=_MIPS_ISA_MIPS3 117cflags-$(CONFIG_CPU_R5432) += $(call cc-options,-march=r5400,-march=r5000) \
190
191cflags-$(CONFIG_CPU_VR41XX) += \
192 $(call set_gccflags,r4100,mips3,r4600,mips3,mips2) \
193 -Wa,--trap
194CHECKFLAGS-$(CONFIG_CPU_VR41XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
195
196cflags-$(CONFIG_CPU_R4X00) += \
197 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \
198 -Wa,--trap
199CHECKFLAGS-$(CONFIG_CPU_R4X00) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
200
201cflags-$(CONFIG_CPU_TX49XX) += \
202 $(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \
203 -Wa,--trap
204CHECKFLAGS-$(CONFIG_CPU_TX49XX) += -D_MIPS_ISA=_MIPS_ISA_MIPS3
205
206cflags-$(CONFIG_CPU_MIPS32_R1) += \
207 $(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
208 -Wa,--trap 118 -Wa,--trap
209CHECKFLAGS-$(CONFIG_CPU_MIPS32_R1) += -D_MIPS_ISA=_MIPS_ISA_MIPS32 119cflags-$(CONFIG_CPU_NEVADA) += $(call cc-options,-march=rm5200,-march=r5000) \
210
211cflags-$(CONFIG_CPU_MIPS32_R2) += \
212 $(call set_gccflags,mips32r2,mips32r2,r4600,mips3,mips2) \
213 -Wa,--trap
214CHECKFLAGS-$(CONFIG_CPU_MIPS32_R2) += -D_MIPS_ISA=_MIPS_ISA_MIPS32
215
216cflags-$(CONFIG_CPU_MIPS64_R1) += \
217 $(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \
218 -Wa,--trap
219CHECKFLAGS-$(CONFIG_CPU_MIPS64_R1) += -D_MIPS_ISA=_MIPS_ISA_MIPS64
220
221cflags-$(CONFIG_CPU_MIPS64_R2) += \
222 $(call set_gccflags,mips64r2,mips64r2,r4600,mips3,mips2) \
223 -Wa,--trap
224CHECKFLAGS-$(CONFIG_CPU_MIPS64_R2) += -D_MIPS_ISA=_MIPS_ISA_MIPS64
225
226cflags-$(CONFIG_CPU_R5000) += \
227 $(call set_gccflags,r5000,mips4,r5000,mips4,mips2) \
228 -Wa,--trap
229CHECKFLAGS-$(CONFIG_CPU_R5000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
230
231cflags-$(CONFIG_CPU_R5432) += \
232 $(call set_gccflags,r5400,mips4,r5000,mips4,mips2) \
233 -Wa,--trap
234CHECKFLAGS-$(CONFIG_CPU_R5432) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
235
236cflags-$(CONFIG_CPU_NEVADA) += \
237 $(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \
238 -Wa,--trap 120 -Wa,--trap
239CHECKFLAGS-$(CONFIG_CPU_NEVADA) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 121cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \
240
241cflags-$(CONFIG_CPU_RM7000) += \
242 $(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \
243 -Wa,--trap 122 -Wa,--trap
244CHECKFLAGS-$(CONFIG_CPU_RM7000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 123cflags-$(CONFIG_CPU_RM9000) += $(call cc-option,-march=rm9000,-march=r5000) \
245
246cflags-$(CONFIG_CPU_RM9000) += \
247 $(call set_gccflags,rm9000,mips4,r5000,mips4,mips2) \
248 -Wa,--trap
249CHECKFLAGS-$(CONFIG_CPU_RM9000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
250
251
252cflags-$(CONFIG_CPU_SB1) += \
253 $(call set_gccflags,sb1,mips64,r5000,mips4,mips2) \
254 -Wa,--trap 124 -Wa,--trap
255CHECKFLAGS-$(CONFIG_CPU_SB1) += -D_MIPS_ISA=_MIPS_ISA_MIPS64 125cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=r5000) \
256
257cflags-$(CONFIG_CPU_R8000) += \
258 $(call set_gccflags,r8000,mips4,r8000,mips4,mips2) \
259 -Wa,--trap 126 -Wa,--trap
260CHECKFLAGS-$(CONFIG_CPU_R8000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4 127cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap
261 128cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \
262cflags-$(CONFIG_CPU_R10000) += \
263 $(call set_gccflags,r10000,mips4,r8000,mips4,mips2) \
264 -Wa,--trap 129 -Wa,--trap
265CHECKFLAGS-$(CONFIG_CPU_R10000) += -D_MIPS_ISA=_MIPS_ISA_MIPS4
266 130
267ifdef CONFIG_CPU_SB1 131ifdef CONFIG_CPU_SB1
268ifdef CONFIG_SB1_PASS_1_WORKAROUNDS 132ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
@@ -748,6 +612,12 @@ CFLAGS += $(cflags-y)
748 612
749LDFLAGS += -m $(ld-emul) 613LDFLAGS += -m $(ld-emul)
750 614
615ifdef CONFIG_MIPS
616CHECKFLAGS += $(shell $(CC) $(CFLAGS) -dM -E -xc /dev/null | \
617 egrep -vw '__GNUC_(MAJOR|MINOR|PATCHLEVEL)__' | \
618 sed -e 's/^\#define /-D/' -e 's/ /="/' -e 's/$$/"/')
619endif
620
751OBJCOPYFLAGS += --remove-section=.reginfo 621OBJCOPYFLAGS += --remove-section=.reginfo
752 622
753# 623#