BINARY  := streamdeck-lets-go
MODULE  := streamdeck-lets-go
CMDDIR  := cmd/streamdeck-lets-go
PKGARCH := packaging

.PHONY: all build test vet fmt clean install

all: build

build:
	CGO_ENABLED=1 go build -ldflags "-s -w" -o $(BINARY) ./$(CMDDIR)

test:
	go test ./...

vet:
	go vet ./...

fmt:
	gofmt -l .

clean:
	rm -f $(BINARY)

install: build
	install -Dm755 $(BINARY) /usr/local/bin/$(BINARY)
	install -Dm644 $(PKGARCH)/streamdeck-lets-go.service /usr/lib/systemd/user/streamdeck-lets-go.service
	install -Dm644 $(PKGARCH)/90-streamdeck.rules /usr/lib/udev/rules.d/90-streamdeck.rules

uninstall:
	rm -f /usr/local/bin/$(BINARY)
	rm -f /usr/lib/systemd/user/streamdeck-lets-go.service
	rm -f /usr/lib/udev/rules.d/90-streamdeck.rules
