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.avr25
1 files changed, 13 insertions, 12 deletions
diff --git a/n/avr/make/Makefile.avr b/n/avr/make/Makefile.avr
index 36b7589..26f3fd1 100644
--- a/n/avr/make/Makefile.avr
+++ b/n/avr/make/Makefile.avr
@@ -21,18 +21,19 @@ avr: elf lst hex
# General rules. {{{1
-AVR_ELFS = $(PROGS:%=%.avr.elf)
+AVR_PROGS += $(PROGS)
+AVR_ELFS = $(AVR_PROGS:%=%.avr.elf)
AVR_SOURCES = $(filter-out %.host.c,$(SOURCES))
AVR_OBJECTS = $(AVR_SOURCES:%.c=%.avr.o)
elf: $(AVR_ELFS)
-lst: $(PROGS:%=%.avr.lst)
+lst: $(AVR_PROGS:%=%.avr.lst)
define AVR_PROG_template
$(1).avr.elf: $$(patsubst %.c,%.avr.o,$$(filter-out %.host.c,$$($(1)_SOURCES)))
endef
-$(foreach prog,$(PROGS),$(eval $(call AVR_PROG_template,$(prog))))
+$(foreach prog,$(AVR_PROGS),$(eval $(call AVR_PROG_template,$(prog))))
$(AVR_ELFS):
$(AVR_LINK.o) $^ $(AVR_LDLIBS) -o $@
@@ -48,13 +49,13 @@ $(AVR_ELFS):
# Rules for building the .text rom images. {{{1
-TEXTS = $(PROGS:%=%.hex) $(PROGS:%=%.bin) $(PROGS:%=%.srec)
+TEXTS = $(AVR_PROGS:%=%.hex) $(AVR_PROGS:%=%.bin) $(AVR_PROGS:%=%.srec)
text: hex
-hex: $(PROGS:%=%.hex)
-bin: $(PROGS:%=%.bin)
-srec: $(PROGS:%=%.srec)
+hex: $(AVR_PROGS:%=%.hex)
+bin: $(AVR_PROGS:%=%.bin)
+srec: $(AVR_PROGS:%=%.srec)
%.hex: %.avr.elf
$(AVR_OBJCOPY) -j .text -j .data -O ihex $< $@
@@ -67,14 +68,14 @@ srec: $(PROGS:%=%.srec)
# Rules for building the .eeprom rom images. {{{1
-EEPROMS = $(PROGS:%=%_eeprom.hex) $(PROGS:%=%_eeprom.bin) \
- $(PROGS:%=%_eeprom.srec)
+EEPROMS = $(AVR_PROGS:%=%_eeprom.hex) $(AVR_PROGS:%=%_eeprom.bin) \
+ $(AVR_PROGS:%=%_eeprom.srec)
eeprom: ehex
-ehex: $(PROGS:%=%_eeprom.hex)
-ebin: $(PROGS:%=%_eeprom.bin)
-esrec: $(PROGS:%=%_eeprom.srec)
+ehex: $(AVR_PROGS:%=%_eeprom.hex)
+ebin: $(AVR_PROGS:%=%_eeprom.bin)
+esrec: $(AVR_PROGS:%=%_eeprom.srec)
%_eeprom.hex: %.avr.elf
$(AVR_OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@