2016-01-04 19:27:32 +08:00
|
|
|
# Project-specific variables
|
|
|
|
BINARIES ?= gotty-client
|
|
|
|
GOTTY_URL := http://localhost:8081/
|
2015-10-11 04:40:05 +08:00
|
|
|
VERSION := $(shell cat .goxc.json | jq -c .PackageVersion | sed 's/"//g')
|
2015-10-11 04:32:38 +08:00
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
CONVEY_PORT ?= 9042
|
2015-10-11 04:32:38 +08:00
|
|
|
|
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
# Common variables
|
|
|
|
SOURCES := $(shell find . -type f -name "*.go")
|
|
|
|
COMMANDS := $(shell go list ./... | grep -v /vendor/ | grep /cmd/)
|
|
|
|
PACKAGES := $(shell go list ./... | grep -v /vendor/ | grep -v /cmd/)
|
|
|
|
GOENV ?= GO15VENDOREXPERIMENT=1
|
|
|
|
GO ?= $(GOENV) go
|
|
|
|
GODEP ?= $(GOENV) godep
|
|
|
|
USER ?= $(shell whoami)
|
2015-10-11 04:32:38 +08:00
|
|
|
|
2015-10-11 05:10:09 +08:00
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
all: build
|
2015-10-11 05:10:09 +08:00
|
|
|
|
2015-10-11 04:32:38 +08:00
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
.PHONY: build
|
|
|
|
build: $(BINARIES)
|
2015-10-11 04:32:38 +08:00
|
|
|
|
|
|
|
|
2016-09-28 16:14:36 +08:00
|
|
|
.PHONY: install
|
|
|
|
install:
|
|
|
|
$(GO) install ./cmd/gotty-client
|
|
|
|
|
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
$(BINARIES): $(SOURCES)
|
2017-04-23 05:52:04 +08:00
|
|
|
$(GO) build -i -o $@ ./cmd/$@
|
2015-10-11 04:32:38 +08:00
|
|
|
|
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
.PHONY: test
|
|
|
|
test:
|
2017-04-23 05:52:04 +08:00
|
|
|
# $(GO) get -t .
|
|
|
|
$(GO) test -i -v .
|
2016-01-04 19:27:32 +08:00
|
|
|
$(GO) test -v .
|
2015-10-11 04:32:38 +08:00
|
|
|
|
2015-10-11 04:40:05 +08:00
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
.PHONY: godep-save
|
|
|
|
godep-save:
|
|
|
|
$(GODEP) save $(PACKAGES) $(COMMANDS)
|
2015-10-11 04:40:05 +08:00
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -f $(BINARIES)
|
2015-10-11 04:40:05 +08:00
|
|
|
|
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
.PHONY: re
|
|
|
|
re: clean all
|
2015-10-11 04:40:05 +08:00
|
|
|
|
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
.PHONY: convey
|
|
|
|
convey:
|
|
|
|
$(GO) get github.com/smartystreets/goconvey
|
|
|
|
goconvey -cover -port=$(CONVEY_PORT) -workDir="$(realpath .)" -depth=1
|
2015-10-11 04:40:05 +08:00
|
|
|
|
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
.PHONY: cover
|
|
|
|
cover: profile.out
|
2015-10-11 04:40:05 +08:00
|
|
|
|
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
profile.out: $(SOURCES)
|
|
|
|
rm -f $@
|
|
|
|
$(GO) test -covermode=count -coverpkg=. -coverprofile=$@ .
|
2015-11-02 01:51:50 +08:00
|
|
|
|
|
|
|
|
2016-01-04 19:27:32 +08:00
|
|
|
.PHONY: docker-build
|
|
|
|
docker-build:
|
2017-12-13 22:15:58 +08:00
|
|
|
docker build -t moul/gotty-client .
|