summaryrefslogtreecommitdiff
path: root/n/avr/make/Makefile.avr
diff options
context:
space:
mode:
Diffstat (limited to 'n/avr/make/Makefile.avr')
-rw-r--r--n/avr/make/Makefile.avr12
1 files changed, 10 insertions, 2 deletions
diff --git a/n/avr/make/Makefile.avr b/n/avr/make/Makefile.avr
index 8485324..8f8030d 100644
--- a/n/avr/make/Makefile.avr
+++ b/n/avr/make/Makefile.avr
@@ -3,6 +3,7 @@
# Flags.
AVR_CFLAGS = $(CFLAGS) -mmcu=$(AVR_MCU)
+AVR_ASFLAGS = $(ASFLAGS) -mmcu=$(AVR_MCU)
AVR_CPPFLAGS = $(CPPFLAGS) $(AVR_DEFS)
AVR_LDFLAGS = $(LDFLAGS)
AVR_LDLIBS = $(LDLIBS) $(AVR_LIBS)
@@ -11,6 +12,7 @@ AVR_CC = avr-gcc
AVR_OBJCOPY = avr-objcopy
AVR_OBJDUMP = avr-objdump
AVR_COMPILE.c = $(AVR_CC) $(AVR_CFLAGS) $(AVR_CPPFLAGS) -c
+AVR_COMPILE.S = $(AVR_CC) $(AVR_ASFLAGS) $(AVR_CPPFLAGS) -c
AVR_LINK.o = $(AVR_CC) $(AVR_CFLAGS) $(AVR_LDFLAGS)
# Main rules.
@@ -24,13 +26,16 @@ avr: elf lst hex
AVR_PROGS += $(PROGS)
AVR_ELFS = $(AVR_PROGS:%=%.avr.elf)
AVR_SOURCES = $(filter-out %.host.c,$(SOURCES))
-AVR_OBJECTS = $(AVR_SOURCES:%.c=%.avr.o)
+AVR_C_SOURCES = $(filter %.c,$(AVR_SOURCES))
+AVR_S_SOURCES = $(filter %.S,$(AVR_SOURCES))
+AVR_OBJECTS = $(AVR_C_SOURCES:%.c=%.avr.o) $(AVR_S_SOURCES:%.S=%.avr.o)
elf: $(AVR_ELFS)
lst: $(AVR_PROGS:%=%.avr.lst)
define AVR_PROG_template
-$(1).avr.elf: $$(patsubst %.c,%.avr.o,$$(filter-out %.host.c,$$($(1)_SOURCES)))
+$(1).avr.elf: $$(patsubst %.S,%.avr.o,$$(patsubst %.c,%.avr.o,\
+ $$(filter-out %.host.c,$$($(1)_SOURCES))))
endef
$(foreach prog,$(AVR_PROGS),$(eval $(call AVR_PROG_template,$(prog))))
@@ -44,6 +49,9 @@ $(AVR_ELFS):
%.avr.o: %.c
$(AVR_COMPILE.c) -o $@ $<
+%.avr.o: %.S
+ $(AVR_COMPILE.S) -o $@ $<
+
# Dependency checking.
-include $(AVR_OBJECTS:%.avr.o=%.avr.d)