comparison BSDmakefile.arm @ 28:7f8e5780024b

- Add depend target. - Switch to Homebrew toolchain
author Daniel O'Connor <darius@dons.net.au>
date Tue, 27 Nov 2012 13:16:47 +1030
parents 35cf31794a42
children 7e5916574d5e
comparison
equal deleted inserted replaced
27:5c9d2e3d6591 28:7f8e5780024b
1 # Cribbed from http://stm32.spacevs.com/index.php?option=com_content&view=category&id=9&Itemid=103 (and others) 1 # Cribbed from http://stm32.spacevs.com/index.php?option=com_content&view=category&id=9&Itemid=103 (and others)
2 2
3 .SUFFIXES: .bin .elf .hex .map .lst .dmp 3 .SUFFIXES: .bin .elf .hex .map .lst .dmp
4 4
5 .MAIN: ${PROG}.bin 5 .MAIN: depend ${PROG}.bin
6 6
7 TCHAIN= ${HOME}/arm/arm-none-eabi-gcc-4_6/bin/arm-none-eabi 7 #TCHAIN= ${HOME}/arm/arm-none-eabi-gcc-4_6/bin/arm-none-eabi
8 TCHAIN= /usr/local/Cellar/gcc-arm-none-eabi/20120614/bin/arm-none-eabi
8 #TCHAIN= arm-elf 9 #TCHAIN= arm-elf
9 #TCHAINSF= -4.6 10 #TCHAINSF= -4.6
10 11
11 CC= ${TCHAIN}-gcc${TCHAINSF} 12 CC= ${TCHAIN}-gcc${TCHAINSF}
12 AS= ${TCHAIN}-gcc${TCHAINSF} 13 AS= ${TCHAIN}-gcc${TCHAINSF}
13 CXX= ${TCHAIN}-g++${TCHAINSF} 14 CXX= ${TCHAIN}-g++${TCHAINSF}
14 AR= ${TCHAIN}-ar${TCHAINSF} 15 AR= ${TCHAIN}-ar${TCHAINSF}
15 OBJCOPY= ${TCHAIN}-objcopy${TCHAINSF} 16 OBJCOPY= ${TCHAIN}-objcopy${TCHAINSF}
16 GDB= ${TCHAIN}-gdb 17 GDB= ${TCHAIN}-gdb
17 RM= rm -f 18 RM= rm -f
19 MKDEPCMD= mkdep
18 20
19 CFLAGS+= ${COMMONFLAGS} 21 CFLAGS+= ${COMMONFLAGS}
20 22
21 LDFLAGS+= ${COMMONFLAGS} 23 LDFLAGS+= ${COMMONFLAGS}
22 LDFLAGS+= -L$(LIBDIR) -nostartfiles -Wl,--gc-sections,-T${LINKFILE} 24 LDFLAGS+= -L$(LIBDIR) -nostartfiles -Wl,--gc-sections,-T${LINKFILE}
34 36
35 .elf.bin: 37 .elf.bin:
36 ${OBJCOPY} -O binary ${.ALLSRC} ${.TARGET} 38 ${OBJCOPY} -O binary ${.ALLSRC} ${.TARGET}
37 39
38 clean: 40 clean:
39 ${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.bin ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp 41 ${RM} ${PROG}.hex ${PROG}.out ${PROG}.elf ${PROG}.bin ${PROG}.map ${OBJS} ${OBJS:S/.o/.lst/} ${PROG}.dmp .depend
40 42
41 debug: 43 debug:
42 ${GDB} -ex "target extended-remote ${DBGPORT}" -ex "attach 1" ${PROG}.elf 44 ${GDB} -ex "target extended-remote ${DBGPORT}" -ex "attach 1" ${PROG}.elf
43 45
44 load: 46 load:
45 ${GDB} -ex "target extended-remote ${DBGPORT}" -ex "attach 1" -ex "load" -ex "detach" -ex "quit" ${PROG}.elf 47 ${GDB} -ex "target extended-remote ${DBGPORT}" -ex "attach 1" -ex "load" -ex "detach" -ex "quit" ${PROG}.elf
46 48
49 depend: .depend
50
51 .depend: ${SRCS}
52 CC='${CC}' ${MKDEPCMD} ${CFLAGS} ${.ALLSRC}
53
47 ######################### 54 #########################
48 #;;; Local Variables: *** 55 #;;; Local Variables: ***
49 #;;; mode:makefile *** 56 #;;; mode:makefile ***
50 #;;; End: *** 57 #;;; End: ***
51