CC=avr-gcc CFLAGS=-mmcu=$(MMCU) -Wall -Os -DF_CPU=$(F_CPU) MMCU=attiny45 PROGRAMMER=avr910 DEVICE=/dev/ttyUSB0 F_CPU=1000000 MAIN=coaster SOURCES=$(MAIN).cpp all: $(MAIN).hex # Implicit rule to create hex files from source files %.hex: %.out # $< is the first dependency # $@ is the left side of the rule avr-objcopy -O ihex $< $@ avr-size --mcu=$(MMCU) --format=avr $< %.out: $(SOURCES) $(CC) $(CFLAGS) -I./ $< -o $@ -std=c++11 program: $(MAIN).hex avrdude -p t45 -P $(DEVICE) -c $(PROGRAMMER) -U flash:w:$< clean: rm *.hex