#!/usr/bin/env bash
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$ROOT/scripts/env.sh"

GO_BUILD_FLAGS=${GO_BUILD_FLAGS:-"-v"}
if [[ "${QUIET:-0}" == "1" ]]; then
  GO_BUILD_FLAGS=""
fi

mkdir -p "$ROOT/bin"
echo "Building Goondex (Adult Empire-only mode)..."
echo "go build ${GO_BUILD_FLAGS} -o $ROOT/bin/goondex $ROOT/cmd/goondex"
go build ${GO_BUILD_FLAGS} -o "$ROOT/bin/goondex" "$ROOT/cmd/goondex"
echo "Built: $ROOT/bin/goondex"
