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.avr54
1 files changed, 29 insertions, 25 deletions
diff --git a/n/avr/make/Makefile.avr b/n/avr/make/Makefile.avr
index 81a0c74..b063fe5 100644
--- a/n/avr/make/Makefile.avr
+++ b/n/avr/make/Makefile.avr
@@ -2,41 +2,44 @@
#
# 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)
-
-AVR_CC = avr-gcc
-AVR_OBJCOPY = avr-objcopy
-AVR_OBJDUMP = avr-objdump
+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)
+
+AVR_CC := avr-gcc
+AVR_OBJCOPY := avr-objcopy
+AVR_OBJDUMP := avr-objdump
AVR_COMPILE.c = $(AVR_CC) $(AVR_CFLAGS) $(AVR_CPPFLAGS) -c
ifdef L
AVR_COMPILE.c += -Wa,-adhlns=$(@:%.avr.o=%.c.avr.lst)
endif
-AVR_COMPILE.S = $(AVR_CC) $(AVR_ASFLAGS) $(AVR_CPPFLAGS) -c
-AVR_LINK.o = $(AVR_CC) $(AVR_CFLAGS) $(AVR_LDFLAGS)
+AVR_COMPILE.S := $(AVR_CC) $(AVR_ASFLAGS) $(AVR_CPPFLAGS) -c
+AVR_LINK.o := $(AVR_CC) $(AVR_CFLAGS) $(AVR_LDFLAGS)
# Main rules.
avr: elf lst hex
-.PHONY: avr clean.avr elf lst text hex srec bin eeprom ehex esrec ebin
+simu: simuelf
+
+.PHONY: avr simu clean.avr elf simuelf lst \
+ text hex srec bin eeprom ehex esrec ebin
# General rules.
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)
+AVR_ELFS := $(AVR_PROGS:%=%.avr.elf)
+AVR_SIMU_ELFS := $(SIMU_PROGS:%=%.avr.simu.elf)
+AVR_SOURCES := $(filter-out %.host.c,$(ALL_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)
+simuelf: $(AVR_SIMU_ELFS)
lst: $(AVR_PROGS:%=%.avr.lst)
define AVR_PROG_template
@@ -72,7 +75,7 @@ $(AVR_ELFS) $(AVR_SIMU_ELFS):
# Rules for building the .text rom images.
-TEXTS = $(AVR_PROGS:%=%.hex) $(AVR_PROGS:%=%.bin) $(AVR_PROGS:%=%.srec)
+TEXTS := $(AVR_PROGS:%=%.hex) $(AVR_PROGS:%=%.bin) $(AVR_PROGS:%=%.srec)
text: hex
@@ -91,8 +94,8 @@ srec: $(AVR_PROGS:%=%.srec)
# Rules for building the .eeprom rom images.
-EEPROMS = $(AVR_PROGS:%=%_eeprom.hex) $(AVR_PROGS:%=%_eeprom.bin) \
- $(AVR_PROGS:%=%_eeprom.srec)
+EEPROMS := $(AVR_PROGS:%=%_eeprom.hex) $(AVR_PROGS:%=%_eeprom.bin) \
+ $(AVR_PROGS:%=%_eeprom.srec)
eeprom: ehex
@@ -112,6 +115,7 @@ esrec: $(AVR_PROGS:%=%_eeprom.srec)
# Cleaning.
clean.avr:
- 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)
+ rm -f *.avr.o *.avr.d $(AVR_ELFS) \
+ *.avr.simu.o *.avr.simu.d $(AVR_SIMU_ELFS) \
+ *.avr.lst *.avr.map $(TEXTS) $(EEPROMS)