view BSDmakefile.arm @ 89:fc21fb5b171b default tip

Make error message more useful
author Daniel O'Connor <darius@dons.net.au>
date Fri, 13 Mar 2015 11:39:59 +1030
parents c0ff52b8e80c
children
line wrap: on
line source

# Cribbed from http://stm32.spacevs.com/index.php?option=com_content&view=category&id=9&Itemid=103 (and others)

.SUFFIXES:	.bin .elf .hex .map .lst .dmp

.MAIN:		depend ${PROG}.bin

#TCHAIN=		${HOME}/arm/arm-none-eabi-gcc-4_6/bin/arm-none-eabi
#TCHAIN=		/usr/local/Cellar/gcc-arm-none-eabi/20120614/bin/arm-none-eabi
TCHAIN=		/usr/local/gcc-arm-none-eabi-4_8-2014q2/bin/arm-none-eabi
#TCHAINSF=	-4.6

CC=		${TCHAIN}-gcc${TCHAINSF}
AS=		${TCHAIN}-gcc${TCHAINSF}
CXX=		${TCHAIN}-g++${TCHAINSF}
AR=		${TCHAIN}-ar${TCHAINSF}
OBJCOPY=	${TCHAIN}-objcopy${TCHAINSF}
GDB=		${TCHAIN}-gdb
RM=		rm -f
MKDEPCMD=	mkdep

CFLAGS+=	${COMMONFLAGS}

LDFLAGS+=	${COMMONFLAGS}
LDFLAGS+=	-L$(LIBDIR) -nostartfiles -Wl,--gc-sections,-T${LINKFILE}

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

.c.o:
		${CC} ${CFLAGS} ${CPPFLAGS} -Wa,-adhlns=${.PREFIX}.lst -c ${.IMPSRC} -o ${.PREFIX}.o

.s.o:
		${AS} ${CFLAGS} ${ASFLAGS} -c ${.IMPSRC} -o ${.PREFIX}.o

${PROG}.elf: ${OBJS} ${LINKFILE}
		${CC} ${LDFLAGS} ${OBJS} -Wl,-Map=${PROG}.map,--cref -o ${PROG}.elf ${LDADD}

.elf.bin:
		${OBJCOPY} -O binary ${.ALLSRC} ${.TARGET}

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

debug:
		${GDB} -ex "target extended-remote ${DBGPORT}" -ex "mon jtag_scan" -ex "attach 1" ${PROG}.elf

load:
		${GDB} -ex "target extended-remote ${DBGPORT}" -ex "mon jtag_scan" -ex "attach 1" -ex "load" -ex "detach" -ex "quit" ${PROG}.elf

depend: .depend

.depend: ${SRCS}
		CC='${CC}' ${MKDEPCMD} ${CFLAGS} ${.ALLSRC}

#########################
#;;; Local Variables: ***
#;;; mode:makefile ***
#;;; End: ***