Merge pull request #298 from prometheus/refactor/build/cleanups

Trailing build system cleanups.
This commit is contained in:
Matt T. Proud 2013-06-13 06:50:46 -07:00
commit 2a9957ea07
9 changed files with 32 additions and 62 deletions

2
.gitignore vendored
View File

@ -29,5 +29,3 @@ command-line-arguments.test
*BASE*
*LOCAL*
*REMOTE*
build/root
tools/dumper/dumper

View File

@ -5,15 +5,6 @@ language: go
go:
- 1.1
# Explicitly stop before_script from doing anything by giving 'em nil work.
before_script:
- echo "Before Script"
# Explicitly stop install from doing anything by giving 'em nil work.
install:
- echo "Install"
script:
- echo "Script"
- cd ${TRAVIS_BUILD_DIR}
- bash -l ./tests-for-die-in-a-fire-travis.sh

View File

@ -17,13 +17,20 @@ include Makefile.INCLUDE
all: binary test
$(GOCC): build/cache/$(GOPKG)
tar -C build/root -xzf $<
touch $@
advice:
$(GO) tool vet .
binary: build
$(GO) build -o prometheus $(BUILDFLAGS) .
build: preparation config model tools web
build: config dependencies model preparation tools web
build/cache/$(GOPKG):
curl -o $@ http://go.googlecode.com/files/$(GOPKG)
clean:
$(MAKE) -C build clean
@ -34,23 +41,19 @@ clean:
-find . -type f -iname '*#' -exec rm '{}' ';'
-find . -type f -iname '.#*' -exec rm '{}' ';'
config: preparation
config: dependencies preparation
$(MAKE) -C config
dependencies: preparation
$(GO) get -d
documentation: search_index
godoc -http=:6060 -index -index_files='search_index'
format:
find . -iname '*.go' | egrep -v "generated|\.(l|y)\.go" | xargs -n1 $(GOFMT) -w -s=true
build/cache/$(GOPKG):
curl -o $@ http://go.googlecode.com/files/$(GOPKG)
$(GOCC): build/cache/$(GOPKG)
tar -C build/root -xzf $<
touch $@
model: preparation
model: dependencies preparation
$(MAKE) -C model
package: binary
@ -61,7 +64,7 @@ preparation: $(GOCC) source_path
$(MAKE) -C build
race_condition_binary: build
CGO_CFLAGS="-I$(PWD)/build/root/include" CGO_LDFLAGS="-L$(PWD)/build/root/lib" go build -race -o prometheus.race $(BUILDFLAGS) .
CGO_CFLAGS="-I$(PWD)/build/root/include" CGO_LDFLAGS="-L$(PWD)/build/root/lib" $(GO) build -race -o prometheus.race $(BUILDFLAGS) .
race_condition_run: race_condition_binary
./prometheus.race $(ARGUMENTS)
@ -72,7 +75,7 @@ run: binary
search_index:
godoc -index -write_index -index_files='search_index'
server: config model preparation
server: config dependencies model preparation
$(MAKE) -C server
# source_path is responsible for ensuring that the builder has not done anything
@ -85,10 +88,10 @@ test: build
$(GOENV) find . -maxdepth 1 -mindepth 1 -type d -and -not -path ./build -exec $(GOCC) test {}/... $(GO_TEST_FLAGS) \;
$(GO) test $(GO_TEST_FLAGS)
tools:
tools: dependencies preparation
$(MAKE) -C tools
web: preparation config model
web: config dependencies model preparation
$(MAKE) -C web
.PHONY: advice binary build clean config documentation format model package preparation race_condition_binary race_condition_run run search_index source_path test tools
.PHONY: advice binary build clean config dependencies documentation format model package preparation race_condition_binary race_condition_run run search_index source_path test tools

View File

@ -61,6 +61,9 @@ export CPPFLAGS := $(CPPFLAGS) -I$(PREFIX)/include
export LDFLAGS := $(LDFLAGS) -L$(PREFIX)/lib
export PKG_CONFIG_PATH := $(PREFIX)/lib/pkgconfig:$(PKG_CONFIG_PATH)
export CGO_CFLAGS = $(CFLAGS)
export CGO_LDFLAGS = $(LDFLAGS)
export GO_TEST_FLAGS := "-v"
GO_GET := $(GO) get -u -v -x

View File

@ -105,6 +105,10 @@ architecture and release identification remarks for us.
$ make test
## Packaging
$ make package
### Race Detector
Go 1.1 includes a [race

1
build/.gitignore vendored
View File

@ -1 +1,2 @@
build/
root/

View File

@ -45,34 +45,17 @@ cc-implementation-Linux-stamp:
[ -x "$$(which cc)" ] || $(APT_GET_INSTALL) build-essential
touch $@
dependencies-stamp: cache-stamp go-stamp goprotobuf-protoc-gen-go-stamp gorest-stamp goskiplist-stamp instrumentation-stamp levigo-stamp
touch $@
go-stamp:
[ -x "$$(which go)" ] || { echo "go not found." ; false ; }
dependencies-stamp: cache-stamp cc-stamp leveldb-stamp snappy-stamp
touch $@
goprotobuf-protoc-gen-go-stamp: protoc-stamp goprotobuf-stamp
$(GO_GET) code.google.com/p/goprotobuf/protoc-gen-go $(THIRD_PARTY_BUILD_OUTPUT)
touch $@
goprotobuf-stamp: go-stamp protoc-stamp mercurial-stamp
goprotobuf-stamp: protoc-stamp
$(GO_GET) code.google.com/p/goprotobuf/proto $(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 $@
instrumentation-stamp: go-stamp
$(GO_GET) github.com/prometheus/client_golang/prometheus $(THIRD_PARTY_BUILD_OUTPUT)
$(GO_GET) github.com/prometheus/client_golang/prometheus/exp $(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)
cd dirty/leveldb-$(LEVELDB_VERSION) && CFLAGS="$(CFLAGS) -lsnappy" CXXFLAGS="$(CXXFLAGS) -lsnappy $(LDFLAGS)" LDFLAGS="-lsnappy $(LDFLAGS)" bash -x ./build_detect_platform build_config.mk ./
@ -85,27 +68,11 @@ leveldb-stamp: cache-stamp cache/leveldb-$(LEVELDB_VERSION).tar.gz cc-stamp rsyn
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 $@

View File

@ -24,4 +24,5 @@ include ../Makefile.INCLUDE
generated/config.pb.go: config.proto
$(PROTOC) --proto_path=$(PREFIX)/include:. --go_out=generated/ config.proto
$(MAKE) -C ../build goprotobuf-protoc-gen-go-stamp
$(PROTOC) --proto_path=$(PREFIX)/include:. --go_out=generated/ config.proto

View File

@ -23,7 +23,9 @@ include ../Makefile.INCLUDE
# make -C build goprotobuf-protoc-gen-go-stamp
generated/data.pb.go: data.proto
$(MAKE) -C ../build goprotobuf-protoc-gen-go-stamp
$(PROTOC) --proto_path=$(PREFIX)/include:. --include_imports --go_out=generated/ --descriptor_set_out=generated/descriptor.blob data.proto
generated/descriptor.blob: data.proto
$(MAKE) -C ../build goprotobuf-protoc-gen-go-stamp
$(PROTOC) --proto_path=$(PREFIX)/include:. --include_imports --go_out=generated/ --descriptor_set_out=generated/descriptor.blob data.proto