Files

38 lines
776 B
Bash
Executable File

#!/bin/bash
# Amiga C cross-compiler wrapper using vc (vbcc's gcc-like frontend)
# Usage: ./amigacc source.c [output]
set -eu
VBCC=~/Projects/parked/vbcc
NDK=${AMIGA_NDK:-/mnt/nfs/biggie/Storage/Retro/Amiga/NDK32/Include_H}
export VBCC
export PATH=$VBCC/bin:$PATH
SRC=${1:?Usage: $0 source.c [output]}
if [ ! -f "$SRC" ]; then
echo "error: source file not found: $SRC" >&2
exit 1
fi
if [ ! -x "$VBCC/bin/vc" ]; then
echo "error: vbcc not found at $VBCC/bin/vc" >&2
exit 1
fi
if [ ! -d "$NDK" ]; then
echo "error: Amiga NDK headers not found at $NDK (override with AMIGA_NDK)" >&2
exit 1
fi
BASE=${SRC%.c}
OUT=${2:-$BASE}
echo "Compiling $SRC -> $OUT"
$VBCC/bin/vc +aos68k \
-O2 \
-I$NDK \
"$SRC" -lamiga -o "$OUT"
echo "Done: $OUT"