Skip to content

Commit

Permalink
A Makefile: add server-go makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
yurenchen000 committed Nov 10, 2024
1 parent 83cc624 commit bd0f822
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions server-go/cloud-clip/Makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bd0f822

Please sign in to comment.