summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorNicolas Schodet2012-12-08 09:21:37 +0100
committerNicolas Schodet2019-10-06 23:29:59 +0200
commitc16defa7e73d1746bbbdd2572fcc608a628a447b (patch)
treea6203de971a8bf6d477436243985fef7dd930243 /build
parent724944e4728441dbd9167a6e87f1f6e2e998e631 (diff)
build: unify TARGET_* defines
Diffstat (limited to 'build')
-rw-r--r--build/arch.mk2
-rw-r--r--build/host.mk3
-rw-r--r--build/stm32f4.mk4
3 files changed, 4 insertions, 5 deletions
diff --git a/build/arch.mk b/build/arch.mk
index 01b797f..62f0687 100644
--- a/build/arch.mk
+++ b/build/arch.mk
@@ -6,6 +6,8 @@
# Define standard commands.
define arch_cmds
+$1_TARGET_DEFS := -DTARGET_$1=1 $$($1_SUBTARGETS:%=-DTARGET_%=1)
+$1_CPPFLAGS += $$($1_TARGET_DEFS)
$1_CC := $$($1_PREFIX)gcc
$1_CXX := $$($1_PREFIX)g++
$1_OBJCOPY := $$($1_PREFIX)objcopy
diff --git a/build/host.mk b/build/host.mk
index b061efd..a07d525 100644
--- a/build/host.mk
+++ b/build/host.mk
@@ -2,8 +2,7 @@
#
# Rules for Host.
-host_CPPFLAGS := $(CPPFLAGS) $(host_DEFS) \
- -DTARGET_HOST=1
+host_CPPFLAGS := $(CPPFLAGS) $(host_DEFS)
host_CFLAGS := $(CFLAGS)
host_CXXFLAGS := $(sort $(host_CFLAGS) $(CXXFLAGS))
host_ASFLAGS := $(ASFLAGS)
diff --git a/build/stm32f4.mk b/build/stm32f4.mk
index b60d02d..ae899b5 100644
--- a/build/stm32f4.mk
+++ b/build/stm32f4.mk
@@ -17,9 +17,7 @@ endif
stm32f4_SUBTARGETS := stm32 arm newlib
stm32f4_CPPFLAGS := $(CPPFLAGS) $(stm32f4_DEFS) \
- -DSTM32F4 $(LIBOPENCM3_CPPFLAGS) \
- -DTARGET_STM32F4=1 \
- $(foreach sub,$(stm32f4_SUBTARGETS),-DTARGET_SUB_$(sub)=1)
+ -DSTM32F4 $(LIBOPENCM3_CPPFLAGS)
stm32f4_CFLAGS := $(CFLAGS) \
-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 \
-Wl,--gc-sections -ffunction-sections