2017-11-04 19:07:39 +00:00
|
|
|
.PHONY: assets dep clean test gotest gotestrace jstest run run-dev run-hmr ctags
|
2017-02-09 00:17:10 +00:00
|
|
|
|
2016-11-02 20:29:16 +00:00
|
|
|
VERSION ?= $(shell git describe --always --tags)
|
|
|
|
COMMIT ?= $(shell git rev-parse --short=8 HEAD)
|
2018-02-08 14:55:07 +00:00
|
|
|
GOBINDATA := $(shell go list -f {{.Root}} github.com/kevinburke/go-bindata 2> /dev/null)
|
2017-02-09 00:17:10 +00:00
|
|
|
YARN := $(shell command -v yarn 2> /dev/null)
|
2016-09-15 21:01:51 +00:00
|
|
|
|
2017-05-16 21:58:25 +00:00
|
|
|
SOURCES := $(shell find . -name '*.go' ! -name '*_gen.go' -not -path "./vendor/*" )
|
2017-02-09 00:17:10 +00:00
|
|
|
UISOURCES := $(shell find ui -type f -not \( -path ui/build/\* -o -path ui/node_modules/\* -prune \) )
|
2016-09-15 21:01:51 +00:00
|
|
|
|
2017-11-30 23:38:06 +00:00
|
|
|
unexport LDFLAGS
|
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
|
2018-02-09 15:30:02 +00:00
|
|
|
CTLBINARY=chronoctl
|
2016-09-15 21:01:51 +00:00
|
|
|
|
2017-02-09 00:17:10 +00:00
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
|
|
|
|
all: dep build
|
2016-09-15 21:01:51 +00:00
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
build: assets ${BINARY}
|
|
|
|
|
2017-02-09 00:17:10 +00:00
|
|
|
dev: dep dev-assets ${BINARY}
|
2016-09-16 20:11:00 +00:00
|
|
|
|
2017-02-19 18:17:37 +00:00
|
|
|
${BINARY}: $(SOURCES) .bindata .jsdep .godep
|
2016-11-02 20:29:16 +00:00
|
|
|
go build -o ${BINARY} ${LDFLAGS} ./cmd/chronograf/main.go
|
2018-02-09 15:30:02 +00:00
|
|
|
go build -o ${CTLBINARY} ${LDFLAGS} ./cmd/chronoctl
|
2016-09-15 21:01:51 +00:00
|
|
|
|
2017-04-06 18:40:57 +00:00
|
|
|
define CHRONOGIRAFFE
|
2017-11-27 15:13:02 +00:00
|
|
|
._ o o
|
|
|
|
\_`-)|_
|
|
|
|
,"" _\_
|
|
|
|
," ## | 0 0.
|
|
|
|
," ## ,-\__ `.
|
|
|
|
," / `--._;) - "HAI, I'm Chronogiraffe. Let's be friends!"
|
|
|
|
," ## /
|
|
|
|
," ## /
|
2017-04-06 18:40:57 +00:00
|
|
|
endef
|
|
|
|
export CHRONOGIRAFFE
|
|
|
|
chronogiraffe: ${BINARY}
|
|
|
|
@echo "$$CHRONOGIRAFFE"
|
|
|
|
|
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
|
|
|
|
2017-02-09 00:17:10 +00:00
|
|
|
assets: .jssrc .bindata
|
|
|
|
|
|
|
|
dev-assets: .dev-jssrc .bindata
|
2016-09-16 22:50:49 +00:00
|
|
|
|
2017-02-09 00:17:10 +00:00
|
|
|
.bindata: server/swagger_gen.go canned/bin_gen.go dist/dist_gen.go
|
|
|
|
@touch .bindata
|
2016-09-16 22:50:49 +00:00
|
|
|
|
2017-02-09 00:17:10 +00:00
|
|
|
dist/dist_gen.go: $(UISOURCES)
|
2016-10-25 15:20:06 +00:00
|
|
|
go generate -x ./dist
|
2017-02-09 00:17:10 +00:00
|
|
|
|
|
|
|
server/swagger_gen.go: server/swagger.json
|
2016-10-25 15:20:06 +00:00
|
|
|
go generate -x ./server
|
2016-09-16 17:05:09 +00:00
|
|
|
|
2017-02-09 00:17:10 +00:00
|
|
|
canned/bin_gen.go: canned/*.json
|
|
|
|
go generate -x ./canned
|
|
|
|
|
|
|
|
.jssrc: $(UISOURCES)
|
2017-08-07 19:28:23 +00:00
|
|
|
cd ui && yarn run build
|
2017-02-09 00:17:10 +00:00
|
|
|
@touch .jssrc
|
2016-09-16 20:11:00 +00:00
|
|
|
|
2017-02-09 00:17:10 +00:00
|
|
|
.dev-jssrc: $(UISOURCES)
|
2017-08-07 19:28:23 +00:00
|
|
|
cd ui && yarn run build:dev
|
2017-02-09 00:17:10 +00:00
|
|
|
@touch .dev-jssrc
|
2016-09-19 16:36:48 +00:00
|
|
|
|
2017-02-09 00:17:10 +00:00
|
|
|
dep: .jsdep .godep
|
2016-09-16 20:11:00 +00:00
|
|
|
|
2017-05-13 19:42:55 +00:00
|
|
|
.godep:
|
2017-02-09 00:17:10 +00:00
|
|
|
ifndef GOBINDATA
|
|
|
|
@echo "Installing go-bindata"
|
2018-02-08 14:55:07 +00:00
|
|
|
go get -u github.com/kevinburke/go-bindata/...
|
2017-02-09 00:17:10 +00:00
|
|
|
endif
|
|
|
|
@touch .godep
|
2016-09-16 17:05:09 +00:00
|
|
|
|
2017-02-09 00:17:10 +00:00
|
|
|
.jsdep: ui/yarn.lock
|
|
|
|
ifndef YARN
|
|
|
|
$(error Please install yarn 0.19.1+)
|
|
|
|
else
|
|
|
|
cd ui && yarn --no-progress --no-emoji
|
|
|
|
@touch .jsdep
|
|
|
|
endif
|
2016-09-15 21:01:51 +00:00
|
|
|
|
2017-05-13 19:42:55 +00:00
|
|
|
gen: internal.pb.go
|
|
|
|
|
|
|
|
internal.pb.go: 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:
|
2017-12-19 00:19:30 +00:00
|
|
|
go test ./...
|
2016-10-03 17:41:50 +00:00
|
|
|
|
|
|
|
gotestrace:
|
2017-12-19 00:19:30 +00:00
|
|
|
go test -race ./...
|
2016-09-15 21:01:51 +00:00
|
|
|
|
2016-09-16 20:11:00 +00:00
|
|
|
jstest:
|
2018-03-14 17:00:37 +00:00
|
|
|
cd ui && yarn test --runInBand
|
2016-09-16 20:11:00 +00:00
|
|
|
|
2018-03-23 18:08:06 +00:00
|
|
|
jslint:
|
|
|
|
cd ui && yarn run lint:fix
|
|
|
|
|
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
|
|
|
|
2017-04-06 18:40:57 +00:00
|
|
|
run-dev: chronogiraffe
|
2017-02-19 06:54:52 +00:00
|
|
|
./chronograf -d --log-level=debug
|
2016-09-20 18:44:22 +00:00
|
|
|
|
2017-11-04 19:07:39 +00:00
|
|
|
run-hmr:
|
|
|
|
cd ui && npm run start:hmr
|
|
|
|
|
2016-09-19 16:36:48 +00:00
|
|
|
clean:
|
|
|
|
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
|
2017-08-07 19:28:23 +00:00
|
|
|
cd ui && yarn run clean
|
2016-11-08 21:42:56 +00:00
|
|
|
cd ui && rm -rf node_modules
|
2017-02-09 00:17:10 +00:00
|
|
|
rm -f dist/dist_gen.go canned/bin_gen.go server/swagger_gen.go
|
|
|
|
@rm -f .godep .jsdep .jssrc .dev-jssrc .bindata
|
2017-02-19 18:17:37 +00:00
|
|
|
|
2017-02-14 19:22:35 +00:00
|
|
|
ctags:
|
|
|
|
ctags -R --languages="Go" --exclude=.git --exclude=ui .
|