summaryrefslogtreecommitdiff
path: root/n
diff options
context:
space:
mode:
Diffstat (limited to 'n')
-rw-r--r--n/avr/make/Makefile.avr17
1 files changed, 15 insertions, 2 deletions
diff --git a/n/avr/make/Makefile.avr b/n/avr/make/Makefile.avr
index fe825c7..81a0c74 100644
--- a/n/avr/make/Makefile.avr
+++ b/n/avr/make/Makefile.avr
@@ -28,22 +28,27 @@ avr: elf lst hex
AVR_PROGS += $(PROGS)
AVR_ELFS = $(AVR_PROGS:%=%.avr.elf)
+AVR_SIMU_ELFS = $(AVR_ELFS:%.avr.elf=%.avr.simu.elf)
AVR_SOURCES = $(filter-out %.host.c,$(SOURCES))
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)
+AVR_SIMU_OBJECTS = $(AVR_OBJECTS:%.avr.o=%.avr.simu.o)
elf: $(AVR_ELFS)
+simu: $(AVR_SIMU_ELFS)
lst: $(AVR_PROGS:%=%.avr.lst)
define AVR_PROG_template
$(1).avr.elf: $$(patsubst %.S,%.avr.o,$$(patsubst %.c,%.avr.o,\
$$(filter-out %.host.c,$$($(1)_SOURCES))))
+$(1).avr.simu.elf: $$(patsubst %.S,%.avr.simu.o,$$(patsubst %.c,%.avr.simu.o,\
+ $$(filter-out %.host.c,$$($(1)_SOURCES))))
endef
$(foreach prog,$(AVR_PROGS),$(eval $(call AVR_PROG_template,$(prog))))
-$(AVR_ELFS):
+$(AVR_ELFS) $(AVR_SIMU_ELFS):
$(AVR_LINK.o) $^ $(AVR_LDLIBS) -o $@
%.avr.lst: %.avr.elf
@@ -52,11 +57,18 @@ $(AVR_ELFS):
%.avr.o: %.c
$(AVR_COMPILE.c) -o $@ $<
+%.avr.simu.o: %.c
+ $(AVR_COMPILE.c) -DSIMU=1 -o $@ $<
+
%.avr.o: %.S
$(AVR_COMPILE.S) -o $@ $<
+%.avr.simu.o: %.S
+ $(AVR_COMPILE.S) -DSIMU=1 -o $@ $<
+
# Dependency checking.
-include $(AVR_OBJECTS:%.avr.o=%.avr.d)
+-include $(AVR_SIMU_OBJECTS:%.avr.simu.o=%.avr.d)
# Rules for building the .text rom images.
@@ -100,5 +112,6 @@ esrec: $(AVR_PROGS:%=%_eeprom.srec)
# Cleaning.
clean.avr:
- rm -f *.avr.o *.avr.d $(AVR_ELFS) *.avr.lst *.avr.map $(TEXTS) $(EEPROMS)
+ rm -f *.avr.o *.avr.d $(AVR_ELFS) *.avr.simu.o *.avr.simu.d $(AVR_SIMU_ELFS)
+ rm -f *.avr.lst *.avr.map $(TEXTS) $(EEPROMS)