BUILD:="disk"
PROJECT_NAME:="cake"
TARGET:="target/sh-elf/release/dccake.elf"

run: build
    flycast cake.cdi

logo:
    mkdir -p build
    convert assets/cake.png -resize 320x90 build/cakes.png
    convert build/cakes.png +dither -colors 127 build/cakec.png

build: logo
    kos-cargo build --release
    sh-elf-objcopy -R .stack -O binary {{TARGET}} build/output.bin
    mkdir -p {{BUILD}}
    mkdir -p build
    $KOS_BASE/utils/scramble/scramble build/output.bin {{BUILD}}/1ST_READ.bin
    rm {{BUILD}}/IP.BIN || true
    makeip ip.txt -l build/cakec.png {{BUILD}}/IP.BIN
    mkisofs -C 0,11702 -V {{PROJECT_NAME}} -G {{BUILD}}/IP.BIN -r -J -l -o build/{{PROJECT_NAME}}.iso {{BUILD}}
    cdi4dc build/{{PROJECT_NAME}}.iso {{PROJECT_NAME}}.cdi
