sshportal/Makefile

29 lines
844 B
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-11-14 08:13:51 +08:00
LDFLAGS ?= -X main.GIT_SHA=$(GIT_SHA) -X main.GIT_TAG=$(GIT_TAG) -X main.GIT_BRANCH=$(GIT_BRANCH)
2017-11-14 16:57:21 +08:00
VERSION ?= $(shell grep 'VERSION =' main.go | cut -d'"' -f2)
2017-11-14 07:38:23 +08:00
2017-10-31 16:31:36 +08:00
.PHONY: install
install:
2017-11-14 08:13:51 +08:00
go install -ldflags '$(LDFLAGS)' .
.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
2017-10-31 17:17:06 +08:00
CompileDaemon -exclude-dir=.git -exclude=".#*" -color=true -command="./sshportal --demo --debug" .
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
.PHONY: backup
backup:
mkdir -p data/backups
cp sshportal.db data/backups/$(shell date +%s)-$(VERSION)-sshportal.sqlite