#!/bin/sh
. ./build.cfg
CPWD=`pwd`
CPACKED="$CPWD/packed.bin"

if test ! -x "$CPACKED"; then
	make -f Makefile clean
	make -f Makefile EXEEXT=".bin" BINPATH="$CPWD/" "$CPACKED"
fi

cd "$CPWD/data" && $CPACKED -c -p "$CPWD/exe/$CPACKFILE" *

if test ! -e "$CPWD/$CPACKFILE"; then
	ln -s "$CPWD/exe/$CPACKFILE" "$CPWD/$CPACKFILE"
fi
