chronograf/Makefile

76 lines
1.3 KiB
Makefile
Raw Normal View History

2016-11-02 20:29:16 +00:00
VERSION ?= $(shell git describe --always --tags)
COMMIT ?= $(shell git rev-parse --short=8 HEAD)
2016-09-15 21:01:51 +00:00
SOURCES := $(shell find . -name '*.go')
2016-10-24 17:08:36 +00:00
LDFLAGS=-ldflags "-s -X main.Version=${VERSION} -X main.Commit=${COMMIT}"
2016-10-20 14:38:23 +00:00
BINARY=chronograf
2016-09-15 21:01:51 +00:00
default: dep build
2016-09-15 21:01:51 +00:00
build: assets ${BINARY}
dev: dev-assets ${BINARY}
2016-09-15 21:01:51 +00:00
${BINARY}: $(SOURCES)
2016-11-02 20:29:16 +00:00
go build -o ${BINARY} ${LDFLAGS} ./cmd/chronograf/main.go
2016-09-15 21:01:51 +00:00
docker-${BINARY}: $(SOURCES)
CGO_ENABLED=0 GOOS=linux go build -installsuffix cgo -o ${BINARY} ${LDFLAGS} \
2016-11-02 20:29:16 +00:00
./cmd/chronograf/main.go
docker: dep assets docker-${BINARY}
2016-10-20 14:38:23 +00:00
docker build -t chronograf .
2016-09-15 21:01:51 +00:00
assets: js bindata
2016-10-25 15:20:06 +00:00
dev-assets: dev-js bindata
bindata:
2016-10-25 15:20:06 +00:00
go generate -x ./dist
go generate -x ./canned
2016-10-25 15:20:06 +00:00
go generate -x ./server
js:
cd ui && npm run build
dev-js:
cd ui && npm run build:dev
dep: jsdep godep
godep:
2016-09-15 21:01:51 +00:00
go get github.com/sparrc/gdm
gdm restore
go get -u github.com/jteeuwen/go-bindata/...
jsdep:
cd ui && npm install
2016-09-15 21:01:51 +00:00
2016-09-28 19:32:58 +00:00
gen: bolt/internal/internal.proto
2016-10-25 15:20:06 +00:00
go generate -x ./bolt/internal
2016-09-28 19:32:58 +00:00
test: jstest gotest gotestrace
2016-09-15 21:01:51 +00:00
gotest:
go test ./...
gotestrace:
go test -race ./...
2016-09-15 21:01:51 +00:00
jstest:
cd ui && npm test
run: ${BINARY}
./chronograf
run-dev: ${BINARY}
./chronograf -d
clean:
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
cd ui && npm run clean
cd ui && rm -rf node_modules
.PHONY: clean test jstest gotest run