annotate Makefile.avr @ 14:a9d493261c6c

- Add $Id$ - Rearrange slightly.
author darius
date Sat, 17 Sep 2005 18:02:28 +0930
parents 0da70b744078
children 108a703c39e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
a9d493261c6c - Add $Id$
darius
parents: 6
diff changeset
1 #
a9d493261c6c - Add $Id$
darius
parents: 6
diff changeset
2 # $Id$
a9d493261c6c - Add $Id$
darius
parents: 6
diff changeset
3 #
a9d493261c6c - Add $Id$
darius
parents: 6
diff changeset
4
2
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
5 .SUFFIXES: .hex .out .c .o .elf .dmp .s
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
6
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
7 # Programs
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
8 AS=avr-as
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
9 CC=avr-gcc
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
10 OBJCOPY=avr-objcopy
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
11 OBJDUMP=avr-objdump
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
12
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
13 CPPFLAGS+=-Wa,-adhlmsn=${<:S/.c/.lst/}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
14
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
15 PART?=8515
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
16 MCU?=at90s${PART}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
17 CFLAGS+=-mmcu=${MCU}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
18
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
19 LDFLAGS+=-Wl,-Map=${PROG}.map,--cref
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
20 LDFLAGS+=${LDADD}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
21
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
22 RM=rm -f
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
23
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
24 PROGRAMMER=avrdude
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
25 PROGOPTS=-p ${PART} -c alf -E vcc,noreset -q
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
26
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
27 .if !defined(SRCS)
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
28 SRCS= ${PROG}.c
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
29 .endif
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
30
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
31 OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
32
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
33 all: ${PROG}.hex ${PROG}.dmp
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
34
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
35 .c.o:
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
36 ${CC} ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC} -o ${.PREFIX}.o
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
37
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
38 ${PROG}.elf: ${OBJS}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
39 ${CC} ${CFLAGS} ${LDFLAGS} -g ${OBJS} -o ${PROG}.elf ${LDADD}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
40
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
41 .elf.hex:
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
42 ${OBJCOPY} -j .text -O ihex $> $@
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
43
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
44 .elf.dmp:
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
45 ${OBJDUMP} -S ${.IMPSRC} > ${.PREFIX}.dmp
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
46
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
47 clean:
6
0da70b744078 Clean the right files.
darius
parents: 2
diff changeset
48 ${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp
2
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
49
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
50 prog: all
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
51 ${PROGRAMMER} -U flash:w:${PROG}.hex ${PROGOPTS}
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
52
288d801a47ff Use nicer build framework.
darius
parents:
diff changeset
53