influxdb/Makefile

56 lines
1.2 KiB
Makefile
Raw Normal View History

2016-09-15 21:01:51 +00:00
VERSION ?= $$(git describe --always --tags)
COMMIT ?= $$(git rev-parse --short=8 HEAD)
BRANCH ?= $$(git rev-parse --abbrev-ref HEAD | tr / _)
BUILD_TIME ?= $$(date +%FT%T%z)
SOURCES := $(shell find . -name '*.go')
LDFLAGS=-ldflags "-s -X main.Version=${VERSION} -X main.Commit=${COMMIT} -X main.BuildTime=${BUILD_TIME} -X main.Branch=${BRANCH}"
BINARY=mrfusion
default: prepare ${BINARY}
prepare: dev assets
2016-09-15 21:01:51 +00:00
${BINARY}: $(SOURCES)
go build -o ${BINARY} ${LDFLAGS} ./cmd/mr-fusion-server/main.go
docker-${BINARY}: $(SOURCES)
CGO_ENABLED=0 GOOS=linux go build -installsuffix cgo -o ${BINARY} ${LDFLAGS} \
./cmd/mr-fusion-server/main.go
docker: docker-${BINARY}
docker build -t mrfusion .
2016-09-15 21:01:51 +00:00
assets: jsbuild
2016-09-16 18:47:58 +00:00
go-bindata -o ui/ui.go -ignore 'map|go' -pkg ui -nocompress=true ui/build/...
jsbuild:
cd ui && npm run build
dev: jsdev godev
godev:
2016-09-15 21:01:51 +00:00
go get github.com/sparrc/gdm
gdm restore
go get -u github.com/jteeuwen/go-bindata/...
jsdev:
cd ui && npm install
2016-09-15 21:01:51 +00:00
clean:
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
cd ui && npm run clean
test: gotest jstest
2016-09-15 21:01:51 +00:00
gotest:
2016-09-15 21:01:51 +00:00
go test -race ./...
jstest:
cd ui && npm test
run:
./mrfusion --port 8888
.PHONY: clean test jstest run