diff --git a/Makefile b/Makefile index c0bc628..e81e414 100644 --- a/Makefile +++ b/Makefile @@ -13,14 +13,22 @@ BINDIR ?= $(PREFIX)/bin BINARY = $(addprefix bin/,finch-daemon) +ifndef GODEBUG + EXTRA_LDFLAGS += -s -w +endif + .PHONY: build build: $(eval PACKAGE := github.com/runfinch/finch-daemon) $(eval VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.modified' --always --tags)) $(eval GITCOMMIT := $(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)) - $(eval LDFLAGS := "-X $(PACKAGE)/version.Version=$(VERSION) -X $(PACKAGE)/version.GitCommit=$(GITCOMMIT)") + $(eval LDFLAGS := "-X $(PACKAGE)/version.Version=$(VERSION) -X $(PACKAGE)/version.GitCommit=$(GITCOMMIT) $(EXTRA_LDFLAGS)") GOOS=linux go build -ldflags $(LDFLAGS) -v -o $(BINARY) $(PACKAGE)/cmd/finch-daemon +clean: + @rm -f $(BINARIES) + @rm -rf $(BIN) + .PHONY: linux linux: ifneq ($(shell uname), Linux)