summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2010-10-17 20:43:56 +0200
committerDavid Lamparter <equinox@diac24.net>2010-10-17 20:43:56 +0200
commit71a40edcc08a468d4e661416b09882d339334ecd (patch)
tree0245c7bd38a78a796fae20b41cc55686a372dbe2 /Makefile
kbc: initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..642202a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,38 @@
+MCU=atmega48
+AVRDUDE=avrdude
+ACC=avr-gcc
+AOBJCOPY=avr-objcopy
+ALD=avr-ld
+CFLAGS=-Wall -Wextra -Wno-unused-parameter -pedantic -std=c99
+ifdef PIN
+DPIN=-DPIN=\"$(PIN)\"
+endif
+ACFLAGS=-g -mmcu=$(MCU) $(CFLAGS) $(DPIN) -Os -mcall-prologues
+# ALDFLAGS=-L/usr/avr/lib/avr4 -L/usr/lib/binutils/avr/2.18
+LD=gcc
+CC=gcc
+CXX=g++ -g
+LDXX=g++ -g
+
+love: kbc.flash
+
+%.flash: %.ld.o
+ $(AOBJCOPY) -O binary $< $@
+
+%.eeprom: %.ld.o
+ $(AOBJCOPY) -j .eeprom -O binary $^ $@
+
+%.ld.o: %.o
+ $(ACC) $(ACFLAGS) $(ALDFLAGS) -o $@ $<
+
+%.o: %.c
+ $(ACC) $(ACFLAGS) -c -o $@ $<
+
+flash: kbc.flash
+ $(AVRDUDE) -y -p m48 -E noreset -U $^
+
+clean:
+ rm -f *.flash *.eeprom *.o
+
+.PHONY: love flash clean
+