view Makefile.avr @ 8:f9a085a0ba93

Change the 1 wire routines to mostly C with assembly delay routines for ease of portability.
author darius
date Mon, 12 Jul 2004 17:50:42 +0930
parents 0da70b744078
children a9d493261c6c
line wrap: on
line source

.SUFFIXES: .hex .out .c .o .elf .dmp .s

# Programs
AS=avr-as
CC=avr-gcc
OBJCOPY=avr-objcopy
OBJDUMP=avr-objdump

CPPFLAGS+=-Wa,-adhlmsn=${<:S/.c/.lst/}

PART?=8515
MCU?=at90s${PART}
CFLAGS+=-mmcu=${MCU}

LDFLAGS+=-Wl,-Map=${PROG}.map,--cref
LDFLAGS+=${LDADD}

RM=rm -f

PROGRAMMER=avrdude
PROGOPTS=-p ${PART} -c alf -E vcc,noreset -q

.if !defined(SRCS)
SRCS=	${PROG}.c
.endif

OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}

all: ${PROG}.hex ${PROG}.dmp

.c.o:
	${CC} ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC} -o ${.PREFIX}.o

${PROG}.elf: ${OBJS}
	${CC} ${CFLAGS} ${LDFLAGS} -g ${OBJS} -o ${PROG}.elf ${LDADD}

.elf.hex:
	${OBJCOPY} -j .text -O ihex $> $@

.elf.dmp:
	${OBJDUMP} -S ${.IMPSRC} > ${.PREFIX}.dmp

clean:
	${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp

prog: all
	${PROGRAMMER} -U flash:w:${PROG}.hex ${PROGOPTS}