sshportal/Makefile

47 lines
1.5 KiB
Makefile
Raw Normal View History

2017-11-14 07:38:23 +08:00
GIT_SHA ?= $(shell git rev-parse HEAD)
GIT_TAG ?= $(shell git describe --tags --always)
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
2017-12-04 01:18:17 +08:00
LDFLAGS ?= -X main.GitSha=$(GIT_SHA) -X main.GitTag=$(GIT_TAG) -X main.GitBranch=$(GIT_BRANCH)
2017-11-14 16:57:21 +08:00
VERSION ?= $(shell grep 'VERSION =' main.go | cut -d'"' -f2)
2017-11-23 16:58:32 +08:00
PORT ?= 2222
2017-11-24 21:29:41 +08:00
AES_KEY ?= my-dummy-aes-key
2017-11-14 07:38:23 +08:00
2017-10-31 16:31:36 +08:00
.PHONY: install
install:
2017-12-04 16:52:30 +08:00
go install -v -ldflags '$(LDFLAGS)' .
2017-11-14 08:13:51 +08:00
2017-11-15 18:24:57 +08:00
.PHONY: docker.build
docker.build:
docker build -t moul/sshportal .
.PHONY: integration
integration:
2017-11-23 16:58:32 +08:00
PORT="$(PORT)" bash ./examples/integration/test.sh
2017-11-15 18:24:57 +08:00
2017-11-14 08:13:51 +08:00
.PHONY: _docker_install
_docker_install:
CGO_ENABLED=1 go build -ldflags '-extldflags "-static" $(LDFLAGS)' -tags netgo -v -o /go/bin/sshportal
2017-10-31 16:31:36 +08:00
.PHONY: dev
dev:
-go get github.com/githubnemo/CompileDaemon
CompileDaemon -exclude-dir=.git -exclude=".#*" -color=true -command="./sshportal --debug --bind-address=:$(PORT) --aes-key=$(AES_KEY) $(EXTRA_RUN_OPTS)" .
2017-11-13 17:13:17 +08:00
.PHONY: test
test:
go test -i .
go test -v .
2017-11-14 16:57:21 +08:00
2017-12-04 01:18:17 +08:00
.PHONY: lint
lint:
gometalinter --disable-all --enable=errcheck --enable=vet --enable=vetshadow --enable=golint --enable=gas --enable=ineffassign --enable=goconst --enable=goimports --enable=gofmt --exclude="should have comment" --enable=staticcheck --enable=gosimple --enable=misspell --deadline=20s .
2017-11-14 16:57:21 +08:00
.PHONY: backup
backup:
mkdir -p data/backups
cp sshportal.db data/backups/$(shell date +%s)-$(VERSION)-sshportal.sqlite
2017-12-16 02:48:47 +08:00
doc:
dot -Tsvg ./.assets/overview.dot > ./.assets/overview.svg
dot -Tsvg ./.assets/cluster-mysql.dot > ./.assets/cluster-mysql.svg