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')
|
|
|
|
|
2017-01-13 23:10:50 +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
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
default: dep build
|
2016-09-15 21:01:51 +00:00
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
build: assets ${BINARY}
|
|
|
|
|
|
|
|
dev: dev-assets ${BINARY}
|
2016-09-16 20:11:00 +00:00
|
|
|
|
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
|
2016-09-19 16:36:48 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
assets: js bindata
|
2016-09-16 22:50:49 +00:00
|
|
|
|
2016-10-25 15:20:06 +00:00
|
|
|
dev-assets: dev-js bindata
|
2016-09-16 22:50:49 +00:00
|
|
|
|
2016-09-20 18:44:22 +00:00
|
|
|
bindata:
|
2016-10-25 15:20:06 +00:00
|
|
|
go generate -x ./dist
|
2016-11-15 01:07:38 +00:00
|
|
|
go generate -x ./canned
|
2016-10-25 15:20:06 +00:00
|
|
|
go generate -x ./server
|
2016-09-16 17:05:09 +00:00
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
js:
|
2016-09-16 20:11:00 +00:00
|
|
|
cd ui && npm run build
|
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
dev-js:
|
|
|
|
cd ui && npm run build:dev
|
|
|
|
|
|
|
|
dep: jsdep godep
|
2016-09-16 20:11:00 +00:00
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
godep:
|
2016-09-15 21:01:51 +00:00
|
|
|
go get github.com/sparrc/gdm
|
|
|
|
gdm restore
|
2016-09-16 17:05:09 +00:00
|
|
|
go get -u github.com/jteeuwen/go-bindata/...
|
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
jsdep:
|
2016-09-20 18:44:22 +00:00
|
|
|
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
|
|
|
|
2016-10-03 17:41:50 +00:00
|
|
|
test: jstest gotest gotestrace
|
2016-09-15 21:01:51 +00:00
|
|
|
|
2016-09-16 20:11:00 +00:00
|
|
|
gotest:
|
2016-09-22 18:44:20 +00:00
|
|
|
go test ./...
|
2016-10-03 17:41:50 +00:00
|
|
|
|
|
|
|
gotestrace:
|
2016-09-22 21:15:46 +00:00
|
|
|
go test -race ./...
|
2016-09-15 21:01:51 +00:00
|
|
|
|
2016-09-16 20:11:00 +00:00
|
|
|
jstest:
|
|
|
|
cd ui && npm test
|
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
run: ${BINARY}
|
2016-11-07 17:10:47 +00:00
|
|
|
./chronograf
|
2016-09-16 20:47:38 +00:00
|
|
|
|
2016-09-20 18:44:22 +00:00
|
|
|
run-dev: ${BINARY}
|
2016-11-07 17:10:47 +00:00
|
|
|
./chronograf -d
|
2016-09-20 18:44:22 +00:00
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
clean:
|
|
|
|
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
|
|
|
|
cd ui && npm run clean
|
2016-11-08 21:42:56 +00:00
|
|
|
cd ui && rm -rf node_modules
|
2016-09-19 16:36:48 +00:00
|
|
|
|
|
|
|
.PHONY: clean test jstest gotest run
|