ssh-chat/Makefile

47 lines
1.9 KiB
Makefile
Raw Normal View History

2014-12-10 00:51:24 +01:00
BINARY = ssh-chat
KEY = host_key
PORT = 2022
SRCS = %.go
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
all: $(BINARY)
2014-12-10 00:51:24 +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
debug: $(BINARY) $(KEY)
./$(BINARY) --pprof 6060 -i $(KEY) --bind ":$(PORT)" -vv
2014-12-12 07:19:04 +01:00
test:
go test -race -test.timeout 5s ./...
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
2021-04-18 02:31:13 +02:00
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 LDFLAGS='$(LDFLAGS)' ./build_release "github.com/shazow/ssh-chat/cmd/ssh-chat" README.md LICENSE
2019-03-16 03:56:48 +01:00
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
2021-04-13 17:32:24 +02:00
deploy: build/ssh-chat-linux_amd64.tgz
ssh -p 2022 ssh.chat tar xvz < build/ssh-chat-linux_amd64.tgz
@echo " --- Ready to deploy ---"
2021-10-11 16:18:03 +02:00
@echo "Run: ssh -t -p 2022 ssh.chat sudo systemctl restart ssh-chat"