CXX ?= g++
NVCC ?= nvcc
CXXFLAGS ?= -O3 -std=c++17
NVCCFLAGS ?= -O3 -std=c++17

# Keep the original default build compatible; use `make bench` for the current CLI.
.PHONY: all legacy bench research show tools test test-gpu clean help
all: legacy
legacy: slime slime-cuda
slime: slime.cpp
	$(CXX) $(CXXFLAGS) $< -o $@
slime-cuda: slime.cu
	$(NVCC) $(NVCCFLAGS) $< -o $@
bench:
	$(MAKE) -C bench
research:
	$(MAKE) -C research
show:
	$(MAKE) -C show
tools:
	$(MAKE) -C tools
test:
	$(MAKE) -C bench test
test-gpu:
	$(MAKE) -C bench test-gpu
clean:
	rm -f slime slime-cuda sliming
	$(MAKE) -C bench clean
	$(MAKE) -C research clean
	$(MAKE) -C codex clean
	$(MAKE) -C show clean
	$(MAKE) -C tools clean
help:
	@echo 'make bench        Build the current CUDA benchmark CLI'
	@echo 'make test         Run CLI host-side checks (nvcc required, GPU not required)'
	@echo 'make test-gpu     Run CLI GPU integration checks'
	@echo 'make legacy       Build the original CPU/CUDA brute-force programs (default)'
	@echo 'make research     Build research prototypes'
	@echo 'make show         Build teaching examples'
	@echo 'make tools        Build the single-chunk checker'
	@echo 'make clean        Remove compiled outputs; retain reports and datasets'
