# $Id: makefile,v 1.10 2003/08/05 16:10:57 kolock Exp $

# Configure AVR part here
# #######################
PART=t26
MCU=-mmcu=attiny26
PROGRAMMER=AVRx16
#PROGRAMMER=bsd

# Project main file
# #################
all: adctest.hex

# Project installation
# ####################
install: ring.hex
	avrdude -U flash:w:ring.hex -p $(PART) -C /usr/avr/etc/avrdude.conf -c $(PROGRAMMER) -e

# Project dependencies (NOTE: mem => hex conversion is automatic)
# ####################

ring.mem: ring.o a2d.o global.o # spi.o
	avr-gcc $(MCU) -g -o $@ $^
#spi.o: spi.c spi.h 
# p4.o: p4.c spi.h
ring.o: ring.c a2d.h global.h # spi.h
a2d.o: a2d.c a2d.h
global.o: global.c global.h

# Linked projects
# ###############
rs232.o: rs232.c rs232.h 
rs232.c:
	ln -s ../rs-232/rs232.c rs232.c
rs232.h:
	ln -s ../rs-232/rs232.h rs232.h

# DO NOT EDIT BELOW THIS LINE
# ###########################
lfuse:
	avrdude -p $(PART) -c $(PROGRAMMER) -U lfuse:w:61:m
run:
	avrdude -p $(PART) -c $(PROGRAMMER) -Enoreset
clean:
	rm -f *.hex *.mem *.o

term:
	avrdude -p $(PART) -c $(PROGRAMMER) -t

%.o : %.c
	avr-gcc $(MCU) -g -Os -mcall-prologues -c $<

%.hex : %.mem
	avr-objcopy -O ihex $< $@

# $Log: makefile,v $
# Revision 1.10  2003/08/05 16:10:57  kolock
# changed link optimization flags to match the compile flags
#
# Revision 1.9  2003/07/24 19:25:48  jalonso
# Stripped out dependencies on rs232.h from makefile
#
# Revision 1.8  2003/07/24 20:24:42  kolock
# updated make file to include fuctions.c and .h
#
# Revision 1.7  2003/07/11 16:45:30  kolock
# Got basic spi communication between a Master spi device and the AVR using the defult_vector interrupt
#
# Revision 1.6  2003/07/03 21:32:03  kolock
# added encoder.c and encoder.h to determin rotation of screw shaft .. not tested if it works yet
#
# Revision 1.5  2003/07/02 17:42:56  kolock
# fixed capasitive sensor code to accept two pins as sensor
#
# Revision 1.4  2003/06/30 17:03:18  jalonso
# Removed debugging info from target mem file and added optimization to link step
#
# Revision 1.3  2003/06/28 19:06:44  jalonso
# Linked screw-actuator code to rs-232 code
#
# Revision 1.2  2003/06/28 19:03:25  jalonso
# Added CVS keywords and term target to AVR makefile
#
