xref: /netbsd-src/sys/arch/dreamcast/dev/microcode/Makefile (revision cfdefca109ee6a1048c62f7042cfbaa76aed88b2)
1*cfdefca1Sryo#	$NetBSD: Makefile,v 1.6 2022/09/25 21:19:20 ryo Exp $
27973c332Smarcus
37973c332SmarcusS	= ${.CURDIR}/../../../..
47973c332Smarcus
5*cfdefca1SryoTOOLDIR	?= /usr/pkg/cross-arm-none-eabi
6*cfdefca1Sryo
7*cfdefca1SryoCC	= ${TOOLDIR}/bin/arm-none-eabi-gcc
8*cfdefca1SryoOBJCOPY	= ${TOOLDIR}/bin/arm-none-eabi-objcopy
97973c332Smarcus
107973c332SmarcusCFLAGS	= -W -Wall -mlittle-endian
11de079359SryoCFLAGS	+= -O3 -mcpu=arm7
127973c332SmarcusCFLAGS	+= -fomit-frame-pointer -funroll-loops -finline-functions
137973c332SmarcusCFLAGS	+= -I${S}
147973c332Smarcus
157973c332Smarcusall: aica_armcode.h
167973c332Smarcus
177973c332Smarcusaica_armcode.h: aica_armcode.elf
187973c332Smarcus	${OBJCOPY} -O binary aica_armcode.elf aica_armcode.bin
1905d92b70Sitohy	echo '/* $$'NetBSD'$$ */' > ${.TARGET}.tmp
20970e24eeSuwe	echo 'static uint32_t aica_armcode[] = {' >> ${.TARGET}.tmp
217973c332Smarcus	hexdump -v -e '" /* %04.4_ax */\t" 1/4 "0x%08x, " "\n"' \
227973c332Smarcus		aica_armcode.bin >> ${.TARGET}.tmp
237973c332Smarcus	echo '		0 };' >> ${.TARGET}.tmp
247973c332Smarcus	mv ${.TARGET}.tmp ${.TARGET}
257973c332Smarcus
267973c332Smarcusaica_armcode.elf: aica_arm_locore.o aica_arm.o
277973c332Smarcus	${CC} ${CFLAGS} -Wl,-Ttext,0 -Wl,-T ldscript -nostdlib -e 0 \
287973c332Smarcus		-o aica_armcode.elf aica_arm_locore.o aica_arm.o
297973c332Smarcus
307973c332Smarcusclean: clean-tmp
317973c332Smarcus#	rm -f aica_armcode.h
327973c332Smarcus
337973c332Smarcusclean-tmp:
347973c332Smarcus	rm -f *.o aica_armcode.elf aica_armcode.bin aica_armcode.h.tmp
357973c332Smarcus
36