make static linux build

This commit is contained in:
Annika Hannig 2023-04-21 14:04:21 +02:00
parent cbeb79cbd4
commit 735ed87ded
1 changed files with 8 additions and 0 deletions

View File

@ -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), '')