PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
CONFDIR ?= $(HOME)/.config/led-controller

.PHONY: build install install-service clean

build:
	go build -o led-controller .

install: build
	install -Dm755 led-controller $(DESTDIR)$(BINDIR)/led-controller
	install -Dm644 config.example.toml $(DESTDIR)$(CONFDIR)/config.toml

install-service:
	install -Dm644 led-controller.service $(HOME)/.config/systemd/user/led-controller.service
	systemctl --user daemon-reload
	systemctl --user enable led-controller.service
	@echo "Start with: systemctl --user start led-controller"

clean:
	rm -f led-controller
