ifeq ($(shell uname -s),Darwin)
  SO_SUFFIX = dylib
else
  SO_SUFFIX = so
endif

setup: venv src/helpers.$(SO_SUFFIX)
	env PATH=$(PWD)/venv/bin:$(PATH) pip install --upgrade pip
	env PATH=$(PWD)/venv/bin:$(PATH) pip install tensorflow
	env PATH=$(PWD)/venv/bin:$(PATH) pip install pysdl2

venv:
	virtualenv venv

src/helpers.$(SO_SUFFIX): src/helpers.rs
	rustc --crate-name helpers --edition=2018 src/helpers.rs -o src/helpers.$(SO_SUFFIX) --crate-type cdylib --emit=link -C embed-bitcode=no $$(sdl2-config --libs)