diff --git a/Makefile b/Makefile index 3571bcd..354f334 100755 --- a/Makefile +++ b/Makefile @@ -1,20 +1,20 @@ -TARGET:=dwelling-radio +TARGET := dwelling-radio -SYSDDIR_:=${shell pkg-config systemd --variable=systemdsystemunitdir} -SYSDDIR:=${SYSDDIR_:/%=%} +SYSDDIR_ := ${shell pkg-config systemd --variable=systemdsystemunitdir} +SYSDDIR := ${SYSDDIR_:/%=%} -DESTDIR:= -PREFIX:=/usr/local +DESTDIR ?= +PREFIX ?= /usr/local -VERSION=24.20.0 +VERSION ?= 24.20.0 -FLAGS:=-buildmode=pie -modcacherw -mod=readonly -trimpath -LDFLAGS:= -ldflags "-s -w -X main.version=${VERSION}" -tags osusergo,netgo +GOFLAGS := -buildmode=pie -modcacherw -mod=readonly -trimpath +LDFLAGS := -ldflags "-linkmode=external -extldflags \"${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 + go build -o bin/$@ ${LDFLAGS} ${GOFLAGS} cmd/$@/main.go web/*_templ.go: web/*.templ ifeq (,$(wildcard $(shell go env GOPATH)/bin/templ)) @@ -22,7 +22,7 @@ ifeq (,$(wildcard $(shell go env GOPATH)/bin/templ)) endif $(shell go env GOPATH)/bin/templ generate -run: +run: | ${TARGET} bin/dwelling-radio -listen 127.0.0.1:18322 \ -playlist /mnt/data/appdata/radio/playlists/all-rand \ -fallback-song /mnt/data/appdata/radio/fallback.ogg \