TARGET=dwelling-files SYSDDIR_=${shell pkg-config systemd --variable=systemdsystemunitdir} SYSDDIR=${SYSDDIR_:/%=%} DESTDIR:= PREFIX:=/usr/local VERSION=24.50.0 FLAGS=-buildmode=pie -modcacherw -mod=readonly -trimpath LDFLAGS=-ldflags "-s -w -X main.version=${VERSION}" -tags osusergo,netgo .PHONY: run install uninstall clean ${TARGET}: web/*_templ.go go build -o bin/$@ ${LDFLAGS} ${FLAGS} cmd/$@/main.go web/*_templ.go: web/*.templ ifeq (,$(wildcard $(shell go env GOPATH)/bin/templ)) go install github.com/a-h/templ/cmd/templ@latest endif $(shell go env GOPATH)/bin/templ generate run: bin/${TARGET} -file-handling -path /mnt/data -listen 127.0.0.1:19135 install: install -Dm 0755 bin/${TARGET} ${DESTDIR}${PREFIX}/bin/${TARGET} install -Dm 0644 init/systemd/${TARGET}.service ${DESTDIR}/${SYSDDIR}/${TARGET}.service uninstall: rm ${DESTDIR}${PREFIX}/bin/${TARGET} rm ${DESTDIR}/${SYSDDIR}/${TARGET}.service clean: rm -f web/*.jade.go go clean