File tree 3 files changed +19
-7
lines changed
3 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 1
1
.DEFAULT_GOAL := binary
2
2
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 ) "
4
11
5
12
binary : bin/sshocker
6
13
@@ -11,14 +18,15 @@ uninstall:
11
18
rm -f /usr/local/bin/sshocker
12
19
13
20
bin/sshocker :
14
- CGO_ENABLED=0 $( GO ) build -o $@ ./cmd/sshocker
21
+ $( GO_BUILD ) -o $@ ./cmd/sshocker
15
22
if [ $( shell go env GOOS) = linux ]; then LANG=C LC_ALL=C file $@ | grep -qw " statically linked" ; fi
16
23
17
24
# The file name convention for Unix: ./bin/sshocker-$(uname -s)-$(uname -m)
18
25
cross :
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
22
30
23
31
clean :
24
32
rm -rf bin
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ chmod +x sshocker
20
20
21
21
To compile from source:
22
22
``` console
23
- go get github.com/lima-vm/sshocker/cmd/sshocker
23
+ make
24
+ sudo make install
24
25
```
25
26
26
27
Tested 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 1
1
package version
2
2
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