1
0
Fork 0
dwelling-files/Makefile

40 lines
957 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
2023-08-13 04:06:34 +04:00
VERSION=23.32.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
${TARGET}: web/*.jade.go
go build -o bin/$@ ${LDFLAGS} ${FLAGS} cmd/$@/main.go
2022-06-27 04:38:09 +04:00
web/*.jade.go: web/templates/*.jade
ifeq (,$(wildcard $(shell go env GOPATH)/bin/jade))
go install github.com/Joker/jade/cmd/jade@latest
endif
go generate web/web.go
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