From dc87f793ce7cb472887f85be5ac0d84451ff1c56 Mon Sep 17 00:00:00 2001 From: a-wing <1@233.email> Date: Tue, 3 Jan 2023 03:22:34 +0800 Subject: [PATCH] fix make commit --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ac5ec3f..4828488 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,15 @@ ARCH= NAME=ncp BINDIR=bin PROFIX= +COMMIT=$(shell git rev-parse HEAD) VERSION=$(shell git describe --tags || echo "unknown version") -BUILDTIME=$(shell date) -GOBUILD=CGO_ENABLED=0 go build -trimpath \ - -ldflags '-X "sb.im/ncp/constant.Version=$(VERSION)" \ - -X "sb.im/ncp/constant.BuildTime=$(BUILDTIME)"' +BUILDTIME=$(shell date +%FT%T%z) +LD_FLAGS='\ + -X "sb.im/ncp/constant.Commit=$(COMMIT)" \ + -X "sb.im/ncp/constant.Version=$(VERSION)" \ + -X "sb.im/ncp/constant.BuildTime=$(BUILDTIME)" \ + ' +GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags $(LD_FLAGS) PLATFORM_LIST = \ darwin-amd64 \