# BlueBrightnessControl4 - brightness control module for 4 230V AC lamps
# version 0.6.2 date 2007-03-23
# Copyright (C) 2006 Stefan Schuermans <stefan@blinkenarea.org>
# a BlinkenArea project - http://www.blinkenarea.org/

PERL = perl
AVRA = avra
AVRDUDE = avrdude
PROGRAMMER = avrisp2 -P usb

.PHONY: all prog prog_fuses clean

all: BlueBrightnessControl4.hex

mapping.gen.inc: mapping.pl
	$(PERL) mapping.pl >mapping.gen.inc

BlueBrightnessControl4.hex: BlueBrightnessControl4.asm mapping.gen.inc
	$(AVRA) -l BlueBrightnessControl4.lst BlueBrightnessControl4.asm

prog: BlueBrightnessControl4.hex
	$(AVRDUDE) -c $(PROGRAMMER) -p t2313 -u -e
	$(AVRDUDE) -c $(PROGRAMMER) -p t2313 -u -U flash:w:BlueBrightnessControl4.hex

prog_fuses:
	$(AVRDUDE) -c $(PROGRAMMER) -p t2313 -u -e
	$(AVRDUDE) -c $(PROGRAMMER) -p t2313 -u -U lfuse:w:0x64:m -U hfuse:w:0xDF:m -U efuse:w:0xFF:m

clean:
	rm -f *.gen.inc *.cof *.hex *.lst *.obj
