# SpeedBird-EXP (Windows, drop-in VARA.exe), built and checked on Linux. Paths are relative to the repository root.
#   make test | make loopback (CPU heavy) | make dist [VERSION=0.1.0+20261123.120000] [OUT=dir]
ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../..)
PY ?= $(if $(wildcard $(ROOT)/.venv/bin/python),$(ROOT)/.venv/bin/python,python3)
ENV = PYTHONPATH=$(ROOT)/code/express-win:$(ROOT)/code/libs/speedbird/src:$(ROOT)/code/libs/speedbird-python/src
.PHONY: test loopback dist
test:
	cd $(ROOT) && $(ENV) $(PY) -m pytest -q code/express-win/checks/test_units.py code/express-win/checks/test_ptt.py code/express-win/checks/test_btports.py code/express-win/checks/test_advanced.py code/express-win/checks/test_audio_reopen.py code/express-win/checks/test_terminal.py code/express-win/checks/test_wizard_mesh.py code/express-win/checks/test_survey.py code/express-win/checks/test_hud.py code/express-win/checks/test_terminal_station.py code/express-win/checks/test_tuner.py
loopback:
	cd $(ROOT) && $(ENV) $(PY) code/express-win/checks/test_loopback.py
dist:
	cd $(ROOT) && $(PY) code/express-win/build_express.py $(if $(OUT),--out $(OUT)) $(if $(VERSION),--version $(VERSION))
