build static binaries
This commit is contained in:
parent
70d68a491d
commit
8834728285
1 changed files with 2 additions and 6 deletions
8
Makefile
8
Makefile
|
@ -17,11 +17,7 @@ WINDOWS_ARCHS ?= windows/amd64
|
||||||
GO_FMT_FILES := $(shell find . -type f -name "*.go" ! -name "generated.*")
|
GO_FMT_FILES := $(shell find . -type f -name "*.go" ! -name "generated.*")
|
||||||
GOFILES := $(shell find . -type f -name "*.go" -o -name "go.mod" ! -name "generated.*")
|
GOFILES := $(shell find . -type f -name "*.go" -o -name "go.mod" ! -name "generated.*")
|
||||||
|
|
||||||
ifneq ($(shell uname), Darwin)
|
EXTLDFLAGS = -extldflags "-static" $(null)
|
||||||
EXTLDFLAGS = -extldflags "-static" $(null)
|
|
||||||
else
|
|
||||||
EXTLDFLAGS =
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(HAS_GO), GO)
|
ifeq ($(HAS_GO), GO)
|
||||||
GOPATH ?= $(shell $(GO) env GOPATH)
|
GOPATH ?= $(shell $(GO) env GOPATH)
|
||||||
|
@ -107,7 +103,7 @@ install: $(GOFILES)
|
||||||
build: go-check $(EXECUTABLE)
|
build: go-check $(EXECUTABLE)
|
||||||
|
|
||||||
$(EXECUTABLE): $(GOFILES)
|
$(EXECUTABLE): $(GOFILES)
|
||||||
$(GO) build -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@
|
$(GO) build -v -tags 'netgo osusergo $(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o $@
|
||||||
|
|
||||||
.PHONY: deps-backend
|
.PHONY: deps-backend
|
||||||
deps-backend:
|
deps-backend:
|
||||||
|
|
Loading…
Reference in a new issue