summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2012-05-21 19:16:52 +0200
committerDavid Lamparter <equinox@diac24.net>2012-05-21 19:16:52 +0200
commitd58959c353f8e70b4b057ce8ba2907b52f6d28b7 (patch)
tree2f4c00a4189bcf2912ac0427b4541e14f62d82f0 /Makefile
parent28506241e9c0b81b6a2c090471762d2142935793 (diff)
door: new code for door AVR
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 15 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 9dc7daa..b3e7d33 100644
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,30 @@
.PHONY: flash love
-TARGET=lightctrl
+TARGETS=door lightctrl
+
CFLAGS_OPT=-Os \
-fpredictive-commoning -fmerge-all-constants -fmodulo-sched -fmodulo-sched-allow-regmoves \
-fgcse-sm -fgcse-las -fgcse-after-reload -fconserve-stack \
-fwhole-program
CFLAGS_WARN=-std=gnu99 -Wall -Wextra -Wno-unused -pedantic
CFLAGS_LD=-Wl,-T,avr4-signature.x
-CFLAGS=-mmcu=atmega48 ${CFLAGS_WARN} ${CFLAGS_OPT} ${CFLAGS_LD}
+CFLAGS=${CFLAGS_WARN} ${CFLAGS_OPT} ${CFLAGS_LD}
+MCU_door=48
+MCU_lightctrl=88
-love: ${TARGET}.elf
+love: $(foreach target,$(TARGETS),$(target).elf)
+ avr-size $^
+ifdef TARGET
flash: ${TARGET}.flash
- avrdude -p m48 -c stk500v2 -P avrdoper -y -U flash:w:$<
+ avrdude -p m$(MCU_$(basename $<)) -c stk500v2 -P avrdoper -y -U flash:w:$<
+else
+flash:
+ @echo the flash target is available only with TARGET set to something. use e.g. \"make flash TARGET=door\" >&2
+ @false
+endif
%.flash: %.elf Makefile
avr-objcopy -j .text -j .data -O ihex $< $@
%.elf: %.c *.c *.x Makefile
- avr-gcc ${CFLAGS} -o $@ $<
- avr-size $@
+ avr-gcc -mmcu=atmega$(MCU_$(basename $@)) ${CFLAGS} -o $@ $<