diff options
author | Christian Franke <nobody@nowhere.ws> | 2013-12-05 04:06:23 +0100 |
---|---|---|
committer | Christian Franke <nobody@nowhere.ws> | 2013-12-05 04:06:23 +0100 |
commit | 12688a2578ace9776eadfaae0806eaf4ebec48e6 (patch) | |
tree | fe48442a5f8bc4d4af233cb5a58a96bf17bde03e /Makefile |
Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b7690cd --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +MCU=atmega32 +AVRDUDE=avrdude +ACC=avr-gcc +AOBJCOPY=avr-objcopy +ALD=avr-ld +ASIZE=avr-size +CFLAGS=-Wall -Wextra -Wno-unused-parameter -pedantic -std=c99 + +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: ferment.flash ferment.eeprom + +%.flash: %.ld.o + $(AOBJCOPY) -O binary $< $@ + +%.eeprom: %.ld.o + $(AOBJCOPY) -j .eeprom -O binary $^ $@ + +%.ld.o: %.o + $(ACC) $(ACFLAGS) $(ALDFLAGS) -Wl,-Map,$(patsubst %.ld.o,%.map,$@) -o $@ $< + @$(ASIZE) $@ + +%.o: %.c + $(ACC) $(ACFLAGS) -c -o $@ $< + +flash: ferment.flash + $(AVRDUDE) -y -p m32 -E noreset -U flash:w:$<:r +eeprom: ferment.eeprom + $(AVRDUDE) -y -p m32 -E noreset -U eeprom:w:$<:r + +clean: + rm -f *.flash *.eeprom *.o + +.PHONY: love flash eeprom clean +.SECONDARY: + |