Skip to content

Commit

Permalink
Makefile will now honor GOBIN, if set
Browse files Browse the repository at this point in the history
  • Loading branch information
Vye authored and sparrc committed Sep 10, 2015
1 parent 81f4aa9 commit a55f649
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ will still be backwards compatible if only `url` is specified.

### Features
- [#143](https://github.com/influxdb/telegraf/issues/143): InfluxDB clustering support
- [#181](https://github.com/influxdb/telegraf/issues/181): Makefile GOBIN support. Thanks @Vye!

### Bugfixes
- [#170](https://github.com/influxdb/telegraf/issues/170): Systemd support
Expand Down
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
UNAME := $(shell sh -c 'uname')
VERSION := $(shell sh -c 'git describe --always --tags')
ifndef GOBIN
GOBIN = $(GOPATH)/bin
endif

build: prepare
$(GOPATH)/bin/godep go build -o telegraf -ldflags \
$(GOBIN)/godep go build -o telegraf -ldflags \
"-X main.Version $(VERSION)" \
./cmd/telegraf/telegraf.go

build-linux-bins: prepare
GOARCH=amd64 GOOS=linux $(GOPATH)/bin/godep go build -o telegraf_linux_amd64 \
GOARCH=amd64 GOOS=linux $(GOBIN)/godep go build -o telegraf_linux_amd64 \
-ldflags "-X main.Version $(VERSION)" \
./cmd/telegraf/telegraf.go
GOARCH=386 GOOS=linux $(GOPATH)/bin/godep go build -o telegraf_linux_386 \
GOARCH=386 GOOS=linux $(GOBIN)/godep go build -o telegraf_linux_386 \
-ldflags "-X main.Version $(VERSION)" \
./cmd/telegraf/telegraf.go
GOARCH=arm GOOS=linux $(GOPATH)/bin/godep go build -o telegraf_linux_arm \
GOARCH=arm GOOS=linux $(GOBIN)/godep go build -o telegraf_linux_arm \
-ldflags "-X main.Version $(VERSION)" \
./cmd/telegraf/telegraf.go

Expand All @@ -30,10 +33,10 @@ ifeq ($(UNAME), Linux)
endif

test: prepare docker-compose
$(GOPATH)/bin/godep go test -v ./...
$(GOBIN)/godep go test -v ./...

test-short: prepare
$(GOPATH)/bin/godep go test -short ./...
$(GOBIN)/godep go test -short ./...

test-cleanup:
docker-compose --file scripts/docker-compose.yml kill
Expand Down

0 comments on commit a55f649

Please sign in to comment.