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

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"

CXX="${CXX:-g++}"
OUT="${OUT:-lchm_clock_counter.exe}"

CXXFLAGS=(
  -std=c++17
  -O2
  -Wall
  -Wextra
  -pedantic
)

SOURCES=(
  lchm_clock_counter.cpp
)

LDFLAGS=(
  -ldl
)

"$CXX" "${CXXFLAGS[@]}" "${SOURCES[@]}" "${LDFLAGS[@]}" -o "$OUT"

echo "Built $OUT"
