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-08-04 20:52:44 +00:00
|
|
|
|
2015-08-18 16:16:59 +00:00
|
|
|
build: prepare
|
|
|
|
$(GOPATH)/bin/godep go build -o telegraf -ldflags \
|
2015-09-10 18:33:29 +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
|
|
|
|
GOARCH=amd64 GOOS=linux $(GOPATH)/bin/godep go build -o telegraf_linux_amd64 \
|
2015-09-10 18:33:29 +00:00
|
|
|
-ldflags "-X main.Version=$(VERSION)" \
|
2015-09-04 20:12:50 +00:00
|
|
|
./cmd/telegraf/telegraf.go
|
|
|
|
GOARCH=386 GOOS=linux $(GOPATH)/bin/godep go build -o telegraf_linux_386 \
|
2015-09-10 18:33:29 +00:00
|
|
|
-ldflags "-X main.Version=$(VERSION)" \
|
2015-09-04 20:12:50 +00:00
|
|
|
./cmd/telegraf/telegraf.go
|
|
|
|
GOARCH=arm GOOS=linux $(GOPATH)/bin/godep go build -o telegraf_linux_arm \
|
2015-09-10 18:33:29 +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-08-25 22:34:30 +00:00
|
|
|
ADVERTISED_HOST=$(shell sh -c 'boot2docker ip') docker-compose up -d
|
2015-08-18 16:16:59 +00:00
|
|
|
endif
|
|
|
|
ifeq ($(UNAME), Linux)
|
2015-08-25 22:34:30 +00:00
|
|
|
ADVERTISED_HOST=localhost docker-compose up -d
|
2015-08-18 16:16:59 +00:00
|
|
|
endif
|
|
|
|
|
2015-08-25 22:34:30 +00:00
|
|
|
test: prepare docker-compose
|
2015-08-18 16:16:59 +00:00
|
|
|
$(GOPATH)/bin/godep go test -v ./...
|
2015-07-06 04:46:43 +00:00
|
|
|
|
2015-08-04 14:58:32 +00:00
|
|
|
test-short: prepare
|
2015-08-31 20:03:38 +00:00
|
|
|
$(GOPATH)/bin/godep go test -short ./...
|
2015-07-06 04:46:43 +00:00
|
|
|
|
2015-08-04 20:52:44 +00:00
|
|
|
test-cleanup:
|
|
|
|
docker-compose kill
|
2015-08-04 14:58:32 +00:00
|
|
|
|
2015-07-06 04:46:43 +00:00
|
|
|
.PHONY: test
|