Merge pull request #34 from brian-brazil/hermetic

Make build hermetic.
This commit is contained in:
juliusv 2015-01-25 16:33:08 +01:00
commit 1b1c14c47b

View file

@ -8,9 +8,9 @@ ARCH := $(subst x86_64,amd64,$(shell uname -m))
GOOS ?= $(OS) GOOS ?= $(OS)
GOARCH ?= $(ARCH) GOARCH ?= $(ARCH)
GOPKG := go1.3.3.$(OS)-$(ARCH).tar.gz GOPKG := go1.4.1.$(OS)-$(ARCH).tar.gz
GOROOT ?= $(CURDIR)/.deps/go GOROOT := $(CURDIR)/.deps/go
GOPATH ?= $(CURDIR)/.deps/gopath GOPATH := $(CURDIR)/.deps/gopath
GOCC := $(GOROOT)/bin/go GOCC := $(GOROOT)/bin/go
GOLIB := $(GOROOT)/pkg/$(GOOS)_$(GOARCH) GOLIB := $(GOROOT)/pkg/$(GOOS)_$(GOARCH)
GO := GOROOT=$(GOROOT) GOPATH=$(GOPATH) $(GOCC) GO := GOROOT=$(GOROOT) GOPATH=$(GOPATH) $(GOCC)
@ -18,9 +18,9 @@ GO := GOROOT=$(GOROOT) GOPATH=$(GOPATH) $(GOCC)
SUFFIX := $(GOOS)-$(GOARCH) SUFFIX := $(GOOS)-$(GOARCH)
BINARY := $(TARGET) BINARY := $(TARGET)
ARCHIVE := $(TARGET)-$(VERSION).$(SUFFIX).tar.gz ARCHIVE := $(TARGET)-$(VERSION).$(SUFFIX).tar.gz
SELFLINK := $(GOPATH)/src/github.com/prometheus/node_exporter
default: default: $(BINARY)
go build $(GOFLAGS)
.deps/$(GOPKG): .deps/$(GOPKG):
mkdir -p .deps mkdir -p .deps
@ -30,7 +30,11 @@ $(GOCC): .deps/$(GOPKG)
tar -C .deps -xzf .deps/$(GOPKG) tar -C .deps -xzf .deps/$(GOPKG)
touch $@ touch $@
dependencies: $(SRC) $(SELFLINK):
mkdir -p $(GOPATH)/src/github.com/prometheus
ln -s $(CURDIR) $(SELFLINK)
dependencies: $(SRC) $(SELFLINK)
$(GO) get -d $(GO) get -d
$(BINARY): $(GOCC) $(SRC) dependencies $(BINARY): $(GOCC) $(SRC) dependencies
@ -45,6 +49,6 @@ release: $(ARCHIVE)
scp $< $(REMOTE):$(REMOTE_DIR)/$(ARCHIVE) scp $< $(REMOTE):$(REMOTE_DIR)/$(ARCHIVE)
clean: clean:
rm -rf bin rm -rf node_exporter .deps
.PHONY: dependencies clean release .PHONY: dependencies clean release