xxd -n (set variable name) doesn't exist on all systems, use shell utilities to build the headers

Fixes #1
This commit is contained in:
Toby Jaffey 2025-12-13 22:20:38 +00:00
parent bee38ce935
commit 1c9e9296be
7 changed files with 24 additions and 6 deletions

View file

@ -3,7 +3,11 @@ PROJECT:=$(shell basename ${PWD})
SRCS=${PROJECT}.c ${TOPDIR}/apps/common/crt0.S ${TOPDIR}/uvm32/uvm32.c
CFLAGS=-DUVM32_MEMORY_SIZE=8192 -DCUSTOM_STDLIB_H=\"uvm32_target.h\" -I../../uvm32
all:
xxd -n mandel -i ${TOPDIR}/precompiled/mandel.bin | sed -e "s/unsigned char/const unsigned char/" > mandel.h
@echo "const unsigned char mandel[] = {" > mandel.h
@cat ${TOPDIR}/precompiled/mandel.bin | xxd -i >> mandel.h
@echo "};\nunsigned int mandel_len = " >> mandel.h
@wc -c ${TOPDIR}/precompiled/mandel.bin | awk '{print $$1}' >> mandel.h
@echo ";" >> mandel.h
make all_common
test: test_common
clean: clean_common