2015-08-04 20:52:44 +00:00
|
|
|
UNAME := $(shell sh -c 'uname')
|
2015-08-18 16:16:59 +00:00
|
|
|
VERSION := $(shell sh -c 'git describe --always --tags')
|
2015-09-10 17:01:08 +00:00
|
|
|
ifndef GOBIN
|
|
|
|
GOBIN = $(GOPATH)/bin
|
|
|
|
endif
|
2015-08-04 20:52:44 +00:00
|
|
|
|
2015-08-18 16:16:59 +00:00
|
|
|
build: prepare
|
2015-09-10 17:01:08 +00:00
|
|
|
$(GOBIN)/godep go build -o telegraf -ldflags \
|
2015-09-07 22:01:22 +00:00
|
|
|
"-X main.Version=$(VERSION)" \
|
2015-08-18 16:16:59 +00:00
|
|
|
./cmd/telegraf/telegraf.go
|
2015-08-04 20:52:44 +00:00
|
|
|
|
2015-10-08 17:33:56 +00:00
|
|
|
dev: prepare
|
|
|
|
$(GOBIN)/godep go build -race -o telegraf -ldflags \
|
|
|
|
"-X main.Version=$(VERSION)" \
|
|
|
|
./cmd/telegraf/telegraf.go
|
|
|
|
|
2015-09-04 20:12:50 +00:00
|
|
|
build-linux-bins: prepare
|
2015-09-10 17:01:08 +00:00
|
|
|
GOARCH=amd64 GOOS=linux $(GOBIN)/godep go build -o telegraf_linux_amd64 \
|
2015-09-07 22:01:22 +00:00
|
|
|
-ldflags "-X main.Version=$(VERSION)" \
|
2015-09-04 20:12:50 +00:00
|
|
|
./cmd/telegraf/telegraf.go
|
2015-09-10 17:01:08 +00:00
|
|
|
GOARCH=386 GOOS=linux $(GOBIN)/godep go build -o telegraf_linux_386 \
|
2015-09-07 22:01:22 +00:00
|
|
|
-ldflags "-X main.Version=$(VERSION)" \
|
2015-09-04 20:12:50 +00:00
|
|
|
./cmd/telegraf/telegraf.go
|
2015-09-10 17:01:08 +00:00
|
|
|
GOARCH=arm GOOS=linux $(GOBIN)/godep go build -o telegraf_linux_arm \
|
2015-09-07 22:01:22 +00:00
|
|
|
-ldflags "-X main.Version=$(VERSION)" \
|
2015-09-04 20:12:50 +00:00
|
|
|
./cmd/telegraf/telegraf.go
|
|
|
|
|
2015-07-06 04:46:43 +00:00
|
|
|
prepare:
|
2015-08-18 16:16:59 +00:00
|
|
|
go get github.com/tools/godep
|
2015-08-04 20:52:44 +00:00
|
|
|
|
|
|
|
docker-compose:
|
2015-08-18 16:16:59 +00:00
|
|
|
ifeq ($(UNAME), Darwin)
|
2015-09-09 18:19:07 +00:00
|
|
|
ADVERTISED_HOST=$(shell sh -c 'boot2docker ip || docker-machine ip default') \
|
|
|
|
docker-compose --file scripts/docker-compose.yml up -d
|
2015-08-18 16:16:59 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(UNAME), Linux)
|
2015-09-09 18:19:07 +00:00
|
|
|
ADVERTISED_HOST=localhost docker-compose --file scripts/docker-compose.yml up -d
|
2015-08-18 16:16:59 +00:00
|
|
|
endif
|
|
|
|
|
2015-10-16 22:13:32 +00:00
|
|
|
test: test-cleanup prepare docker-compose
|
|
|
|
# Sleeping for kafka leadership election, TSDB setup, etc.
|
|
|
|
sleep 30
|
|
|
|
# Setup SUCCESS, running tests
|
|
|
|
godep go test ./...
|
2015-07-06 04:46:43 +00:00
|
|
|
|
2015-08-04 14:58:32 +00:00
|
|
|
test-short: prepare
|
2015-09-10 17:01:08 +00:00
|
|
|
$(GOBIN)/godep go test -short ./...
|
2015-07-06 04:46:43 +00:00
|
|
|
|
2015-08-04 20:52:44 +00:00
|
|
|
test-cleanup:
|
2015-09-09 18:19:07 +00:00
|
|
|
docker-compose --file scripts/docker-compose.yml kill
|
2015-08-04 14:58:32 +00:00
|
|
|
|
2015-07-06 04:46:43 +00:00
|
|
|
.PHONY: test
|