diff src/Makefile @ 2:abf221bf3ce4

AVR JTAG server.
author Thinker K.F. Li <thinker@branda.to>
date Sat, 21 Feb 2009 23:06:50 +0800
parents
children e410832c3280
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Makefile	Sat Feb 21 23:06:50 2009 +0800
@@ -0,0 +1,33 @@
+CFLAGS =	-DF_CPU=16000000UL -mmcu=atmega168 -I../include -O2
+AVR_JTAG_OBJS =	\
+	avr_jtag.o	\
+	avriotools.o	\
+	cmd_proto.o	\
+	jtag.o
+CC= avr-gcc
+OBJCOPY= avr-objcopy
+PORT?= /dev/cuaU0
+
+all: avr_jtag.hex
+
+avr_jtag.hex: avr_jtag
+	$(OBJCOPY) -O ihex -R .eeprom $(.ALLSRC) $@
+
+avr_jtag: $(AVR_JTAG_OBJS)
+	$(CC) -o $@ $(.ALLSRC)
+
+$(AVR_JTAG_OBJS): ${@:C/\.o/.c/}
+	$(CC) $(CFLAGS) -c $(.ALLSRC)
+
+install:
+	avrdude -V -F -c stk500v1 -p m168 -b 19200 -P $(PORT) \
+		-U flash:w:avr_jtag.hex
+
+
+clean:
+	@for f in $(AVR_JTAG_OBJS) avr_jtag avr_jtag.hex *~; do \
+		if [ -e $$f ]; then \
+			echo "delete $$f"; \
+			rm -f $$f; \
+		fi; \
+	done
\ No newline at end of file