#!/bin/bash
set -e

BUILD_DIR="build/jit_fixed"

echo "--- Configuring JIT debug build with C11 standard in $BUILD_DIR ---"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"

CC=clang CXX=clang++ \
CFLAGS="-std=c11 -g -O1 -fno-omit-frame-pointer -fsanitize=address,undefined" \
LDFLAGS="-fsanitize=address,undefined" \
../../configure --with-pydebug --enable-experimental-jit --with-address-sanitizer --with-undefined-behavior-sanitizer

make -j$(nproc)

echo "--- JIT C11 debug build complete. Executable: $PWD/python ---"
cd ../..
