annotate 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
rev   line source
2
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 CFLAGS = -DF_CPU=16000000UL -mmcu=atmega168 -I../include -O2
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 AVR_JTAG_OBJS = \
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 avr_jtag.o \
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 avriotools.o \
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 cmd_proto.o \
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 jtag.o
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 CC= avr-gcc
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 OBJCOPY= avr-objcopy
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 PORT?= /dev/cuaU0
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 all: avr_jtag.hex
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 avr_jtag.hex: avr_jtag
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 $(OBJCOPY) -O ihex -R .eeprom $(.ALLSRC) $@
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 avr_jtag: $(AVR_JTAG_OBJS)
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 $(CC) -o $@ $(.ALLSRC)
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 $(AVR_JTAG_OBJS): ${@:C/\.o/.c/}
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 $(CC) $(CFLAGS) -c $(.ALLSRC)
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 install:
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 avrdude -V -F -c stk500v1 -p m168 -b 19200 -P $(PORT) \
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 -U flash:w:avr_jtag.hex
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 clean:
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 @for f in $(AVR_JTAG_OBJS) avr_jtag avr_jtag.hex *~; do \
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 if [ -e $$f ]; then \
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 echo "delete $$f"; \
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 rm -f $$f; \
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 fi; \
abf221bf3ce4 AVR JTAG server.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 done