| 1 | # Hardware definitions |
| 2 | PART=atmega88 |
| 3 | FREQ=1000000 |
| 4 | |
| 5 | CFLAGS=-Os |
| 6 | |
| 7 | MLDFLAGS=$(LDFLAGS) -mmcu=$(PART) |
| 8 | MCFLAGS=$(CFLAGS) -DF_CPU=$(FREQ)UL -mmcu=$(PART) |
| 9 | |
| 10 | .SUFFIXES: .hex .elf |
| 11 | |
| 12 | default: kokare.hex # kokare.ehex |
| 13 | |
| 14 | program: kokare.hex |
| 15 | avrdude -q -p m88 -U flash:w:kokare.hex |
| 16 | |
| 17 | .elf.hex: |
| 18 | avr-objcopy -O ihex -R .eeprom $> $@ |
| 19 | |
| 20 | #%.ehex: %.elf |
| 21 | # avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 $< $@ |
| 22 | |
| 23 | kokare.elf: kokare.o |
| 24 | avr-gcc $> -o $@ $(MLDFLAGS) -lm |
| 25 | |
| 26 | .c.o: |
| 27 | avr-gcc -c $(MCFLAGS) $< -o $@ |
| 28 | |
| 29 | clean: |
| 30 | rm -f *.o *.elf *.hex *.ehex |