aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTobias Schmidt <ts@soundcloud.com>2014-04-09 19:20:52 -0400
committerTobias Schmidt <ts@soundcloud.com>2014-04-09 19:30:49 -0400
commitc18f7ecfc6fe82cd16505b9cb4de1214f6bbd885 (patch)
tree016a50fe9310bf53c25b22aaa4f324886931e070 /Makefile
parent0f7604c3cd91049782fd710a08723bbb66887dad (diff)
downloadprometheus_node_collector-c18f7ecfc6fe82cd16505b9cb4de1214f6bbd885.tar.bz2
prometheus_node_collector-c18f7ecfc6fe82cd16505b9cb4de1214f6bbd885.tar.xz
prometheus_node_collector-c18f7ecfc6fe82cd16505b9cb4de1214f6bbd885.zip
Add Makefile with install and release targets
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile50
1 files changed, 50 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8b47af2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,50 @@
1VERSION := 0.3.0
2
3SRC := $(wildcard *.go)
4TARGET := node_exporter
5
6OS := $(subst Darwin,darwin,$(subst Linux,linux,$(shell uname)))
7ARCH := $(subst x86_64,amd64,$(shell uname -m))
8
9GOOS ?= $(OS)
10GOARCH ?= $(ARCH)
11GOPKG := go1.2.1.$(OS)-$(ARCH).tar.gz
12GOROOT ?= $(CURDIR)/.deps/go
13GOPATH ?= $(CURDIR)/.deps/gopath
14GOCC := $(GOROOT)/bin/go
15GOLIB := $(GOROOT)/pkg/$(GOOS)_$(GOARCH)
16GO := GOROOT=$(GOROOT) GOPATH=$(GOPATH) $(GOCC)
17
18SUFFIX := $(GOOS)-$(GOARCH)
19BINARY := $(TARGET)
20ARCHIVE := $(TARGET)-$(VERSION).$(SUFFIX).tar.gz
21
22default:
23 go build $(GOFLAGS)
24
25.deps/$(GOPKG):
26 mkdir -p .deps
27 curl -o .deps/$(GOPKG) http://go.googlecode.com/files/$(GOPKG)
28
29$(GOCC): .deps/$(GOPKG)
30 tar -C .deps -xzf .deps/$(GOPKG)
31 touch $@
32
33dependencies: $(SRC)
34 $(GO) get -d
35
36$(BINARY): $(GOCC) $(SRC) dependencies
37 $(GO) build $(GOFLAGS) -o $@
38
39$(ARCHIVE): $(BINARY)
40 tar -czf $@ $<
41
42release: REMOTE ?= $(error "can't release, REMOTE not set")
43release: REMOTE_DIR ?= $(error "can't release, REMOTE_DIR not set")
44release: $(ARCHIVE)
45 scp $< $(REMOTE):$(REMOTE_DIR)/$(ARCHIVE)
46
47clean:
48 rm -rf bin
49
50.PHONY: dependencies clean release