From f59da2a76e29c68d658cf549731316417551da5d Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Fri, 12 Jul 2024 17:09:21 +0400 Subject: [PATCH] Updated Makefile. --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9ecf5c4..926f8c4 100755 --- a/Makefile +++ b/Makefile @@ -2,18 +2,22 @@ TARGET=dwelling-home SYSDDIR_=${shell pkg-config systemd --variable=systemdsystemunitdir} SYSDDIR=${SYSDDIR_:/%=%} -DESTDIR:= -PREFIX:=/usr/local + +DESTDIR?= +PREFIX?=/usr/local VERSION?=24.27.1 -FLAGS:=-buildmode=pie -modcacherw -mod=readonly -trimpath -LDFLAGS=-ldflags "-s -w -X 'git.arav.su/Arav/dwelling-home/internal/version.ver=v${VERSION}'" -tags osusergo,netgo +XVER:=git.arav.su/Arav/dwelling-home/internal/version.ver=v${VERSION} + +GOFLAGS:=-buildmode=pie -trimpath -mod=readonly -modcacherw +GOFLAGS+=-ldflags="-linkmode=external -s -w -X '${XVER}' -extldflags=${LDFLAGS}" +GOFLAGS+=-tags osusergo,netgo .PHONY: run install uninstall clean ${TARGET}: web/*_templ.go - go build -o bin/$@ ${LDFLAGS} ${FLAGS} cmd/$@/main.go + go build ${GOFLAGS} -o bin/$@ cmd/$@/main.go web/*_templ.go: web/*.templ ifeq (,$(wildcard $(shell go env GOPATH)/bin/templ))