comparison gcc/makefile-body @ 91:081dd22ca6a2

gcc/makefile-body: created
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 21 Jul 2018 00:21:50 +0000
parents
children e5cbc745543b
comparison
equal deleted inserted replaced
90:2de9e5f46550 91:081dd22ca6a2
1 CC= arm-elf-gcc
2 LD= arm-elf-ld
3 OBJCOPY=arm-elf-objcopy
4
5 LIBC_A= `${CC} -print-file-name=libc.a -mthumb-interwork`
6 LIBGCC_A= `${CC} -print-file-name=libgcc.a -mthumb-interwork`
7 LIBM_T= `${CC} -print-file-name=libc.a -mthumb-interwork -mthumb`
8
9 all: fwimage.bin flash-script
10 ram: ramimage.srec
11
12 ${SUBDIR}: FRC
13 cd $@; ${MAKE} ${MFLAGS}
14
15 ${LIBS}: ${SUBDIR}
16 @true
17
18 bootentry-flash.o: ../src/cs/system/main/gcc/bootentry.S
19 ${CC} -c -mthumb-interwork -DFLASH -Iconfig -I../src/nucleus/gcc $<
20
21 bootentry-xram.o: ../src/cs/system/main/gcc/bootentry.S
22 ${CC} -c -mthumb-interwork -DXRAM -Iconfig -I../src/nucleus/gcc $<
23
24 ramvecs.o: ../src/cs/system/main/gcc/ramvecs.S
25 ${CC} -c -mthumb-interwork $<
26
27 build_date.c: ${LIBS} bootentry-flash.o bootentry-xram.o ramvecs.o
28 ../helpers/build-date gcc > $@
29
30 build_date.o: build_date.c
31 ${CC} -c -mthumb-interwork build_date.c
32
33 fwimage.ld: ../targets/${TARGET}.m4 ../gcc/flash.m4 ../gcc/ld-script.src
34 m4 $^ > $@
35
36 fwimage.elf: ${LIBS} bootentry-flash.o ramvecs.o build_date.o fwimage.ld
37 ${LD} -N -T fwimage.ld -o $@ -Map fwimage.map bootentry-flash.o \
38 ramvecs.o build_date.o --start-group ${LIBS} --end-group \
39 ${LIBM_T} ${LIBC_A} ${LIBGCC_A}
40
41 fwimage.bin: fwimage.elf
42 ${OBJCOPY} -O binary $< $@
43
44 flash-script: fwimage.bin
45 ../helpers/mk-flash-script $< ${FLASH_BASE_ADDR} ${FLASH_SECTOR_SIZE} \
46 > $@
47
48 ramimage.ld: ../targets/${TARGET}.m4 ../gcc/xram.m4 ../gcc/ld-script.src
49 m4 $^ > $@
50
51 ramimage.elf: ${LIBS} bootentry-xram.o ramvecs.o build_date.o ramimage.ld
52 ${LD} -N -T ramimage.ld -o $@ -Map ramimage.map bootentry-xram.o \
53 ramvecs.o build_date.o --start-group ${LIBS} --end-group \
54 ${LIBM_T} ${LIBC_A} ${LIBGCC_A}
55
56 ramimage.srec: ramimage.elf
57 ${OBJCOPY} -O srec --srec-forceS3 --srec-len=30 $< $@
58
59 clean: FRC
60 rm -f fwimage.* ramimage.* bootentry-*.o ramvecs.o
61 rm -f build_date.* flash-script
62 for i in ${SUBDIR}; do (cd $$i; ${MAKE} ${MFLAGS} clean); done
63
64 FRC: