#!/bin/sh

. ./cross_defs.dj

make CC=$TARGET-gcc AR=$TARGET-ar RANLIB=$TARGET-ranlib -f Makefile.dj $* || exit 1
# dedicated server
make -f Makefile.dj clean
make CC=$TARGET-gcc -f Makefile.dj DEDICATED_ONLY=1 $* || exit 1

# game code
rm -f game/*.o
make CC=$TARGET-gcc CXX=$TARGET-g++ -C game -f Makefile.dj $* || exit 1

rm -f 2015/*.o
make CC=$TARGET-gcc CXX=$TARGET-g++ -C 2015 -f Makefile.dj $*    || exit 1

# refresh drivers
rm -f game/*.o dos/*.o gas/*.o
make CC=$TARGET-gcc -C ref_soft -f Makefile.dj $*      || exit 1

rm -f game/*.o dos/*.o gas/*.o qcommon/*.o
make CC=$TARGET-gcc -C ref_gl -f Makefile.dj $*        || exit 1

# strip the exes
$TARGET-strip sin*.exe
