Updated Makefile. Fixed DESTDIR, PREFIX and VERSION vars. FLAGS -> GOFLAGS. Added -linkmode and -extldflags. Also perform a build when invoke a run target if there are changes.
This commit is contained in:
parent
f265494ea8
commit
2facf9662a
14
Makefile
14
Makefile
@ -3,18 +3,18 @@ TARGET:=dwelling-radio
|
||||
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 \
|
||||
|
Loading…
Reference in New Issue
Block a user