# Copyright 2026 Stephen Bouche
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Two steps, as for the other Lua packages: luapack.py writes the script
# container with the Lua flag set, and vesc_tool embeds it through pkgLua.
# VE points at the vesc_express checkout the packer comes from.

VESC_TOOL ?= vesc_tool
VE ?= $(firstword $(wildcard ../../vesc_express ../../express))
LUAPACK = $(VE)/tools/luapack.py

all: ant_bms_lua.vescpkg

ant_bms_lua.vescpkg: ant_bms.luapkg README.md pkgdesc.qml
	$(VESC_TOOL) --buildPkgFromDesc pkgdesc.qml --testPkgDesc 'vesc:test'

ant_bms.luapkg: ant_bms.lua
	python3 $(LUAPACK) ant_bms.lua -o $@

test:
	./test/run.sh

clean:
	rm -f ant_bms_lua.vescpkg ant_bms.luapkg

.PHONY: all clean test
