view gcc/makefile-body @ 204:027b22814ac4

targets/fcdev3b.h: sync with Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 13 Oct 2020 01:04:20 +0000
parents 767c75e3d2f2
children
line wrap: on
line source

CC=	arm-elf-gcc
LD=	arm-elf-ld
OBJCOPY=arm-elf-objcopy

CFLAGS=	-mthumb-interwork

LIBC_A=		`${CC} -print-file-name=libc.a -mthumb-interwork`
LIBGCC_A=	`${CC} -print-file-name=libgcc.a -mthumb-interwork`
LIBM_T=		`${CC} -print-file-name=libm.a -mthumb-interwork -mthumb`

all:	fwimage.bin flash-script
ram:	ramimage.srec

${SUBDIR}: FRC
	cd $@; ${MAKE} ${MFLAGS}

${LIBS}:	${SUBDIR}
	@true

bootentry-flash.o:	../src/cs/system/main/gcc/bootentry.S
	${CC} -c -o $@ ${CFLAGS} -DFLASH -Iconfig -I../src/nucleus/gcc $<

bootentry-xram.o:	../src/cs/system/main/gcc/bootentry.S
	${CC} -c -o $@ ${CFLAGS} -DXRAM -Iconfig -I../src/nucleus/gcc $<

ramvecs.o:	../src/cs/system/main/gcc/ramvecs.S
	${CC} -c ${CFLAGS} $<

build_date.c:	${LIBS} bootentry-flash.o bootentry-xram.o ramvecs.o Makefile
	../helpers/build-date ${CONFIG_NAME} ${TARGET} \
		`../scripts/src-version.sh` > $@

build_date.o:	build_date.c
	${CC} -c ${CFLAGS} build_date.c

fwimage.ld:	../targets/${TARGET}.m4 ../gcc/flash.m4 ../gcc/ld-script.src
	m4 $^ > $@

fwimage.elf:	${LIBS} bootentry-flash.o ramvecs.o build_date.o fwimage.ld
	${LD} -N -T fwimage.ld -o $@ -Map fwimage.map bootentry-flash.o \
		ramvecs.o build_date.o --start-group ${LIBS} --end-group \
		${LIBM_T} ${LIBC_A} ${LIBGCC_A}

fwimage.bin:	fwimage.elf
	${OBJCOPY} -O binary $< $@

flash-script:	fwimage.bin
	../helpers/mk-flash-script $< ${FLASH_BASE_ADDR} ${FLASH_SECTOR_SIZE} \
		> $@

ramimage.ld:	../targets/${TARGET}.m4 ../gcc/xram.m4 ../gcc/ld-script.src
	m4 $^ > $@

ramimage.elf:	${LIBS} bootentry-xram.o ramvecs.o build_date.o ramimage.ld
	${LD} -N -T ramimage.ld -o $@ -Map ramimage.map bootentry-xram.o \
		ramvecs.o build_date.o --start-group ${LIBS} --end-group \
		${LIBM_T} ${LIBC_A} ${LIBGCC_A}

ramimage.srec:	ramimage.elf
	${OBJCOPY} -O srec --srec-forceS3 --srec-len=30 $< $@

clean:	FRC
	rm -f fwimage.* ramimage.* bootentry*.o ramvecs.o
	rm -f build_date.* flash-script
	for i in ${SUBDIR}; do (cd $$i; ${MAKE} ${MFLAGS} clean); done

FRC: