comparison Makefile.avr @ 2:288d801a47ff

Use nicer build framework.
author darius
date Sun, 11 Jul 2004 22:06:14 +0930
parents
children 0da70b744078
comparison
equal deleted inserted replaced
0:ffeab3c04e83 2:288d801a47ff
1 .SUFFIXES: .hex .out .c .o .elf .dmp .s
2
3 # Programs
4 AS=avr-as
5 CC=avr-gcc
6 OBJCOPY=avr-objcopy
7 OBJDUMP=avr-objdump
8
9 CPPFLAGS+=-Wa,-adhlmsn=${<:S/.c/.lst/}
10
11 PART?=8515
12 MCU?=at90s${PART}
13 CFLAGS+=-mmcu=${MCU}
14
15 LDFLAGS+=-Wl,-Map=${PROG}.map,--cref
16 LDFLAGS+=${LDADD}
17
18 RM=rm -f
19
20 PROGRAMMER=avrdude
21 PROGOPTS=-p ${PART} -c alf -E vcc,noreset -q
22
23 .if !defined(SRCS)
24 SRCS= ${PROG}.c
25 .endif
26
27 OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
28
29 all: ${PROG}.hex ${PROG}.dmp
30
31 .c.o:
32 ${CC} ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC} -o ${.PREFIX}.o
33
34 ${PROG}.elf: ${OBJS}
35 ${CC} ${CFLAGS} ${LDFLAGS} -g ${OBJS} -o ${PROG}.elf ${LDADD}
36
37 .elf.hex:
38 ${OBJCOPY} -j .text -O ihex $> $@
39
40 .elf.dmp:
41 ${OBJDUMP} -S ${.IMPSRC} > ${.PREFIX}.dmp
42
43 clean:
44 ${RM} ${PROG}.s19 ${PROG}.out ${PROG}.elf ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp
45
46 prog: all
47 ${PROGRAMMER} -U flash:w:${PROG}.hex ${PROGOPTS}
48
49