sshportal/Makefile

51 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-24 21:29:41 +08:00
AES_KEY ?= my-dummy-aes-key
2018-11-16 17:24:18 +08:00
GO ?= GO111MODULE=on go
2017-11-14 07:38:23 +08:00
2017-10-31 16:31:36 +08:00
.PHONY: install
install:
2018-11-16 17:24:18 +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:
cd ./examples/integration && make
2017-11-15 18:24:57 +08:00
2017-11-14 08:13:51 +08:00
.PHONY: _docker_install
_docker_install:
2018-11-16 17:24:18 +08:00
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:
2018-11-16 17:24:18 +08:00
-$(GO) get github.com/githubnemo/CompileDaemon
2018-02-28 21:35:06 +08:00
CompileDaemon -exclude-dir=.git -exclude=".#*" -color=true -command="./sshportal server --debug --bind-address=:$(PORT) --aes-key=$(AES_KEY) $(EXTRA_RUN_OPTS)" .
2017-11-13 17:13:17 +08:00
.PHONY: test
test:
2018-11-16 17:24:18 +08:00
$(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:
2018-11-16 22:44:29 +08:00
golangci-lint run --verbose ./...
2017-12-04 01:18:17 +08:00
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
2017-12-17 17:08:44 +08:00
dot -Tsvg ./.assets/flow-diagram.dot > ./.assets/flow-diagram.svg
dot -Tpng ./.assets/overview.dot > ./.assets/overview.png
dot -Tpng ./.assets/cluster-mysql.dot > ./.assets/cluster-mysql.png
dot -Tpng ./.assets/flow-diagram.dot > ./.assets/flow-diagram.png