diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-02-18 21:24:40 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-02-18 21:24:40 +0000 |
commit | 3457abe3f7a7f5ddc533a4f33759efcd5fe5a516 (patch) | |
tree | 92fba8e62626c85932064d58a40d34efb563969f /ports/ARM7 | |
parent | 22e3829249ff6b244fbb7b04f61c019c2cfe775e (diff) | |
download | ChibiOS-3457abe3f7a7f5ddc533a4f33759efcd5fe5a516.tar.gz ChibiOS-3457abe3f7a7f5ddc533a4f33759efcd5fe5a516.tar.bz2 ChibiOS-3457abe3f7a7f5ddc533a4f33759efcd5fe5a516.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@786 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports/ARM7')
-rw-r--r-- | ports/ARM7/rules.mk | 82 |
1 files changed, 57 insertions, 25 deletions
diff --git a/ports/ARM7/rules.mk b/ports/ARM7/rules.mk index 884fc50e9..5748b3e21 100644 --- a/ports/ARM7/rules.mk +++ b/ports/ARM7/rules.mk @@ -1,35 +1,50 @@ -# ARM7 common makefile rules.
+# ARM7 common makefile scripts and rules.
+# Automatic compiler options
OPT = $(USE_OPT)
-
+CPPOPT = $(USE_CPPOPT)
ifeq ($(USE_CURRP_CACHING),yes)
OPT += -ffixed-r7 -DCH_CURRP_REGISTER_CACHE='"r7"'
endif
-
ifeq ($(USE_LINK_GC),yes)
OPT += -ffunction-sections -fdata-sections
endif
+# Source files groups
ifeq ($(USE_THUMB),yes)
- TSRC += $(SRC)
+ TCSRC += $(CSRC)
+ TCPPSRC += $(CPPSRC)
else
- ASRC += $(SRC)
+ ACSRC += $(CSRC)
+ ACPPSRC += $(CPPSRC)
endif
-
+ASRC = $(ACSRC)$(ACPPSRC)
+TSRC = $(TCSRC)$(TCPPSRC)
+SRC = $(ASRC)$(TSRC)
+
+# Object files groups
+ACOBJS = $(ACSRC:.c=.o)
+ACPPOBJS = $(ACPPSRC:.cpp=.o)
+TCOBJS = $(TCSRC:.c=.o)
+TCPPOBJS = $(TCPPSRC:.cpp=.o)
+ASMOBJS = $(ASMSRC:.s=.o)
+OBJS = $(ASMOBJS) $(ACOBJS) $(TCOBJS) $(ACPPOBJS) $(TCPPOBJS)
+
+# Paths
IINCDIR = $(patsubst %,-I%,$(INCDIR) $(DINCDIR) $(UINCDIR))
LLIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR))
+
+# Macros
DEFS = $(DDEFS) $(UDEFS)
ADEFS = $(DADEFS) $(UADEFS)
-AOBJS = $(ASRC:.c=.o)
-TOBJS = $(TSRC:.c=.o)
-OBJS = $(ASMOBJS) $(AOBJS) $(TOBJS)
-ASMOBJS = $(ASMSRC:.s=.o)
LIBS = $(DLIBS) $(ULIBS)
-MCFLAGS = -mcpu=$(MCU)
+# Various settings
+MCFLAGS = -mcpu=$(MCU)
ODFLAGS = -x --syms
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
-CPFLAGS = $(MCFLAGS) $(OPT) $(WARN) -Wa,-alms=$(<:.c=.lst) $(DEFS)
+CFLAGS = $(MCFLAGS) $(OPT) $(CWARN) -Wa,-alms=$(<:.c=.lst) $(DEFS)
+CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(<:.cpp=.lst) $(DEFS)
ifeq ($(LINK_GC),yes)
LDFLAGS = $(MCFLAGS) -nostartfiles -T$(LDSCRIPT) -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
else
@@ -38,25 +53,30 @@ endif # Thumb interwork enabled only if needed because it kills performance.
ifneq ($(TSRC),)
- CPFLAGS += -DTHUMB_PRESENT
+ CFLAGS += -DTHUMB_PRESENT
+ CPPFLAGS += -DTHUMB_PRESENT
ASFLAGS += -DTHUMB_PRESENT
ifneq ($(ASRC),)
# Mixed ARM and THUMB case.
- CPFLAGS += -mthumb-interwork
+ CFLAGS += -mthumb-interwork
+ CPPFLAGS += -mthumb-interwork
LDFLAGS += -mthumb-interwork
else
# Pure THUMB case, THUMB C code cannot be called by ARM asm code directly.
- CPFLAGS += -mno-thumb-interwork -DTHUMB_NO_INTERWORKING
+ CFLAGS += -mno-thumb-interwork -DTHUMB_NO_INTERWORKING
+ CPPFLAGS += -mno-thumb-interwork -DTHUMB_NO_INTERWORKING
LDFLAGS += -mno-thumb-interwork -mthumb
ASFLAGS += -DTHUMB_NO_INTERWORKING
endif
else
CPFLAGS += -mno-thumb-interwork
+ CPPFLAGS += -mno-thumb-interwork
LDFLAGS += -mno-thumb-interwork
endif
# Generate dependency information
-CPFLAGS += -MD -MP -MF .dep/$(@F).d
+CFLAGS += -MD -MP -MF .dep/$(@F).d
+CPPFLAGS += -MD -MP -MF .dep/$(@F).d
#
# Makefile rules
@@ -64,13 +84,21 @@ CPFLAGS += -MD -MP -MF .dep/$(@F).d all: $(OBJS) $(PROJECT).elf $(PROJECT).hex $(PROJECT).bin $(PROJECT).dmp
-$(AOBJS) : %.o : %.c
+$(ACPPOBJS) : %.o : %.cpp
+ @echo
+ $(CPPC) -c $(CPPFLAGS) $(AOPT) -I . $(IINCDIR) $< -o $@
+
+$(TCPPOBJS) : %.o : %.cpp
+ @echo
+ $(CPPC) -c $(CPPFLAGS) $(TOPT) -I . $(IINCDIR) $< -o $@
+
+$(ACOBJS) : %.o : %.c
@echo
- $(CC) -c $(CPFLAGS) $(AOPT) -I . $(IINCDIR) $< -o $@
+ $(CC) -c $(CFLAGS) $(AOPT) -I . $(IINCDIR) $< -o $@
-$(TOBJS) : %.o : %.c
+$(TCOBJS) : %.o : %.c
@echo
- $(CC) -c $(CPFLAGS) $(TOPT) -I . $(IINCDIR) $< -o $@
+ $(CC) -c $(CFLAGS) $(TOPT) -I . $(IINCDIR) $< -o $@
$(ASMOBJS) : %.o : %.s
@echo
@@ -78,7 +106,7 @@ $(ASMOBJS) : %.o : %.s %elf: $(OBJS)
@echo
- $(CC) $(ASMOBJS) $(AOBJS) $(TOBJS) $(LDFLAGS) $(LIBS) -o $@
+ $(LD) $(ASMOBJS) $(ACOBJS) $(TCOBJS) $(ACPPOBJS) $(TCPPOBJS) $(LDFLAGS) $(LIBS) -o $@
%hex: %elf
$(HEX) $< $@
@@ -96,10 +124,14 @@ clean: -rm -f $(PROJECT).map
-rm -f $(PROJECT).hex
-rm -f $(PROJECT).bin
- -rm -f $(ASRC:.c=.c.bak)
- -rm -f $(ASRC:.c=.lst)
- -rm -f $(TSRC:.c=.c.bak)
- -rm -f $(TSRC:.c=.lst)
+ -rm -f $(ACSRC:.c=.c.bak)
+ -rm -f $(ACSRC:.c=.lst)
+ -rm -f $(TCSRC:.c=.c.bak)
+ -rm -f $(TCSRC:.c=.lst)
+ -rm -f $(ACPPSRC:.cpp=.c.bak)
+ -rm -f $(ACPPSRC:.cpp=.lst)
+ -rm -f $(TCPPSRC:.cpp=.c.bak)
+ -rm -f $(TCPPSRC:.cpp=.lst)
-rm -f $(ASMSRC:.s=.s.bak)
-rm -f $(ASMSRC:.s=.lst)
-rm -fR .dep
|