From 735ed87ded15a2b69e4ae34af199798b8d28e2d5 Mon Sep 17 00:00:00 2001 From: Annika Hannig Date: Fri, 21 Apr 2023 14:04:21 +0200 Subject: [PATCH] make static linux build --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 5bdbed3..43f7527 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,8 @@ ifneq ($(UNAME),$(filter $(UNAME),Darwin FreeBSD Linux)) $(error error: Unkown OS ) endif +LDFLAGS_STATIC=-ldflags="-extldflags '-static'" + all: $(TARGET) @echo "Built $(VERSION) @ $(TARGET)" @@ -46,6 +48,12 @@ linux: freebsd: GO111MODULE=on GOARCH=$(ARCH) GOOS=freebsd go build -o $(PROG)-freebsd-$(ARCH) +linux_static: + CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) \ + go build $(CFLAGS) \ + -a $(LDFLAGS_STATIC) \ + -o $(PROG)-linux-$(ARCH) + build_server: ifeq ($(BUILD_SERVER), '')