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
20
Makefile
20
Makefile
@ -1,20 +1,20 @@
|
|||||||
TARGET:=dwelling-radio
|
TARGET := dwelling-radio
|
||||||
|
|
||||||
SYSDDIR_:=${shell pkg-config systemd --variable=systemdsystemunitdir}
|
SYSDDIR_ := ${shell pkg-config systemd --variable=systemdsystemunitdir}
|
||||||
SYSDDIR:=${SYSDDIR_:/%=%}
|
SYSDDIR := ${SYSDDIR_:/%=%}
|
||||||
|
|
||||||
DESTDIR:=
|
DESTDIR ?=
|
||||||
PREFIX:=/usr/local
|
PREFIX ?= /usr/local
|
||||||
|
|
||||||
VERSION=24.20.0
|
VERSION ?= 24.20.0
|
||||||
|
|
||||||
FLAGS:=-buildmode=pie -modcacherw -mod=readonly -trimpath
|
GOFLAGS := -buildmode=pie -modcacherw -mod=readonly -trimpath
|
||||||
LDFLAGS:= -ldflags "-s -w -X main.version=${VERSION}" -tags osusergo,netgo
|
LDFLAGS := -ldflags "-linkmode=external -extldflags \"${LDFLAGS}\" -s -w -X main.version=${VERSION}" -tags osusergo,netgo
|
||||||
|
|
||||||
.PHONY: run install uninstall clean
|
.PHONY: run install uninstall clean
|
||||||
|
|
||||||
${TARGET}: web/*_templ.go
|
${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
|
web/*_templ.go: web/*.templ
|
||||||
ifeq (,$(wildcard $(shell go env GOPATH)/bin/templ))
|
ifeq (,$(wildcard $(shell go env GOPATH)/bin/templ))
|
||||||
@ -22,7 +22,7 @@ ifeq (,$(wildcard $(shell go env GOPATH)/bin/templ))
|
|||||||
endif
|
endif
|
||||||
$(shell go env GOPATH)/bin/templ generate
|
$(shell go env GOPATH)/bin/templ generate
|
||||||
|
|
||||||
run:
|
run: | ${TARGET}
|
||||||
bin/dwelling-radio -listen 127.0.0.1:18322 \
|
bin/dwelling-radio -listen 127.0.0.1:18322 \
|
||||||
-playlist /mnt/data/appdata/radio/playlists/all-rand \
|
-playlist /mnt/data/appdata/radio/playlists/all-rand \
|
||||||
-fallback-song /mnt/data/appdata/radio/fallback.ogg \
|
-fallback-song /mnt/data/appdata/radio/fallback.ogg \
|
||||||
|
Loading…
Reference in New Issue
Block a user