40 lines
957 B
Makefile
Executable File
40 lines
957 B
Makefile
Executable File
TARGET=dwelling-files
|
|
|
|
SYSDDIR_=${shell pkg-config systemd --variable=systemdsystemunitdir}
|
|
SYSDDIR=${SYSDDIR_:/%=%}
|
|
|
|
DESTDIR:=
|
|
PREFIX:=/usr/local
|
|
|
|
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
|
|
|
|
${TARGET}: web/*.jade.go
|
|
go build -o bin/$@ ${LDFLAGS} ${FLAGS} cmd/$@/main.go
|
|
|
|
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
|
|
|
|
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
|