1
0
dwelling-files/Makefile

40 lines
970 B
Makefile
Raw Normal View History

2022-06-27 04:38:09 +04:00
TARGET=dwelling-files
SYSDDIR_=${shell pkg-config systemd --variable=systemdsystemunitdir}
SYSDDIR=${SYSDDIR_:/%=%}
DESTDIR:=
PREFIX:=/usr/local
2022-06-27 04:38:09 +04:00
2024-12-11 00:43:55 +04:00
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
2022-06-27 04:38:09 +04:00
2024-12-08 04:14:09 +04:00
${TARGET}: web/*_templ.go
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
endif
2024-12-08 04:14:09 +04:00
$(shell go env GOPATH)/bin/templ generate
2022-06-27 04:38:09 +04:00
run:
bin/${TARGET} -file-handling -path /mnt/data -listen 127.0.0.1:19135
2022-06-27 04:38:09 +04:00
install:
install -Dm 0755 bin/${TARGET} ${DESTDIR}${PREFIX}/bin/${TARGET}
2022-06-27 04:38:09 +04:00
install -Dm 0644 init/systemd/${TARGET}.service ${DESTDIR}/${SYSDDIR}/${TARGET}.service
2022-06-27 04:38:09 +04:00
uninstall:
rm ${DESTDIR}${PREFIX}/bin/${TARGET}
2022-06-27 04:38:09 +04:00
rm ${DESTDIR}/${SYSDDIR}/${TARGET}.service
clean:
rm -f web/*.jade.go
go clean