summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2011-08-21 14:56:43 +0200
committerDavid Lamparter <equinox@diac24.net>2011-08-21 14:56:43 +0200
commitaa0a617f957de3c42a217283b8cc35db669d270c (patch)
treea04f6e7ed604abfc0dad81d1230158aba9070528 /Makefile
initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 21 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..23fc0af
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+.PHONY: flash love
+
+TARGET=can
+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}
+
+love: ${TARGET}.elf
+
+flash: ${TARGET}.flash
+ avrdude -p m48 -c stk500v2 -P avrdoper -y -U flash:w:$<
+
+%.flash: %.elf Makefile
+ avr-objcopy -j .text -j .data -O ihex $< $@
+%.elf: %.c *.c *.x Makefile
+ avr-gcc ${CFLAGS} -o $@ $<
+ avr-size $@