2014-12-10 00:51:24 +01:00
|
|
|
BINARY = ssh-chat
|
|
|
|
KEY = host_key
|
|
|
|
PORT = 2022
|
|
|
|
|
2015-01-21 20:47:59 +01:00
|
|
|
SRCS = %.go
|
2016-08-17 19:34:06 +02:00
|
|
|
VERSION := $(shell git describe --tags --dirty --always 2> /dev/null || echo "dev")
|
2019-03-16 03:56:48 +01:00
|
|
|
LDFLAGS = -X main.Version=$(VERSION) -extldflags "-static"
|
2014-12-10 00:51:24 +01:00
|
|
|
|
2015-01-21 20:47:59 +01:00
|
|
|
all: $(BINARY)
|
2014-12-10 00:51:24 +01:00
|
|
|
|
2018-12-16 00:47:35 +01:00
|
|
|
$(BINARY): **/**/*.go **/*.go *.go
|
2020-01-07 02:14:32 +01:00
|
|
|
go build -ldflags "$(LDFLAGS)" ./cmd/ssh-chat
|
2014-12-10 00:51:24 +01:00
|
|
|
|
|
|
|
build: $(BINARY)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm $(BINARY)
|
|
|
|
|
2014-12-10 03:22:46 +01:00
|
|
|
$(KEY):
|
2014-12-10 00:51:24 +01:00
|
|
|
ssh-keygen -f $(KEY) -P ''
|
|
|
|
|
|
|
|
run: $(BINARY) $(KEY)
|
2014-12-12 23:50:14 +01:00
|
|
|
./$(BINARY) -i $(KEY) --bind ":$(PORT)" -vv
|
2014-12-12 07:19:04 +01:00
|
|
|
|
2014-12-15 02:37:20 +01:00
|
|
|
debug: $(BINARY) $(KEY)
|
|
|
|
./$(BINARY) --pprof 6060 -i $(KEY) --bind ":$(PORT)" -vv
|
|
|
|
|
2014-12-12 07:19:04 +01:00
|
|
|
test:
|
2019-03-21 18:39:33 +01:00
|
|
|
go test -race -test.timeout 5s ./...
|
2016-07-10 23:57:39 +02:00
|
|
|
|
|
|
|
release:
|
2019-03-16 03:56:48 +01:00
|
|
|
# We use static linking for release build. LDFLAGS via
|
|
|
|
# https://github.com/golang/go/issues/26492
|
|
|
|
# Can replace LDFLAGS with -static once the issue has been resolved.
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 LDFLAGS='$(LDFLAGS)' ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=386 LDFLAGS='$(LDFLAGS)' ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 LDFLAGS='$(LDFLAGS)' ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE
|
|
|
|
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 LDFLAGS='$(LDFLAGS)' ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE
|
|
|
|
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 LDFLAGS='$(LDFLAGS)' ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE
|
|
|
|
CGO_ENABLED=0 GOOS=windows GOARCH=386 LDFLAGS='$(LDFLAGS)' ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE
|