GUIX_PACKAGES = emacs-minimal

.PHONY: check bytecompile test guix-bytecompile guix-check guix-test clean act podman

EMACS ?= emacs
ACT ?= ~/go/bin/act
PODMAN_SOCK := unix:///tmp/podman-run-$(shell id -u)/podman/podman.sock

check: bytecompile test

bytecompile:
	$(EMACS) --batch -f batch-byte-compile config.el 2>&1

test:
	$(EMACS) --batch -l config.el -l test-config.el -f ert-run-tests-batch-and-exit

guix-bytecompile:
	guix shell --container $(GUIX_PACKAGES) -- emacs --batch -f batch-byte-compile config.el 2>&1

guix-check:
	guix shell $(GUIX_PACKAGES) -- emacs --batch -f batch-byte-compile config.el 2>&1

clean:
	rm -f config.elc

act:
	DOCKER_HOST=$(PODMAN_SOCK) $(ACT) --pull=false --verbose \
		-W .forgejo/workflows

podman:
	mkdir -p /tmp/podman-run-$(shell id -u)/podman
	DOCKER_HOST=$(PODMAN_SOCK) podman system service --time=0 &
