2022-06-27 04:38:09 +04:00
|
|
|
TARGET=dwelling-files
|
|
|
|
|
|
|
|
SYSDDIR_=${shell pkg-config systemd --variable=systemdsystemunitdir}
|
|
|
|
SYSDDIR=${SYSDDIR_:/%=%}
|
|
|
|
|
2023-06-12 23:32:54 +04:00
|
|
|
DESTDIR:=
|
|
|
|
PREFIX:=/usr/local
|
2022-06-27 04:38:09 +04:00
|
|
|
|
2024-12-08 04:14:09 +04:00
|
|
|
VERSION=24.49.0
|
2023-06-12 23:32:54 +04:00
|
|
|
|
2023-09-20 04:06:54 +04:00
|
|
|
FLAGS=-buildmode=pie -modcacherw -mod=readonly -trimpath
|
2023-06-12 23:32:54 +04:00
|
|
|
LDFLAGS=-ldflags "-s -w -X main.version=${VERSION}" -tags osusergo,netgo
|
|
|
|
|
2023-09-20 04:06:54 +04:00
|
|
|
.PHONY: run install uninstall clean
|
2022-06-27 04:38:09 +04:00
|
|
|
|
2024-12-08 04:14:09 +04:00
|
|
|
${TARGET}: web/*_templ.go
|
2023-09-20 04:06:54 +04:00
|
|
|
go build -o bin/$@ ${LDFLAGS} ${FLAGS} cmd/$@/main.go
|
2022-06-27 04:38:09 +04:00
|
|
|
|
2024-12-08 04:14:09 +04:00
|
|
|
web/*_templ.go: web/*.templ
|
|
|
|
ifeq (,$(wildcard $(shell go env GOPATH)/bin/templ))
|
|
|
|
go install github.com/a-h/templ/cmd/templ@latest
|
2023-09-20 04:06:54 +04:00
|
|
|
endif
|
2024-12-08 04:14:09 +04:00
|
|
|
$(shell go env GOPATH)/bin/templ generate
|
2023-06-12 23:32:54 +04:00
|
|
|
|
2022-06-27 04:38:09 +04:00
|
|
|
run:
|
2022-12-17 22:52:15 +04:00
|
|
|
bin/${TARGET} -file-handling -path /mnt/data -listen 127.0.0.1:19135
|
2022-06-27 04:38:09 +04:00
|
|
|
|
|
|
|
install:
|
2023-06-12 23:32:54 +04:00
|
|
|
install -Dm 0755 bin/${TARGET} ${DESTDIR}${PREFIX}/bin/${TARGET}
|
2022-06-27 04:38:09 +04:00
|
|
|
|
2023-06-12 23:32:54 +04:00
|
|
|
install -Dm 0644 init/systemd/${TARGET}.service ${DESTDIR}/${SYSDDIR}/${TARGET}.service
|
2022-06-27 04:38:09 +04:00
|
|
|
|
|
|
|
uninstall:
|
2023-06-12 23:32:54 +04:00
|
|
|
rm ${DESTDIR}${PREFIX}/bin/${TARGET}
|
2022-06-27 04:38:09 +04:00
|
|
|
|
2023-06-12 23:32:54 +04:00
|
|
|
rm ${DESTDIR}/${SYSDDIR}/${TARGET}.service
|
2023-09-20 04:06:54 +04:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f web/*.jade.go
|
|
|
|
go clean
|