File tree Expand file tree Collapse file tree 3 files changed +19
-7
lines changed Expand file tree Collapse file tree 3 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 11.DEFAULT_GOAL := binary
22
3- GO := go
3+ GO ?= go
4+
5+ PACKAGE := github.com/lima-vm/sshocker
6+
7+ VERSION =$(shell git describe --match 'v[0-9]* ' --dirty='.m' --always --tags)
8+ VERSION_TRIMMED := $(VERSION:v%=% )
9+
10+ GO_BUILD := CGO_ENABLED=0 $(GO ) build -ldflags="-s -w -X $(PACKAGE ) /pkg/version.Version=$(VERSION ) "
411
512binary : bin/sshocker
613
@@ -11,14 +18,15 @@ uninstall:
1118 rm -f /usr/local/bin/sshocker
1219
1320bin/sshocker :
14- CGO_ENABLED=0 $( GO ) build -o $@ ./cmd/sshocker
21+ $( GO_BUILD ) -o $@ ./cmd/sshocker
1522 if [ $( shell go env GOOS) = linux ]; then LANG=C LC_ALL=C file $@ | grep -qw " statically linked" ; fi
1623
1724# The file name convention for Unix: ./bin/sshocker-$(uname -s)-$(uname -m)
1825cross :
19- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO ) build -o ./bin/sshocker-Linux-x86_64 ./cmd/sshocker
20- CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO ) build -o ./bin/sshocker-Linux-aarch64 ./cmd/sshocker
21- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GO ) build -o ./bin/sshocker-Darwin-x86_64 ./cmd/sshocker
26+ GOOS=linux GOARCH=amd64 $(GO_BUILD ) -o ./bin/sshocker-Linux-x86_64 ./cmd/sshocker
27+ GOOS=linux GOARCH=arm64 $(GO_BUILD ) -o ./bin/sshocker-Linux-aarch64 ./cmd/sshocker
28+ GOOS=darwin GOARCH=amd64 $(GO_BUILD ) -o ./bin/sshocker-Darwin-x86_64 ./cmd/sshocker
29+ GOOS=darwin GOARCH=arm64 $(GO_BUILD ) -o ./bin/sshocker-Darwin-arm64 ./cmd/sshocker
2230
2331clean :
2432 rm -rf bin
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ chmod +x sshocker
2020
2121To compile from source:
2222``` console
23- go get github.com/lima-vm/sshocker/cmd/sshocker
23+ make
24+ sudo make install
2425```
2526
2627Tested on macOS client and Linux server. May not work on other environments, especially on Windows.
Original file line number Diff line number Diff line change 11package version
22
3- const Version = "0.1.0+dev"
3+ var (
4+ // Version is filled on compilation time
5+ Version = "<unknown>"
6+ )
You can’t perform that action at this time.
0 commit comments