#!/bin/bash

set -e

SCRIPTDIR="$( dirname -- "$0"; )";
SCONS_EP=${SCRIPTDIR}/lib/scons/scripts/scons.py

if [[ -d .git ]]; then
    git submodule update --init
else # Not in a git repo
    echo Not in a git repo, please clone with git clone --recursive
    # Return error code 1 to indicate failure
    exit 1
fi

SCONS_DEFAULT_FLAGS="-Q --warn=target-not-built"
python3 ${SCONS_EP} ${SCONS_DEFAULT_FLAGS} "$@"