#!/bin/sh

# Get the project root directory
ROOT_DIR=$(cd "$(dirname "$0")" && pwd)
BUILD_DIR="$ROOT_DIR/build"

echo "--- Cleaning Build Directories ---"

# List of directories to remove
targets="debug release test"

for type in $targets; do
    target_path="$BUILD_DIR/$type"
    
    if [ -d "$target_path" ]; then
        echo "Removing $target_path..."
        rm -rf "$target_path"
    else
        echo "Skipping $type (already clean)."
    fi
done

# Optional: Clean up the copied compile_commands.json in root
if [ -f "$ROOT_DIR/compile_commands.json" ]; then
    echo "Removing root compile_commands.json..."
    rm "$ROOT_DIR/compile_commands.json"
fi

echo "Done."
