File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -13,24 +13,23 @@ BINDIR ?= $(PREFIX)/bin
1313
1414BINARY = $(addprefix bin/,finch-daemon)
1515
16- ifndef GODEBUG
17- EXTRA_LDFLAGS += -s -w
16+ PACKAGE := github.com/runfinch/finch-daemon
17+ VERSION := $(shell git describe --match 'v[0-9]* ' --dirty='.modified' --always --tags)
18+ GITCOMMIT := $(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
19+
20+ LDFLAGS := -X $(PACKAGE ) /version.Version=$(VERSION ) -X $(PACKAGE ) /version.GitCommit=$(GITCOMMIT )
21+
22+ ifeq ($(STATIC ) ,)
23+ GO_BUILDTAGS := osusergo netgo
24+ LDFLAGS += -extldflags '-static'
25+ $(info Building Static Binary)
26+ else
27+ $(info Building Dynamic Binary)
1828endif
1929
2030.PHONY : build
2131build :
22- $(eval PACKAGE := github.com/runfinch/finch-daemon)
23- $(eval VERSION ?= $(shell git describe --match 'v[0-9]* ' --dirty='.modified' --always --tags) )
24- $(eval GITCOMMIT := $(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi) )
25- ifneq ($(STATIC ) ,)
26- $(eval GO_BUILDTAGS := osusergo netgo)
27- $(eval LDFLAGS := "-X $(PACKAGE)/version.Version=$(VERSION) -X $(PACKAGE)/version.GitCommit=$(GITCOMMIT) -extldflags '-static'")
28- @echo "Building Static Binary"
29- else
30- @echo "Building Dynamic Binary"
31- $(eval LDFLAGS := "-X $(PACKAGE)/version.Version=$(VERSION) -X $(PACKAGE)/version.GitCommit=$(GITCOMMIT)")
32- endif
33- GOOS=linux go build $(if $(GO_BUILDTAGS), -tags "$(GO_BUILDTAGS)") -ldflags $(LDFLAGS) $(if $(STATIC), ) -v -o $(BINARY) $(PACKAGE)/cmd/finch-daemon
32+ GOOS=linux go build $(if $(GO_BUILDTAGS ) , -tags "$(GO_BUILDTAGS ) ") -ldflags " $( LDFLAGS) " -v -o $(BINARY ) $(PACKAGE ) /cmd/finch-daemon
3433
3534clean :
3635 @rm -f $(BINARIES )
You can’t perform that action at this time.
0 commit comments