[U-Boot] [PATCH V2 2/9] ColdFire: Change the way to set platform CPP flags

Jason Jin Jason.jin at freescale.com
Tue Apr 19 08:15:27 CEST 2011


The CPP flags for the ColdFire platform depend on the version
of the toolchain. Setting the CPP flags based on the gcc --version
is not good and not reliable. This patch try to set the flags by testing
if the flag works.

Signed-off-by: Jason Jin <Jason.jin at freescale.com>
---
 arch/m68k/cpu/mcf5227x/config.mk   |    6 +-----
 arch/m68k/cpu/mcf523x/config.mk    |    6 +-----
 arch/m68k/cpu/mcf52x2/config.mk    |   21 +++++++--------------
 arch/m68k/cpu/mcf532x/config.mk    |   11 +++--------
 arch/m68k/cpu/mcf5445x/config.mk   |    6 +-----
 arch/m68k/cpu/mcf547x_8x/config.mk |    6 +-----
 6 files changed, 14 insertions(+), 42 deletions(-)

diff --git a/arch/m68k/cpu/mcf5227x/config.mk b/arch/m68k/cpu/mcf5227x/config.mk
index 8eab49d..3a17bcb 100644
--- a/arch/m68k/cpu/mcf5227x/config.mk
+++ b/arch/m68k/cpu/mcf5227x/config.mk
@@ -24,8 +24,4 @@
 #
 
 PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
-ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
-PLATFORM_CPPFLAGS += -mcpu=52277 -fPIC
-else
-PLATFORM_CPPFLAGS += -m5307 -fPIC
-endif
+PLATFORM_CPPFLAGS += $(call cc-option,-mcpu=52277 -fPIC, -m5307 -fPIC)
diff --git a/arch/m68k/cpu/mcf523x/config.mk b/arch/m68k/cpu/mcf523x/config.mk
index fc79454..78ae8c1 100644
--- a/arch/m68k/cpu/mcf523x/config.mk
+++ b/arch/m68k/cpu/mcf523x/config.mk
@@ -24,8 +24,4 @@
 #
 
 PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
-ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
-PLATFORM_CPPFLAGS += -mcpu=5235 -fPIC
-else
-PLATFORM_CPPFLAGS += -m5307 -fPIC
-endif
+PLATFORM_CPPFLAGS += $(call cc-option, -mcpu=5235 -fPIC, -m5307 -fPIC)
diff --git a/arch/m68k/cpu/mcf52x2/config.mk b/arch/m68k/cpu/mcf52x2/config.mk
index 52751be..45c47e5 100644
--- a/arch/m68k/cpu/mcf52x2/config.mk
+++ b/arch/m68k/cpu/mcf52x2/config.mk
@@ -34,31 +34,24 @@ is5272:=$(shell grep CONFIG_M5272 $(TOPDIR)/include/$(cfg))
 is5275:=$(shell grep CONFIG_M5275 $(TOPDIR)/include/$(cfg))
 is5282:=$(shell grep CONFIG_M5282 $(TOPDIR)/include/$(cfg))
 
-
-ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
-
 ifneq (,$(findstring CONFIG_M5208,$(is5208)))
-PLATFORM_CPPFLAGS += -mcpu=5208
+PLATFORM_CPPFLAGS += $(call cc-option,-mcpu=5208,-m5307)
 endif
 ifneq (,$(findstring CONFIG_M5249,$(is5249)))
-PLATFORM_CPPFLAGS += -mcpu=5249
+PLATFORM_CPPFLAGS += $(call cc-option,-mcpu=5249,-m5307)
 endif
 ifneq (,$(findstring CONFIG_M5253,$(is5253)))
-PLATFORM_CPPFLAGS += -mcpu=5253
+PLATFORM_CPPFLAGS += $(call cc-option,-mcpu=5253,-m5307)
 endif
 ifneq (,$(findstring CONFIG_M5271,$(is5271)))
-PLATFORM_CPPFLAGS += -mcpu=5271
+PLATFORM_CPPFLAGS += $(call cc-option,-mcpu=5271,-m5307)
 endif
 ifneq (,$(findstring CONFIG_M5272,$(is5272)))
-PLATFORM_CPPFLAGS += -mcpu=5272
+PLATFORM_CPPFLAGS += $(call cc-option,-mcpu=5272,-m5307)
 endif
 ifneq (,$(findstring CONFIG_M5275,$(is5275)))
-PLATFORM_CPPFLAGS += -mcpu=5275
+PLATFORM_CPPFLAGS += $(call cc-option,-mcpu=5275,-m5307)
 endif
 ifneq (,$(findstring CONFIG_M5282,$(is5282)))
-PLATFORM_CPPFLAGS += -mcpu=5282
-endif
-
-else
-PLATFORM_CPPFLAGS += -m5307
+PLATFORM_CPPFLAGS += $(call cc-option,-mcpu=5282,-m5307)
 endif
diff --git a/arch/m68k/cpu/mcf532x/config.mk b/arch/m68k/cpu/mcf532x/config.mk
index b783444..b050206 100644
--- a/arch/m68k/cpu/mcf532x/config.mk
+++ b/arch/m68k/cpu/mcf532x/config.mk
@@ -29,15 +29,10 @@ cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/
 is5301x:=$(shell grep CONFIG_MCF5301x $(TOPDIR)/include/$(cfg))
 is532x:=$(shell grep CONFIG_MCF532x $(TOPDIR)/include/$(cfg))
 
-ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
-
 ifneq (,$(findstring CONFIG_MCF5301x,$(is5301x)))
-PLATFORM_CPPFLAGS += -mcpu=53015 -fPIC
-endif
-ifneq (,$(findstring CONFIG_MCF532x,$(is532x)))
-PLATFORM_CPPFLAGS += -mcpu=5329 -fPIC
+PLATFORM_CPPFLAGS += $(call cc-option, -mcpu=53015 -fPIC, -m5307 -fPIC)
 endif
 
-else
-PLATFORM_CPPFLAGS += -m5307 -fPIC
+ifneq (,$(findstring CONFIG_MCF532x,$(is532x)))
+PLATFORM_CPPFLAGS += $(call cc-option, -mcpu=5329 -fPIC, -m5307 -fPIC)
 endif
diff --git a/arch/m68k/cpu/mcf5445x/config.mk b/arch/m68k/cpu/mcf5445x/config.mk
index b0b49f7..47ff6ec 100644
--- a/arch/m68k/cpu/mcf5445x/config.mk
+++ b/arch/m68k/cpu/mcf5445x/config.mk
@@ -24,11 +24,7 @@
 #
 
 PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
-ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
-PLATFORM_CPPFLAGS += -mcpu=54455 -fPIC
-else
-PLATFORM_CPPFLAGS += -m5407 -fPIC
-endif
+PLATFORM_CPPFLAGS += $(call cc-option,-mcpu=54455 -fPIC,-m5407 -fPIC)
 
 ifneq (,$(findstring -linux-,$(shell $(CC) --version)))
 ifneq (,$(findstring GOT,$(shell $(LD) --help)))
diff --git a/arch/m68k/cpu/mcf547x_8x/config.mk b/arch/m68k/cpu/mcf547x_8x/config.mk
index 83102ab..87cc0a5 100644
--- a/arch/m68k/cpu/mcf547x_8x/config.mk
+++ b/arch/m68k/cpu/mcf547x_8x/config.mk
@@ -24,11 +24,7 @@
 #
 
 PLATFORM_RELFLAGS += -ffixed-d7 -msep-data
-ifneq ($(findstring 4.1,$(shell $(CC) --version)),4.1)
-PLATFORM_CPPFLAGS += -mcpu=5485 -fPIC
-else
-PLATFORM_CPPFLAGS += -m5407 -fPIC
-endif
+PLATFORM_CPPFLAGS += $(call cc-option,-mcpu=5485 -fPIC, m5407 -fPIC)
 
 ifneq (,$(findstring -linux-,$(shell $(CC) --version)))
 ifneq (,$(findstring GOT,$(shell $(LD) --help)))
-- 
1.6.4




More information about the U-Boot mailing list