annotate tests/Makefile @ 9:705da39cdf91

Makefile for tests
author Thinker K.F. Li <thinker@branda.to>
date Sun, 22 Feb 2009 22:43:26 +0800
parents
children
rev   line source
9
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 HEXS := ledtest.hex cptest.hex
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 CC := avr-gcc
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 OBJCOPY := avr-objcopy
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 CFLAGS := -DF_CPU=16000000UL -mmcu=atmega168 -I../include -O
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 PORT?= /dev/cuaU0
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 all: $(HEXS)
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 ledtest.hex: ledtest
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 $(OBJCOPY) -O ihex -R .eeprom $(.ALLSRC) $@
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 cptest.hex: cptest
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 $(OBJCOPY) -O ihex -R .eeprom $(.ALLSRC) $@
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 cptest: cptest.c ../src/cmd_proto.c ../src/avriotools.c
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 $(CC) $(CFLAGS) -o $@ $(.ALLSRC)
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 ledtest: ledtest.c ../src/avriotools.c
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 $(CC) $(CFLAGS) -o $@ $(.ALLSRC)
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 install-ledtest:
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 avrdude -V -F -c stk500v1 -p m168 -b 19200 -P $(PORT) \
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 -U flash:w:ledtest.hex
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 install-cptest:
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 avrdude -V -F -c stk500v1 -p m168 -b 19200 -P $(PORT) \
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 -U flash:w:cptest.hex
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 clean:
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 @for f in $(HEXS) ${HEXS:C/\.hex//} *~; do \
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 if [ -e $$f ]; then \
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 echo "delete $$f"; \
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 rm -f $$f; \
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 fi; \
705da39cdf91 Makefile for tests
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 done