summaryrefslogtreecommitdiff
path: root/rules.mk
diff options
context:
space:
mode:
Diffstat (limited to 'rules.mk')
-rw-r--r--rules.mk14
1 files changed, 10 insertions, 4 deletions
diff --git a/rules.mk b/rules.mk
index e561eae631..f53fe912a7 100644
--- a/rules.mk
+++ b/rules.mk
@@ -158,6 +158,10 @@ CPPFLAGS += -funsigned-bitfields
CPPFLAGS += -fpack-struct
CPPFLAGS += -fshort-enums
CPPFLAGS += -fno-exceptions
+CPPFLAGS += -ffunction-sections
+CPPFLAGS += -fdata-sections
+# to supress "warning: only initialized variables can be placed into program memory area"
+CPPFLAGS += -w
CPPFLAGS += -Wall
CPPFLAGS += -Wundef
#CPPFLAGS += -mshort-calls
@@ -183,6 +187,7 @@ endif
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100
+ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
ifdef CONFIG_H
ASFLAGS += -include $(CONFIG_H)
endif
@@ -341,9 +346,9 @@ GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
# Combine all necessary flags and optional flags.
# Add target processor to flags.
# You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
-ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
-ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
-ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
+ALL_CFLAGS = -mmcu=$(MCU) $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
+ALL_CPPFLAGS = -mmcu=$(MCU) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
@@ -541,6 +546,7 @@ $(OBJDIR)/%.o : %.c
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
+ mkdir -p $(@D)
@echo $(MSG_COMPILING_CPP) $<
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
@@ -564,7 +570,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@
# Target: clean project.