From: batt Date: Tue, 5 Aug 2008 13:02:42 +0000 (+0000) Subject: Refactor how cpu flags are added. X-Git-Tag: 2.0.0~387 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=0e9db20f6fb7f4ec21edaae6c9270317ee5dcfd9;p=bertos.git Refactor how cpu flags are added. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1547 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/rules.mk b/bertos/rules.mk index 1729fbf8..ef364d1d 100644 --- a/bertos/rules.mk +++ b/bertos/rules.mk @@ -87,22 +87,26 @@ endif $(1)_LDFLAGS += $$($(1)_MAP_FLAGS) +# In embedded systems the target CPU is needed, +# but there are different options on how pass +# it to the compiler. ifneq ($$(strip $$($(1)_MCU)),) -# Define all project specific object files -$(1)_CFLAGS += -mmcu=$$($(1)_MCU) -$(1)_CXXFLAGS += -mmcu=$$($(1)_MCU) -$(1)_ASFLAGS += -mmcu=$$($(1)_MCU) -$(1)_CPPAFLAGS += -mmcu=$$($(1)_MCU) -$(1)_LDFLAGS += -mmcu=$$($(1)_MCU) +$(1)_MCPU = -mmcu=$$($(1)_MCU) endif ifneq ($$(strip $$($(1)_CPU)),) -# Define all project specific object files -$(1)_CFLAGS += -mcpu=$$($(1)_CPU) -$(1)_CXXFLAGS += -mcpu=$$($(1)_CPU) -$(1)_ASFLAGS += -mcpu=$$($(1)_CPU) -$(1)_CPPAFLAGS += -mcpu=$$($(1)_CPU) -$(1)_LDFLAGS += -mcpu=$$($(1)_CPU) +$(1)_MCPU = -mcpu=$$($(1)_CPU) endif + +# If a CPU is specified add to +# project specific flags. +ifneq ($$($(1)_MCPU),) +$(1)_CFLAGS += $$($(1)_MCPU) +$(1)_CXXFLAGS += $$($(1)_MCPU) +$(1)_ASFLAGS += $$($(1)_MCPU) +$(1)_CPPAFLAGS += $$($(1)_MCPU) +$(1)_LDFLAGS += $$($(1)_MCPU) +endif + ifneq ($$(strip $$($(1)_LDSCRIPT)),) $(1)_LDFLAGS += -Wl,-T$$($(1)_LDSCRIPT) endif