2013-02-07 02:38:01 -08:00
|
|
|
# Copyright 2013 Prometheus Team
|
2012-11-28 13:58:14 -08:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2012-12-01 04:09:07 -08:00
|
|
|
GO_VERSION := 1.0.3
|
|
|
|
LEVELDB_VERSION := 1.7.0
|
|
|
|
PROTOCOL_BUFFERS_VERSION := 2.4.1
|
2013-02-01 04:35:07 -08:00
|
|
|
SNAPPY_VERSION := 1.0.5
|
2012-12-01 04:09:07 -08:00
|
|
|
|
2012-11-28 13:58:14 -08:00
|
|
|
OVERLAY_ROOT := ${HOME}/overlay_root
|
|
|
|
|
|
|
|
export PATH := $(PATH):$(OVERLAY_ROOT)/bin
|
|
|
|
export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(OVERLAY_ROOT)/lib
|
2012-12-01 04:09:07 -08:00
|
|
|
|
2012-11-28 13:58:14 -08:00
|
|
|
export CFLAGS := $(CFLAGS) -I$(OVERLAY_ROOT)/include
|
|
|
|
export CXXFLAGS := $(CXXFLAGS) -I$(OVERLAY_ROOT)/include
|
|
|
|
export CPPFLAGS := $(CPPFLAGS) -I$(OVERLAY_ROOT)/include
|
|
|
|
export LDFLAGS := $(LDFLAGS) -L$(OVERLAY_ROOT)/lib
|
2013-02-01 04:35:07 -08:00
|
|
|
export CGO_CFLAGS := $(CFLAGS) -lsnappy
|
2012-12-01 04:30:23 -08:00
|
|
|
export CGO_LDFLAGS := $(LDFLAGS)
|
2012-11-28 13:58:14 -08:00
|
|
|
|
2013-03-28 10:17:50 -07:00
|
|
|
export GO_TEST_FLAGS := "-v"
|
|
|
|
|
2012-12-01 04:30:23 -08:00
|
|
|
GO_GET := go get -u -v -x
|
2012-11-28 13:58:14 -08:00
|
|
|
APT_GET_INSTALL := sudo apt-get install -y
|
|
|
|
WGET := wget -c
|
|
|
|
|
|
|
|
all: test
|
|
|
|
|
|
|
|
preparation: preparation-stamp
|
|
|
|
|
|
|
|
preparation-stamp: build-dependencies
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
build-dependencies: build-dependencies-stamp
|
|
|
|
|
2013-03-21 10:29:33 -07:00
|
|
|
build-dependencies-stamp: bison cc go goprotobuf gorest goskiplist instrumentation leveldb levigo mercurial protoc
|
2012-11-28 13:58:14 -08:00
|
|
|
touch $@
|
|
|
|
|
2012-12-01 04:09:07 -08:00
|
|
|
overlay: overlay-stamp
|
|
|
|
|
|
|
|
overlay-stamp:
|
|
|
|
[ -d "$(OVERLAY_ROOT)" ] || mkdir -vp $(OVERLAY_ROOT)
|
|
|
|
touch $@
|
|
|
|
|
2012-11-28 13:58:14 -08:00
|
|
|
bison: bison-stamp
|
|
|
|
|
|
|
|
bison-stamp:
|
|
|
|
[ -x "$$(which bison)" ] || $(APT_GET_INSTALL) bison
|
|
|
|
|
|
|
|
cc: cc-stamp
|
|
|
|
|
|
|
|
cc-stamp:
|
|
|
|
[ -x "$$(which cc)" ] || $(APT_GET_INSTALL) build-essential
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
go: go-stamp
|
|
|
|
|
|
|
|
go-stamp: bison
|
2012-12-01 04:09:07 -08:00
|
|
|
gvm install go$(GO_VERSION) || true
|
|
|
|
gvm use go$(GO_VERSION) || true
|
2012-11-28 13:58:14 -08:00
|
|
|
[ -x "$$(which go)" ]
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
mercurial: mercurial-stamp
|
|
|
|
|
|
|
|
mercurial-stamp:
|
|
|
|
[ -x "$$(which hg)" ] || $(APT_GET_INSTALL) mercurial
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
wget: wget-stamp
|
|
|
|
|
|
|
|
wget-stamp:
|
|
|
|
[ -x "$$(which wget)" ] || $(APT_GET_INSTALL) wget
|
|
|
|
touch $@
|
|
|
|
|
2012-12-01 04:09:07 -08:00
|
|
|
protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2: wget
|
2012-11-28 13:58:14 -08:00
|
|
|
$(WGET) http://protobuf.googlecode.com/files/$@
|
|
|
|
|
|
|
|
protoc: protoc-stamp
|
|
|
|
|
2012-12-01 04:09:07 -08:00
|
|
|
protoc-stamp: cc protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2 overlay
|
|
|
|
([ ! -x "$$(which protoc)" ] && tar xjvf protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2) || true
|
|
|
|
([ ! -x "$$(which protoc)" ] && cd protobuf-$(PROTOCOL_BUFFERS_VERSION) && ./configure --prefix="$(OVERLAY_ROOT)") || true
|
|
|
|
([ ! -x "$$(which protoc)" ] && $(MAKE) -C protobuf-$(PROTOCOL_BUFFERS_VERSION)) || true
|
|
|
|
([ ! -x "$$(which protoc)" ] && $(MAKE) -C protobuf-$(PROTOCOL_BUFFERS_VERSION) install) || true
|
2012-11-28 13:58:14 -08:00
|
|
|
[ -x "$$(which protoc)" ]
|
|
|
|
touch $@
|
|
|
|
|
2013-01-10 17:41:04 -08:00
|
|
|
gorest: gorest-stamp
|
|
|
|
|
|
|
|
gorest-stamp: go source
|
|
|
|
$(GO_GET) code.google.com/p/gorest
|
|
|
|
touch $@
|
|
|
|
|
2012-11-28 13:58:14 -08:00
|
|
|
goprotobuf: goprotobuf-stamp
|
|
|
|
|
|
|
|
goprotobuf-stamp: go protoc source
|
|
|
|
$(GO_GET) code.google.com/p/goprotobuf/proto
|
|
|
|
$(GO_GET) code.google.com/p/goprotobuf/protoc-gen-go
|
|
|
|
touch $@
|
|
|
|
|
2012-12-25 04:50:36 -08:00
|
|
|
instrumentation: instrumentation-stamp
|
|
|
|
|
|
|
|
instrumentation-stamp: go source
|
2013-01-22 09:37:01 -08:00
|
|
|
$(GO_GET) github.com/prometheus/client_golang
|
2012-12-25 04:50:36 -08:00
|
|
|
touch $@
|
|
|
|
|
2012-11-28 13:58:14 -08:00
|
|
|
leveldb: leveldb-stamp
|
|
|
|
|
2013-02-01 04:35:07 -08:00
|
|
|
leveldb-stamp: cc rsync leveldb-$(LEVELDB_VERSION).tar.gz snappy overlay
|
2012-12-01 04:09:07 -08:00
|
|
|
tar xzvf leveldb-$(LEVELDB_VERSION).tar.gz
|
|
|
|
$(MAKE) -C leveldb-$(LEVELDB_VERSION)
|
|
|
|
rsync -av "leveldb-$(LEVELDB_VERSION)/include/" "$(OVERLAY_ROOT)/include/"
|
2012-12-01 04:30:23 -08:00
|
|
|
-rsync -av "leveldb-$(LEVELDB_VERSION)/"*.*so* "$(OVERLAY_ROOT)/lib/"
|
|
|
|
-rsync -av "leveldb-$(LEVELDB_VERSION)/"*.*dylib* "$(OVERLAY_ROOT)/lib/"
|
|
|
|
rsync -av "leveldb-$(LEVELDB_VERSION)/"*.a "$(OVERLAY_ROOT)/lib/"
|
2012-11-28 13:58:14 -08:00
|
|
|
touch $@
|
|
|
|
|
2012-12-01 04:09:07 -08:00
|
|
|
leveldb-$(LEVELDB_VERSION).tar.gz: wget
|
|
|
|
$(WGET) http://leveldb.googlecode.com/files/leveldb-$(LEVELDB_VERSION).tar.gz
|
2012-11-28 13:58:14 -08:00
|
|
|
|
|
|
|
levigo: levigo-stamp
|
|
|
|
|
2013-02-01 04:35:07 -08:00
|
|
|
levigo-stamp: leveldb go snappy source
|
2012-11-28 13:58:14 -08:00
|
|
|
$(GO_GET) github.com/jmhodges/levigo
|
|
|
|
touch $@
|
|
|
|
|
2013-03-25 10:25:08 -07:00
|
|
|
goskiplist: goskiplist-stamp
|
2013-03-19 09:17:51 -07:00
|
|
|
|
2013-03-25 10:25:08 -07:00
|
|
|
goskiplist-stamp: go source
|
2013-03-19 09:39:47 -07:00
|
|
|
$(GO_GET) github.com/ryszard/goskiplist/skiplist
|
2013-03-19 09:17:51 -07:00
|
|
|
touch $@
|
|
|
|
|
2012-11-28 13:58:14 -08:00
|
|
|
rsync: rsync-stamp
|
|
|
|
|
|
|
|
rsync-stamp:
|
|
|
|
[ -x "$$(which rsync)" ] || $(APT_GET_INSTALL) rsync
|
|
|
|
|
2013-03-19 10:01:21 -07:00
|
|
|
vim-common: vim-common-stamp
|
|
|
|
|
|
|
|
vim-common-stamp:
|
|
|
|
$(APT_GET_INSTALL) vim-common
|
2013-03-21 10:29:33 -07:00
|
|
|
touch $@
|
2013-03-19 10:01:21 -07:00
|
|
|
|
2012-11-28 13:58:14 -08:00
|
|
|
test: test-stamp
|
|
|
|
|
|
|
|
test-stamp: preparation source
|
2013-01-27 16:29:39 -08:00
|
|
|
cd ${GOPATH}/src/github.com/prometheus
|
2013-02-01 04:35:07 -08:00
|
|
|
$(MAKE) build
|
2012-11-28 13:58:14 -08:00
|
|
|
$(MAKE) test
|
|
|
|
touch $@
|
|
|
|
|
2013-02-01 04:35:07 -08:00
|
|
|
snappy-$(SNAPPY_VERSION).tar.gz: wget
|
|
|
|
$(WGET) http://snappy.googlecode.com/files/snappy-$(SNAPPY_VERSION).tar.gz
|
|
|
|
tar xzvf snappy-$(SNAPPY_VERSION).tar.gz
|
|
|
|
cd snappy-$(SNAPPY_VERSION) && ./configure --prefix="$(OVERLAY_ROOT)"
|
|
|
|
$(MAKE) -C snappy-$(SNAPPY_VERSION)
|
|
|
|
$(MAKE) -C snappy-$(SNAPPY_VERSION) install
|
|
|
|
|
|
|
|
snappy: snappy-stamp
|
|
|
|
tar xzvf snappy-$(SNAPPY_VERSION).tar.gz
|
|
|
|
|
|
|
|
snappy-stamp: cc overlay rsync snappy-$(SNAPPY_VERSION).tar.gz
|
|
|
|
touch $@
|
|
|
|
|
2012-11-28 13:58:14 -08:00
|
|
|
source: source-stamp
|
|
|
|
|
|
|
|
source-stamp:
|
2013-01-27 16:29:39 -08:00
|
|
|
-mkdir -vp ${GOPATH}/src/github.com/prometheus
|
|
|
|
ln -sf $${PWD} ${GOPATH}/src/github.com/prometheus/prometheus
|
2012-11-28 13:58:14 -08:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
clean:
|
|
|
|
-rm *-stamp
|
|
|
|
-rm -rf "$(OVERLAY_ROOT)"
|
2012-12-01 04:09:07 -08:00
|
|
|
-rm -rf leveldb-$(LEVELDB_VERSION)
|
|
|
|
-rm -rf protobuf-$(PROTOCOL_BUFFERS_VERSION)
|
2013-02-01 04:35:07 -08:00
|
|
|
-rm -rf snappy-$(SNAPPY_VERSION)
|
2012-12-01 04:09:07 -08:00
|
|
|
-rm leveldb-$(LEVELDB_VERSION).tar.gz
|
|
|
|
-rm protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2
|
2013-02-01 04:35:07 -08:00
|
|
|
-rm snappy-$(SNAPPY_VERSION).tar.gz
|
2012-11-28 13:58:14 -08:00
|
|
|
|
|
|
|
|
2013-03-19 10:01:21 -07:00
|
|
|
.PHONY: all bison build-dependencies cc clean go goprotobuf gorest instrumentation leveldb levigo mercurial overlay preparation protoc rsync snappy source test wget vim-common
|