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-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-08-25 22:34:30 +00:00
|
|
|
test: prepare docker-compose
|
2015-09-10 17:01:08 +00:00
|
|
|
$(GOBIN)/godep go test -v ./...
|
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
|