cenotaph/compile.sh
Trevor Boddy 073f96c9b1 pickups, native build, enemy/bullet/stage overhaul
- Add pickup system (bomb, spread, rapid, shield) with new sprites
- Replace Docker build with native SGDK compile via m68k-elf-gcc
- Rework enemy spawning, homing math, boss HP/number globals
- Expand chrome: score popups, minimap, pause/game over improvements
- Overhaul stage generation with threat-point system
- Add explosion sprites, shield sprite, powerup sprite
- Add tools/ for sprite downscaling utilities
2026-04-15 08:19:29 -04:00

58 lines
1.9 KiB
Bash
Executable file

#!/bin/bash
set -e
# Native SGDK compile script (no Docker)
# Requires: brew install m68k-elf-gcc, java
GDK=sgdk
BIN=$GDK/bin
LIB=$GDK/lib
INC=$GDK/inc
RES_LIB=$GDK/res
SRC_LIB=$GDK/src
CC=m68k-elf-gcc
OBJCPY=m68k-elf-objcopy
NM=m68k-elf-nm
JAVA=java
RESCOMP="$JAVA -jar $BIN/rescomp.jar"
SIZEBND="$JAVA -jar $BIN/sizebnd.jar"
INCS="-I. -Iinc -Isrc -Ires -Iout -I$INC -I$RES_LIB"
FLAGS="-DSGDK_GCC -m68000 -Wall -Wextra -Wno-shift-negative-value -Wno-main -Wno-unused-parameter -Wno-implicit-function-declaration -fno-builtin -ffunction-sections -fdata-sections -fms-extensions $INCS -B$BIN"
RELEASE_FLAGS="$FLAGS -O3 -fuse-linker-plugin -fno-web -fno-gcse -fomit-frame-pointer -flto -flto=auto -ffat-lto-objects"
# Clean
rm -rf res/resources.rs res/resources.h res/resources.o out/*
mkdir -p out
echo "==> Compiling resources..."
$RESCOMP res/resources.res out/resources.rs -dep out/resources.d
echo "==> Compiling rom_head..."
$CC $FLAGS -c src/boot/rom_head.c -o out/rom_head.o
$OBJCPY -O binary out/rom_head.o out/rom_head.bin
echo "==> Compiling sega.s..."
$CC -x assembler-with-cpp -Wa,--register-prefix-optional,--bitwise-or $RELEASE_FLAGS -c src/boot/sega.s -o out/sega.o
echo "==> Compiling resources assembly..."
$CC -x assembler-with-cpp -Wa,--register-prefix-optional,--bitwise-or $RELEASE_FLAGS -c out/resources.rs -o out/resources.o
echo "==> Compiling main.c..."
$CC $RELEASE_FLAGS -c src/main.c -o out/main.o
echo "==> Linking..."
$CC -m68000 -B$BIN -n -T $GDK/md.ld -nostdlib out/sega.o out/resources.o out/main.o $LIB/libmd.a -lgcc -o out/rom.out -Wl,--gc-sections -flto -flto=auto -ffat-lto-objects
echo "==> Extracting ROM..."
$OBJCPY -O binary out/rom.out out/rom.bin
echo "==> Generating symbol table..."
$NM -n -l out/rom.out > out/symbol.txt
echo "==> Padding ROM..."
$SIZEBND out/rom.bin -sizealign 131072 -checksum
echo "==> Done! out/rom.bin"
ls -la out/rom.bin