CC ?= cc
CFLAGS ?= -O3 -Wall -Wextra -Wpedantic
BASALT ?= ./basalt
export BASALT
BENCH_PYTHON ?= python3

.PHONY: all test bench bench-http bench-web
all: $(BASALT)

$(BASALT): src/basalt.c $(wildcard src/*.h vendor/*/*.c vendor/*/*.h)
	$(CC) $(CFLAGS) -std=c11 src/basalt.c -ldl -o "$@"

test: all
	python3 tests/check.py
	python3 -B tests/systems.py
	python3 -B tests/types.py
	python3 -B tests/vm_loops.py
	python3 -B tests/web.py

bench: all
	python3 benchmarks/measure.py

bench-http: all
	python3 -B benchmarks/measure_http.py

bench-web: all
	$(BENCH_PYTHON) -B benchmarks/measure_web.py

