.PHONY: clean all version whl install pytest tests \
	test_api test_hybrid test_lockstep test_outer test_spawn

all: tests

######## Setup ########
VERSION = 0.1.2
version: clean
	echo "__version__ = '${VERSION}'" > python/pcg64_cross/__version__.py
	sed --in-place "s/^version = .*/version = \"${VERSION}\"/" Cargo.toml

######## Installation ########
whl: clean version
	maturin build --release --sdist

install: whl
	pip install . --group test

######## Tests ########
test_api: install
	python3 tests/test_api.py

test_hybrid: install
	python3 tests/test_hybrid.py

test_lockstep: install
	python3 tests/test_lockstep.py

test_outer: install
	python3 tests/test_outer.py

test_spawn: install
	python3 tests/test_spawn.py

pytest: install
	pytest

# Keeping lockstep for performance
tests: pytest test_lockstep

######## Publish ########

pypi: whl install tests
	twine upload target/wheels/pcg64_cross-${VERSION}.tar.gz
	twine upload target/wheels/pcg64_cross-${VERSION}-cp*-abi3-manylinux_*_x86_64.whl

clean:
	rm -rf target/wheels/*
	rm -rf python/pcg64_cross/*.so

