GCCFLAGS=-g -Os -Wall -mmcu=atmega168 
LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm
AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P COM9
LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/twimaster.o ../libnerdkits/lcd.o ../libnerdkits/uart.o

all:	io_expander-upload

io_expander.hex:	io_expander.c
	make -C ../libnerdkits
	avr-gcc ${GCCFLAGS} -o ../libnerdkits/twimaster.o -c ../libnerdkits/twimaster.c
	avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o io_expander.o io_expander.c ${LINKOBJECTS}
	avr-objcopy -j .text -O ihex io_expander.o io_expander.hex
	
io_expander.ass:	io_expander.hex
	avr-objdump -S -d io_expander.o > io_expander.ass
	
io_expander-upload:	io_expander.hex
	avrdude ${AVRDUDEFLAGS} -U flash:w:io_expander.hex:a
