build-rpi:
	cross build --target arm-unknown-linux-gnueabihf

emgauwa-controller.json: controller.pkl
	pkl eval -f json -o $@ $<

config:
	$(MAKE) emgauwa-controller.json

clean:
	rm -f emgauwa-controller.json
	rm -f emgauwa-controller.sqlite

emgauwa-controller_%:
	$(TOOL) build --target $* --release
	mkdir -p out/releases
	cp target/$*/release/emgauwa-controller out/releases/emgauwa-controller_$*

releases:
	$(MAKE) TOOL=cross emgauwa-controller_arm-unknown-linux-gnueabihf
	$(MAKE) TOOL=cargo emgauwa-controller_x86_64-unknown-linux-gnu
	$(MAKE) TOOL=cross emgauwa-controller_x86_64-unknown-linux-musl