From bd0f822e5bd35835cafbdea5f57d6a66d46cac55 Mon Sep 17 00:00:00 2001 From: chen Date: Sun, 10 Nov 2024 20:12:00 +0800 Subject: [PATCH] A Makefile: add server-go makefile --- server-go/cloud-clip/Makefile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 server-go/cloud-clip/Makefile diff --git a/server-go/cloud-clip/Makefile b/server-go/cloud-clip/Makefile new file mode 100644 index 0000000..6e2c1fe --- /dev/null +++ b/server-go/cloud-clip/Makefile @@ -0,0 +1,35 @@ + + + +# test -z "`git diff-index --name-only HEAD --`" || VN="$$VN-d"; +define GIT_VER + VN=`git describe --tags --match "go-[0-9]*" | sed -e 's/-[0-9]-/-/'`; + test -z "`git diff-index --name-only HEAD -- *.go`" || VN="$$VN-d"; + echo $$VN +endef + +# VER=$(shell git describe --tags --match "go-[0-9]*" | sed -e 's/-[0-9]-/-/') +# VER=$(shell ${GIT_VER}) +VER=$(shell \ + VN=`git describe --tags --match "go-[0-9]*" | sed -e 's/-[0-9]-/-/'`; \ + test -z "`git diff-index --name-only HEAD -- *.go`" || VN="$$VN-d"; \ + echo $$VN \ +) + +## tag=`git tag --points-at HEAD --sort=-refname | head -n1` +## git describe --tags --dirty --always --match $tag + +VER=$(shell \ + VN=`git tag --points-at HEAD --sort=-refname | head -n1`; \ + test -z "`git diff-index --name-only HEAD -- *.go`" || VN="$$VN-d"; \ + echo $$VN \ +) + +FLAGS= -ldflags='-s -w -X main.server_version=${VER}' + + +cloud-clip: *.go Makefile + go build -o $@ $(FLAGS) + +clean: + rm -f cloud-clip