Merge pull request #152 from prometheus/refactor/build/consolidated-build

New build system only.
This commit is contained in:
Matt T. Proud 2013-04-17 00:49:14 -07:00
commit 5d65b9392a
20 changed files with 512 additions and 223 deletions

4
.gitignore vendored
View file

@ -22,7 +22,5 @@ _cgo_*
core core
*-stamp *-stamp
leveldb-1.7.0*
protobuf-2.4.1*
snappy-1.0.5*
prometheus.build prometheus.build
prometheus

View file

@ -5,5 +5,4 @@ before_script:
- gvm use go1.0.3 || true - gvm use go1.0.3 || true
script: script:
- make -f Makefile.TRAVIS - make

View file

@ -11,22 +11,25 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
.SUFFIXES:
TEST_ARTIFACTS = prometheus prometheus.build search_index TEST_ARTIFACTS = prometheus prometheus.build search_index
include Makefile.INCLUDE
all: test all: test
test: build advice:
go test ./... $(GO_TEST_FLAGS) go tool vet .
build:
$(MAKE) -C model
$(MAKE) -C web
go build ./...
binary: build binary: build
go build -o prometheus.build go build -o prometheus.build
build: preparation model web
go build .
clean: clean:
$(MAKE) -C build clean
$(MAKE) -C model clean $(MAKE) -C model clean
$(MAKE) -C web clean $(MAKE) -C web clean
rm -rf $(TEST_ARTIFACTS) rm -rf $(TEST_ARTIFACTS)
@ -34,16 +37,46 @@ clean:
-find . -type f -iname '*#' -exec rm '{}' ';' -find . -type f -iname '*#' -exec rm '{}' ';'
-find . -type f -iname '.#*' -exec rm '{}' ';' -find . -type f -iname '.#*' -exec rm '{}' ';'
documentation: search_index
godoc -http=:6060 -index -index_files='search_index'
format: format:
find . -iname '*.go' | egrep -v "generated|\.(l|y)\.go" | xargs -n1 gofmt -w -s=true find . -iname '*.go' | egrep -v "generated|\.(l|y)\.go" | xargs -n1 gofmt -w -s=true
advice: model: preparation
go tool vet . $(MAKE) -C model
package: binary
cp prometheus.build build/package/prometheus
rsync -av build/root/lib/ build/package/lib/
preparation: source_path
$(MAKE) -C build
run: binary
./prometheus.build $(ARGUMENTS)
search_index: search_index:
godoc -index -write_index -index_files='search_index' godoc -index -write_index -index_files='search_index'
documentation: search_index # source_path is responsible for ensuring that the builder has not done anything
godoc -http=:6060 -index -index_files='search_index' # stupid like working on Prometheus outside of ${GOPATH}.
source_path:
-[ -d "$(FULL_GOPATH)" ] || { mkdir -vp $(FULL_GOPATH_BASE) ; ln -s "$(PWD)" "$(FULL_GOPATH)" ; }
[ -d "$(FULL_GOPATH)" ]
.PHONY: advice binary build clean documentation format search_index test test: build
go test ./appstate/... $(GO_TEST_FLAGS)
go test ./coding/... $(GO_TEST_FLAGS)
go test ./config/... $(GO_TEST_FLAGS)
go test ./model/... $(GO_TEST_FLAGS)
go test ./retrieval/... $(GO_TEST_FLAGS)
go test ./rules/... $(GO_TEST_FLAGS)
go test ./storage/... $(GO_TEST_FLAGS)
go test ./utility/... $(GO_TEST_FLAGS)
go test ./web/... $(GO_TEST_FLAGS)
web: preparation
$(MAKE) -C web
.PHONY: advice binary build clean documentation format model package preparation run search_index source_path test

54
Makefile.INCLUDE Normal file
View file

@ -0,0 +1,54 @@
# Copyright 2013 Prometheus Team
# 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.
.SUFFIXES:
# Set this to "false" to provide verbose builds of third-party components,
# namely C and C++ dependencies.
export SILENCE_THIRD_PARTY_BUILDS := true
ifeq ($(SILENCE_THIRD_PARTY_BUILDS), true)
export THIRD_PARTY_BUILD_OUTPUT := >/dev/null 2>&1
else
export THIRD_PARTY_BUILD_OUTPUT :=
endif
GO_VERSION := 1.0.3
LEVELDB_VERSION := 1.7.0
PROTOCOL_BUFFERS_VERSION := 2.4.1
SNAPPY_VERSION := 1.0.5
UNAME := $(shell uname)
FIRST_GOPATH := $(shell echo $${GOPATH} | awk -F':' '{ print $$1 }')
FULL_GOPATH := $(FIRST_GOPATH)/src/github.com/prometheus/prometheus
FULL_GOPATH_BASE := $(FIRST_GOPATH)/src/github.com/prometheus
export PREFIX=$(PWD)/build/root
export PATH := $(PREFIX)/bin:$(GOPATH)/bin:$(PATH)
export LD_LIBRARY_PATH := $(PREFIX)/lib:$(LD_LIBRARY_PATH)
export CFLAGS := $(CFLAGS) -I$(PREFIX)/include
export CXXFLAGS := $(CXXFLAGS) -I$(PREFIX)/include
export CPPFLAGS := $(CPPFLAGS) -I$(PREFIX)/include
export LDFLAGS := $(LDFLAGS) -L$(PREFIX)/lib
export PKG_CONFIG_PATH := $(PREFIX)/lib/pkgconfig:$(PKG_CONFIG_PATH)
export GO_TEST_FLAGS := "-v"
GO_GET := go get -u -v -x
APT_GET_INSTALL := sudo apt-get install -y
BREW_INSTALL := brew install
# By default, wget sets the creation time to match the server's, which throws
# off Make. :-(
WGET := wget --no-use-server-timestamps -c

View file

@ -1,194 +0,0 @@
# Copyright 2013 Prometheus Team
# 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.
GO_VERSION := 1.0.3
LEVELDB_VERSION := 1.7.0
PROTOCOL_BUFFERS_VERSION := 2.4.1
SNAPPY_VERSION := 1.0.5
OVERLAY_ROOT := ${HOME}/overlay_root
export PATH := $(PATH):$(OVERLAY_ROOT)/bin
export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(OVERLAY_ROOT)/lib
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
export CGO_CFLAGS := $(CFLAGS) -lsnappy
export CGO_LDFLAGS := $(LDFLAGS)
export GO_TEST_FLAGS := "-v"
GO_GET := go get -u -v -x
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
build-dependencies-stamp: bison cc go goprotobuf gorest goskiplist instrumentation leveldb levigo mercurial protoc
touch $@
overlay: overlay-stamp
overlay-stamp:
[ -d "$(OVERLAY_ROOT)" ] || mkdir -vp $(OVERLAY_ROOT)
touch $@
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
gvm install go$(GO_VERSION) || true
gvm use go$(GO_VERSION) || true
[ -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 $@
protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2: wget
$(WGET) http://protobuf.googlecode.com/files/$@
protoc: protoc-stamp
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
[ -x "$$(which protoc)" ]
touch $@
gorest: gorest-stamp
gorest-stamp: go source
$(GO_GET) code.google.com/p/gorest
touch $@
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 $@
instrumentation: instrumentation-stamp
instrumentation-stamp: go source
$(GO_GET) github.com/prometheus/client_golang
touch $@
leveldb: leveldb-stamp
leveldb-stamp: cc rsync leveldb-$(LEVELDB_VERSION).tar.gz snappy overlay
tar xzvf leveldb-$(LEVELDB_VERSION).tar.gz
$(MAKE) -C leveldb-$(LEVELDB_VERSION)
rsync -av "leveldb-$(LEVELDB_VERSION)/include/" "$(OVERLAY_ROOT)/include/"
-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/"
touch $@
leveldb-$(LEVELDB_VERSION).tar.gz: wget
$(WGET) http://leveldb.googlecode.com/files/leveldb-$(LEVELDB_VERSION).tar.gz
levigo: levigo-stamp
levigo-stamp: leveldb go snappy source
$(GO_GET) github.com/jmhodges/levigo
touch $@
goskiplist: goskiplist-stamp
goskiplist-stamp: go source
$(GO_GET) github.com/ryszard/goskiplist/skiplist
touch $@
rsync: rsync-stamp
rsync-stamp:
[ -x "$$(which rsync)" ] || $(APT_GET_INSTALL) rsync
vim-common: vim-common-stamp
vim-common-stamp:
$(APT_GET_INSTALL) vim-common
touch $@
test: test-stamp
test-stamp: preparation source
cd ${GOPATH}/src/github.com/prometheus
$(MAKE) build
$(MAKE) test
touch $@
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 $@
source: source-stamp
source-stamp:
-mkdir -vp ${GOPATH}/src/github.com/prometheus
ln -sf $${PWD} ${GOPATH}/src/github.com/prometheus/prometheus
touch $@
clean:
-rm *-stamp
-rm -rf "$(OVERLAY_ROOT)"
-rm -rf leveldb-$(LEVELDB_VERSION)
-rm -rf protobuf-$(PROTOCOL_BUFFERS_VERSION)
-rm -rf snappy-$(SNAPPY_VERSION)
-rm leveldb-$(LEVELDB_VERSION).tar.gz
-rm protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2
-rm snappy-$(SNAPPY_VERSION).tar.gz
.PHONY: all bison build-dependencies cc clean go goprotobuf gorest instrumentation leveldb levigo mercurial overlay preparation protoc rsync snappy source test wget vim-common

112
README.md
View file

@ -14,29 +14,121 @@ intervals, evaluate rule expressions, display the results, and trigger an
action if some condition is observed to be true. action if some condition is observed to be true.
## Prerequisites ## Prerequisites
If you read below in the _Getting Started_ section, the build infrastructure
will take care of the following things for you in most cases:
1. Go 1.0.X. [GVM](https://github.com/moovweb/gvm) is highly recommended as well. 1. Go 1.0.3.
2. LevelDB: (https://code.google.com/p/leveldb/). 2. GVM: [https://github.com/moovweb/gvm](https://github.com/moovweb/gvm) is highly recommended as well.
3. Protocol Buffers Compiler: (http://code.google.com/p/protobuf/). 3. LevelDB: [https://code.google.com/p/leveldb/](https://code.google.com/p/leveldb/).
4. goprotobuf: the code generator and runtime library: (http://code.google.com/p/goprotobuf/). 4. Protocol Buffers Compiler: [http://code.google.com/p/protobuf/](http://code.google.com/p/protobuf/).
5. Levigo, a Go-wrapper around LevelDB's C library: (https://github.com/jmhodges/levigo). 5. goprotobuf: the code generator and runtime library: [http://code.google.com/p/goprotobuf/](http://code.google.com/p/goprotobuf/).
6. GoRest, a RESTful style web-services framework: (http://code.google.com/p/gorest/). 6. Levigo, a Go-wrapper around LevelDB's C library: [https://github.com/jmhodges/levigo](https://github.com/jmhodges/levigo).
7. Prometheus Client, Prometheus in Prometheus (https://github.com/prometheus/client_golang). 7. GoRest, a RESTful style web-services framework: [http://code.google.com/p/gorest/](http://code.google.com/p/gorest/).
8. Snappy, a compression library for LevelDB and Levigo (http://code.google.com/p/snappy/). 8. Prometheus Client, Prometheus in Prometheus [https://github.com/prometheus/client_golang](https://github.com/prometheus/client_golang).
9. Snappy, a compression library for LevelDB and Levigo [http://code.google.com/p/snappy/](http://code.google.com/p/snappy/).
## Getting Started ## Getting Started
For basic help how to get started: For basic help how to get started:
* The source code is periodically indexed: [Prometheus Core](http://godoc.org/github.com/prometheus/prometheus). * The source code is periodically indexed: [Prometheus Core](http://godoc.org/github.com/prometheus/prometheus).
* For Linux users, please consult the Travis CI configuration in _.travis.yml_ and _Makefile.TRAVIS_. * For UNIX-like environment users users, please consult the Travis CI configuration in _.travis.yml_ and _Makefile_.
* [Getting started on Mac OSX](documentation/guides/getting-started-osx.md)
* All of the core developers are accessible via the [Prometheus Developers Mailinglist](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). * All of the core developers are accessible via the [Prometheus Developers Mailinglist](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
### Working with GVM
Starting out, the following workflow is advised:
$ gvm install go1.0.3
$ gvm use go1.0.3
$ gvm pkgset create prometheus
$ gvm pkgset use prometheus
This is mainly due to the fact that it allows the user to partition the
compile-time side-effects from the rest of one's work environment, particularly
``${GOPATH}``.
Read below in the _General_ section.
### Not Using GVM
It is entirely possible to build Prometheus without ``gvm``. I presently do not
advise taking this route due to build environment pollution both against
Prometheus and from its build infrastructure onto the system---namely
``${GOPATH}``.
If you really want to avoid GVM, execute the following:
$ touch build/gvm-stamp
Read below in the _General_ section.
### General
For first time users, simply run the following:
$ make
If you run into problems, try the following:
$ SILENCE_THIRD_PARTY_BUILDS=false make
Upon having a satisfactory build, it's possible to create an artifact for
end-user distribution:
$ make package
$ find build/package
``build/package`` will be sufficient for whatever archiving mechanism you
choose. The important thing to note is that Go presently does not
staticly link against C dependency libraries, so including the ``lib``
directory is paramount. Providing ``LD_LIBRARY_PATH`` or
``DYLD_LIBRARY_PATH`` in a scaffolding shell script is advised.
Executing the following target will start up Prometheus for lazy users:
$ ARGUMENTS="-foo -bar -baz" make run
``${ARGUMENTS}`` is passed verbatim into the makefile and thusly Prometheus as
``$(ARGUMENTS)``. This is useful for quick one-off invocations and smoke
testing.
### Mac OS X
We have a handy [Getting started on Mac OS X](documentation/guides/getting-started-osx.md) guide.
### Problems
If at any point you run into an error with the ``make`` build system in terms of
its not properly scaffolding things on a given environment, please file a bug or
open a pull request with your changes if you can fix it yourself.
Please note that we're explicitly shooting for stable runtime environments and
not the latest-whiz bang releases; thusly, we ask you to provide ample
architecture and release identification remarks for us.
## Testing ## Testing
$ make test
[![Build Status](https://travis-ci.org/prometheus/prometheus.png)](https://travis-ci.org/prometheus/prometheus) [![Build Status](https://travis-ci.org/prometheus/prometheus.png)](https://travis-ci.org/prometheus/prometheus)
## Contributing
1. To start, reach out via our mailing list (mentioned above) and ask us what
the current priorities are. We can find a good isolated starter project for
you.
2. Keeping code hygiene is important. We thusly have a practical preference
for the following:
1. Run ``make format`` to ensure the correctness of the Go code's layout.
2. Run ``make advice`` to find facial errors with a static analyzer.
3. Try to capture your changes in some form of a test. Go makes it easy to
write [Table Driven Tests](https://code.google.com/p/go-wiki/wiki/TableDrivenTests).
There is no mandate to use this said scaffolding mechanism, but it _can_
make your life easier in the right circumstances.
3. Welcome aboard!
## License ## License
Apache License 2.0 Apache License 2.0

184
build/Makefile Normal file
View file

@ -0,0 +1,184 @@
# Copyright 2013 Prometheus Team
# 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.
.SUFFIXES:
include ../Makefile.INCLUDE
all: dependencies-stamp
bison-stamp: bison-implementation-$(UNAME)-stamp
[ -x "$$(which bison)" ] || { echo "bison not found." ; false ; }
touch $@
bison-implementation-Darwin-stamp:
[ -x "$$(which bison)" ] || $(BREW_INSTALL) bison
touch $@
bison-implementation-Linux-stamp:
[ -x "$$(which bison)" ] || $(APT_GET_INSTALL) bison
touch $@
cache-stamp:
$(MAKE) -C cache
touch $@
cc-stamp: cc-implementation-$(UNAME)-stamp
[ -x "$$(which cc)" ] || { echo "cc not found." ; false ; }
touch $@
cc-implementation-Darwin-stamp:
[ -x "$$(which cc)" ] || { echo "Install XCode?" ; false ; }
touch $@
cc-implementation-Linux-stamp:
[ -x "$$(which cc)" ] || $(APT_GET_INSTALL) build-essential
touch $@
dependencies-stamp: cache-stamp go-stamp goprotobuf-stamp gorest-stamp goskiplist-stamp instrumentation-stamp levigo-stamp
touch $@
go-stamp: gvm-stamp
[ -x "$$(which go)" ] || { echo "go not found." ; false ; }
touch $@
goprotobuf-stamp: go-stamp mercurial-stamp protoc-stamp
$(GO_GET) code.google.com/p/goprotobuf/proto $(THIRD_PARTY_BUILD_OUTPUT)
$(GO_GET) code.google.com/p/goprotobuf/protoc-gen-go $(THIRD_PARTY_BUILD_OUTPUT)
touch $@
gorest-stamp: go-stamp
$(GO_GET) code.google.com/p/gorest $(THIRD_PARTY_BUILD_OUTPUT)
touch $@
goskiplist-stamp: go-stamp
$(GO_GET) github.com/ryszard/goskiplist/skiplist $(THIRD_PARTY_BUILD_OUTPUT)
touch $@
gvm-stamp: bison-stamp cc-stamp mercurial-stamp
[ -x "$$(which gvm)" ] || { echo "gvm not found; install manually from https://github.com/moovweb/gvm." ; false ; }
-gvm install go$(GO_VERSION)
#
# ********** **********
# gvm installed go$(GO_VERSION) if it did not exist already.
#
# Prometheus expects go$(GO_VERSION) to be used for building.
# This can be achieved by running ``gvm use go$(GO_VERSION)`` before any
# other Prometheus make tools.
#
# Once this build finishes, $(GOPATH) will be mutated and
# contain some new packages. Here is an example workflow:
#
# $ gvm install go$(GO_VERSION)
# $ gvm use go$(GO_VERSION)
# $ gvm pkgset create prometheus
# $ gvm pkgset use prometheus
#
# ********** **********
#
-[ -z "${CI}" ] && read -p "Press [ENTER] upon reading." _
touch $@
instrumentation-stamp: go-stamp
$(GO_GET) github.com/prometheus/client_golang $(THIRD_PARTY_BUILD_OUTPUT)
touch $@
leveldb-stamp: cache-stamp cache/leveldb-$(LEVELDB_VERSION).tar.gz cc-stamp rsync-stamp snappy-stamp
tar xzvf cache/leveldb-$(LEVELDB_VERSION).tar.gz -C dirty $(THIRD_PARTY_BUILD_OUTPUT)
# The test that LevelDB uses to test for Snappy is naive and
# does not respect LDFLAGS. :-(
CXXFLAGS="$(CXXFLAGS) -lsnappy $(LDFLAGS)" LDFLAGS="-lsnappy $(LDFLAGS)" $(MAKE) -C dirty/leveldb-$(LEVELDB_VERSION) $(THIRD_PARTY_BUILD_OUTPUT)
rsync -av "dirty/leveldb-$(LEVELDB_VERSION)/include/" "$(PREFIX)/include/" $(THIRD_PARTY_BUILD_OUTPUT)
-[ "$(UNAME)" = "Linux" ] && { rsync -av "dirty/leveldb-$(LEVELDB_VERSION)/"*.*so* "$(PREFIX)/lib/" ; } $(THIRD_PARTY_BUILD_OUTPUT) $(THIRD_PARTY_BUILD_OUTPUT)
-[ "$(UNAME)" = "Darwin" ] && { rsync -av "dirty/leveldb-$(LEVELDB_VERSION)/"*.*dylib* "$(PREFIX)/lib/" ; } $(THIRD_PARTY_BUILD_OUTPUT)
rsync -av "dirty/leveldb-$(LEVELDB_VERSION)/"*.a "$(PREFIX)/lib/" $(THIRD_PARTY_BUILD_OUTPUT)
touch $@
levigo-stamp: cc-stamp go-stamp leveldb-stamp snappy-stamp
CGO_CFLAGS="-I$(PREFIX)/include" CGO_LDFLAGS="-L$(PREFIX)/lib" $(GO_GET) github.com/jmhodges/levigo $(THIRD_PARTY_BUILD_OUTPUT)
touch $@
libunwind-stamp:
$(APT_GET_INSTALL) libunwind7
$(APT_GET_INSTALL) libunwind7-dev
touch $@
mercurial-implementation-Darwin-stamp:
[ -x "$$(which hg)" ] || $(BREW_INSTALL) mercurial
touch $@
mercurial-implementation-Linux-stamp:
[ -x "$$(which hg)" ] || $(APT_GET_INSTALL) mercurial
touch $@
mercurial-stamp: mercurial-implementation-$(UNAME)-stamp
[ -x "$$(which hg)" ] || { echo "hg not found." ; false ; }
touch $@
noop-target-stamp:
echo "Not doing anything."
touch $@
protoc-stamp: cache-stamp cache/protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2 cc-stamp
tar xjvf cache/protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2 -C dirty $(THIRD_PARTY_BUILD_OUTPUT)
cd dirty/protobuf-$(PROTOCOL_BUFFERS_VERSION) && ./configure --prefix="$(PREFIX)" $(THIRD_PARTY_BUILD_OUTPUT)
$(MAKE) -C dirty/protobuf-$(PROTOCOL_BUFFERS_VERSION) $(THIRD_PARTY_BUILD_OUTPUT)
$(MAKE) -C dirty/protobuf-$(PROTOCOL_BUFFERS_VERSION) install $(THIRD_PARTY_BUILD_OUTPUT)
[ -x "$$(which protoc)" ] || { echo "protoc not found." ; false ; }
touch $@
rsync-implementation-Darwin-stamp:
[ -x "$$(which rsync)" ] || $(BREW_INSTALL) rsync
touch $@
rsync-implementation-Linux-stamp:
[ -x "$$(which rsync)" ] || $(APT_GET_INSTALL) rsync
rsync-stamp: rsync-implementation-$(UNAME)-stamp
[ -x "$$(which rsync)" ] || { echo "rsync not found." ; false ; }
touch $@
snappy-stamp: cache-stamp cache/snappy-$(SNAPPY_VERSION).tar.gz cc-stamp
tar xzvf cache/snappy-$(SNAPPY_VERSION).tar.gz -C dirty $(THIRD_PARTY_BUILD_OUTPUT)
cd dirty/snappy-$(SNAPPY_VERSION) && ./configure --prefix="$(PREFIX)" $(THIRD_PARTY_BUILD_OUTPUT)
$(MAKE) -C dirty/snappy-$(SNAPPY_VERSION) $(THIRD_PARTY_BUILD_OUTPUT)
$(MAKE) -C dirty/snappy-$(SNAPPY_VERSION) install $(THIRD_PARTY_BUILD_OUTPUT)
touch $@
ifeq ($(UNAME), Linux)
stack-unwind-support-stamp: libunwind-stamp
touch $@
else
stack-unwind-support-stamp: noop-target-stamp
touch $@
endif
vim-implementation-Darwin-stamp:
[ -x "$$(which vim)" ] || $(BREW_INSTALL) vim
touch $@
vim-implementation-Linux-stamp:
[ -x "$$(which vim)" ] || $(APT_GET_INSTALL) vim
touch $@
vim-stamp: vim-implementation-$(UNAME)-stamp
touch $@
clean:
$(MAKE) -C cache clean
$(MAKE) -C dirty clean
$(MAKE) -C root clean
rm -rf *-stamp
.PHONY: clean

2
build/cache/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.gz
*.bz2

48
build/cache/Makefile vendored Normal file
View file

@ -0,0 +1,48 @@
# Copyright 2013 Prometheus Team
# 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.
.SUFFIXES:
include ../../Makefile.INCLUDE
all: populate
populate: leveldb-$(LEVELDB_VERSION).tar.gz protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2 snappy-$(SNAPPY_VERSION).tar.gz
leveldb-$(LEVELDB_VERSION).tar.gz: wget-stamp
$(WGET) http://leveldb.googlecode.com/files/leveldb-$(LEVELDB_VERSION).tar.gz
protobuf-$(PROTOCOL_BUFFERS_VERSION).tar.bz2: wget-stamp
$(WGET) http://protobuf.googlecode.com/files/$@
snappy-$(SNAPPY_VERSION).tar.gz: wget-stamp
$(WGET) http://snappy.googlecode.com/files/snappy-$(SNAPPY_VERSION).tar.gz
wget-implementation-Darwin-stamp:
[ -x "$$(which wget)" ] || $(BREW_INSTALL) wget-stamp
touch $@
wget-implementation-Linux-stamp:
[ -x "$$(which wget)" ] || $(APT_GET_INSTALL) wget-stamp
touch $@
wget-stamp: wget-implementation-$(UNAME)-stamp
[ -x "$$(which wget)" ] || { echo "wget not found." ; false ; }
touch $@
clean:
-[ -n "$(REALLY_CLEAN)" ] && rm -rf *.bz2
-[ -n "$(REALLY_CLEAN)" ] && rm -rf *.gz
rm -rf *-stamp
.PHONY: clean populate

1
build/dirty/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*

22
build/dirty/Makefile Normal file
View file

@ -0,0 +1,22 @@
# Copyright 2013 Prometheus Team
# 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.
.SUFFIXES:
include ../../Makefile.INCLUDE
all:
clean:
rm -rf *
git checkout .

1
build/package/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*

22
build/package/Makefile Normal file
View file

@ -0,0 +1,22 @@
# Copyright 2013 Prometheus Team
# 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.
.SUFFIXES:
include ../../Makefile.INCLUDE
all:
clean:
rm -rf *
git checkout .

1
build/package/lib/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*

22
build/root/Makefile Normal file
View file

@ -0,0 +1,22 @@
# Copyright 2013 Prometheus Team
# 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.
.SUFFIXES:
include ../../Makefile.INCLUDE
all:
clean:
rm -rf *
git checkout .

1
build/root/bin/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*

1
build/root/include/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*

1
build/root/lib/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*

View file

@ -13,8 +13,6 @@
MAKE_ARTIFACTS = generated-stamp MAKE_ARTIFACTS = generated-stamp
export PATH := $(PATH):/Users/mtp/Development/go/bin
all: generated all: generated
generated: generated-stamp generated: generated-stamp

View file

@ -1 +1,4 @@
*.cc
*.go *.go
*.h
*.o