Simplify Makefile a bit and have it produce smaller binaries

This commit is contained in:
2018-05-07 07:00:15 +01:00
parent 75542c3748
commit 232ba27c86

View File

@@ -1,10 +1,6 @@
NAME = casecmp NAME = casecmp
BINARY = bin/${NAME} BINARY = bin/${NAME}
VERSION ?= $(shell cat VERSION) VERSION ?= $(shell cat VERSION)
COMMIT = $(shell git show --format="%h" --no-patch)
DATE = $(shell date +%Y-%m-%dT%T%z)
SOURCES = $(shell find . \ SOURCES = $(shell find . \
-name '*.go' \ -name '*.go' \
-o -name 'LICENSE' \ -o -name 'LICENSE' \
@@ -29,10 +25,11 @@ RELEASE_ASSETS = \
LICENSE LICENSE
$(BINARY): $(SOURCES) $(BINARY): $(SOURCES)
go build -o ${BINARY} -ldflags \ "\ CGO_ENABLED=0 go build -a -o ${BINARY} -ldflags \ "\
-s -w \
-X main.version=${VERSION} \ -X main.version=${VERSION} \
-X main.commit=${COMMIT} \ -X main.commit=$(shell git show --format="%h" --no-patch) \
-X main.date=${DATE}" -X main.date=$(shell date +%Y-%m-%dT%T%z)"
.PHONY: build .PHONY: build
build: $(BINARY) build: $(BINARY)