annotate Makefile.avr @ 0:3879f487b661

Initial commit of routines I copy and paste. Need work to make them more portable (esp cons)
author darius@Inchoate
date Wed, 11 Mar 2009 16:42:27 +1030
parents
children f5022e20d550
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
1 #
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
2 # $Id$
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
3 #
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
4
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
5 .SUFFIXES: .hex .out .c .o .elf .dmp .s
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
6
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
7 # Otherwise we get -march=foo
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
8 NO_CPU_CFLAGS=
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
9 _CPUCFLAGS=
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
10
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
11 # Programs
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
12 AS=avr-as
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
13 CC=avr-gcc
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
14 OBJCOPY=avr-objcopy
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
15 OBJDUMP=avr-objdump
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
16
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
17 # Tell as to generate listings
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
18 CPPFLAGS+=-Wa,-adhlmsn=${<:S/.c/.lst/}
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
19
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
20 MCU?=at90s8515
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
21 CFLAGS+=-mmcu=${MCU}
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
22
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
23 LDFLAGS+=-Wl,-Map=${PROG}.map,--cref
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
24 LDFLAGS+=${LDADD}
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
25
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
26 RM=rm -f
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
27
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
28 PROGRAMMER=avrdude
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
29 PROGOPTS?=-p ${PART} -c alf -E vcc,noreset -q
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
30
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
31 .if !defined(SRCS)
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
32 SRCS= ${PROG}.c
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
33 .endif
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
34
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
35 OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
36
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
37 all: ${PROG}.hex ${PROG}.dmp
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
38
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
39 .c.o:
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
40 ${CC} ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC} -o ${.PREFIX}.o
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
41
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
42 ${PROG}.elf: ${OBJS}
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
43 ${CC} ${CFLAGS} ${LDFLAGS} -g ${OBJS} -o ${PROG}.elf ${LDADD}
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
44
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
45 .elf.hex:
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
46 ${OBJCOPY} -j .text -j .data -j .bss -j .noinit -O ihex $> $@
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
47
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
48 .elf.dmp:
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
49 ${OBJDUMP} -S ${.IMPSRC} > ${.PREFIX}.dmp
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
50
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
51 clean:
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
52 ${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
53
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
54 prog: all
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
55 ${PROGRAMMER} -U flash:w:${PROG}.hex ${PROGOPTS}
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
56
3879f487b661 Initial commit of routines I copy and paste.
darius@Inchoate
parents:
diff changeset
57