summaryrefslogtreecommitdiff
path: root/rules.mk
diff options
context:
space:
mode:
Diffstat (limited to 'rules.mk')
-rw-r--r--rules.mk10
1 files changed, 9 insertions, 1 deletions
diff --git a/rules.mk b/rules.mk
index 04dd164..05d04bd 100644
--- a/rules.mk
+++ b/rules.mk
@@ -56,6 +56,7 @@ OPENCM3_INC = $(OPENCM3_DIR)/include
INCLUDES += $(patsubst %,-I%, . $(OPENCM3_INC) )
OBJS = $(CFILES:%.c=$(BUILD_DIR)/%.o)
+OBJS += $(AFILES:%.S=$(BUILD_DIR)/%.o)
GENERATED_BINS = $(PROJECT).elf $(PROJECT).bin $(PROJECT).map $(PROJECT).list $(PROJECT).lss
TGT_CPPFLAGS += -MD
@@ -75,6 +76,8 @@ TGT_CXXFLAGS += -fno-common
TGT_CXXFLAGS += -ffunction-sections -fdata-sections
TGT_CXXFLAGS += -Wextra -Wshadow -Wredundant-decls -Weffc++
+TGT_ASFLAGS += $(OPT) $(ARCH_FLAGS) -ggdb3
+
TGT_LDFLAGS += -T$(LDSCRIPT) -L$(OPENCM3_DIR)/lib -nostartfiles
TGT_LDFLAGS += $(ARCH_FLAGS)
TGT_LDFLAGS += -specs=nano.specs
@@ -95,7 +98,7 @@ LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
# Burn in legacy hell fortran modula pascal yacc idontevenwat
.SUFFIXES:
-.SUFFIXES: .c .h .o .cxx .elf .bin .list .lss
+.SUFFIXES: .c .S .h .o .cxx .elf .bin .list .lss
# Bad make, never *ever* try to get a file out of source control by yourself.
%: %,v
@@ -129,6 +132,11 @@ $(BUILD_DIR)/%.o: %.cxx
@mkdir -p $(dir $@)
$(Q)$(CC) $(TGT_CXXFLAGS) $(CXXFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $@ -c $<
+$(BUILD_DIR)/%.o: %.S
+ @printf " AS\t$<\n"
+ @mkdir -p $(dir $@)
+ $(Q)$(CC) $(TGT_ASFLAGS) $(ASFLAGS) $(TGT_CPPFLAGS) $(CPPFLAGS) -o $@ -c $<
+
$(PROJECT).elf: $(OBJS) $(LDSCRIPT) $(LIBDEPS)
@printf " LD\t$@\n"
$(Q)$(LD) $(TGT_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@