NVCC ?= nvcc
NVCCFLAGS ?= -O3 -std=c++17 -arch=sm_120 -allow-unsupported-compiler -Xptxas=-v,-warn-spills -lineinfo -Xcompiler=-Wall,-Wextra,-static-libstdc++,-static-libgcc

.PHONY: all generate cpu-check state-check
all: stage9-des-bitslice-v3

generate:
	python generate.py > generation.log

# Optional local build; no binary is distributed.
stage9-des-bitslice-v3: main.cu generated.cuh fixtures.hpp scan_state.hpp
	$(NVCC) $(NVCCFLAGS) main.cu -o $@ 2> build-v3-ptxas.log

cpu-check: stage9-des-bitslice-v3
	./stage9-des-bitslice-v3 --cpu-selftest

state-tests: state_tests.cpp scan_state.hpp
	g++ -O2 -std=c++17 -Wall -Wextra -Werror state_tests.cpp -o $@

state-check: state-tests
	./state-tests
