summaryrefslogtreecommitdiff
path: root/Makefile
blob: 23fc0af8037a03e62762a3ac88796b761209b2b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 $@