PART=m328p MCU=atmega328 PROG=avrispMKII F_CPU=1000000 SRC=bom.c twi.c HDR=twi.h FLAGS=-mmcu=$(MCU) -DF_CPU=$(F_CPU)UL -funsigned-char -Os -fpack-struct -Wall default: bom.hex %.hex: %.elf avr-objcopy -j .text -j .data -O ihex $< $@ bom.elf: $(SRC) $(HDR) avr-g++ $(FLAGS) $(SRC) -o bom.elf program: bom.hex avrdude -p $(PART) -c $(PROG) -P usb -B 3 -U flash:w:bom.hex