From d58959c353f8e70b4b057ce8ba2907b52f6d28b7 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Mon, 21 May 2012 19:16:52 +0200 Subject: door: new code for door AVR --- Makefile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'Makefile') 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 $@ $< -- cgit v1.2.1