2013-11-20 20:53:43 +00:00
|
|
|
SHELL = /bin/bash
|
|
|
|
|
2014-06-20 03:28:56 +00:00
|
|
|
ifeq ($(TMPDIR),)
|
|
|
|
TMPDIR=/tmp
|
|
|
|
endif
|
|
|
|
export TMPDIR
|
|
|
|
|
2013-11-20 20:53:43 +00:00
|
|
|
PROTOC = @PROTOC@
|
|
|
|
GO = @GO@
|
2014-06-23 18:43:49 +00:00
|
|
|
GOFMT = @GOFMT@
|
2013-11-26 21:04:07 +00:00
|
|
|
GOROOT = @GOROOT@
|
2014-06-19 14:21:40 +00:00
|
|
|
AUTORECONF = @AUTORECONF@
|
2014-07-15 19:46:56 +00:00
|
|
|
LRT_LDFLAG = @LRT_LDFLAG@
|
2014-04-24 09:32:33 +00:00
|
|
|
# or 386, arm
|
2013-11-20 20:53:43 +00:00
|
|
|
arch = amd64
|
|
|
|
CGO_ENABLED = 1
|
|
|
|
|
2013-11-26 21:04:07 +00:00
|
|
|
ifneq ($(GOROOT),)
|
|
|
|
export GOROOT
|
|
|
|
endif
|
|
|
|
|
2013-11-20 20:53:43 +00:00
|
|
|
cflags =
|
|
|
|
ifeq ($(arch),386)
|
|
|
|
cflags = -m32
|
2014-04-24 09:32:33 +00:00
|
|
|
else
|
|
|
|
ifeq ($(arch),arm)
|
|
|
|
cflags = -fpic
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(arch),)
|
2013-11-20 20:53:43 +00:00
|
|
|
GOARCH = $(arch)
|
|
|
|
endif
|
|
|
|
|
2014-04-24 09:32:33 +00:00
|
|
|
ifneq ($(CROSS_COMPILE),)
|
|
|
|
export CXX=$(CROSS_COMPILE)-g++
|
|
|
|
export CC=$(CROSS_COMPILE)-gcc
|
|
|
|
export AS=$(CROSS_COMPILE)-as
|
|
|
|
export AR=$(CROSS_COMPILE)-ar
|
|
|
|
export NM=$(CROSS_COMPILE)-nm
|
|
|
|
export LD=$(CROSS_COMPILE)-ld
|
|
|
|
export OBJDUMP=$(CROSS_COMPILE)-objdump
|
|
|
|
export OBJCOPY=$(CROSS_COMPILE)-objcopy
|
|
|
|
export RANLIB=$(CROSS_COMPILE)-ranlib
|
|
|
|
export STRIP=$(CROSS_COMPILE)-strip
|
|
|
|
export CXX_FOR_TARGET=$(CROSS_COMPILE)-g++
|
|
|
|
export CC_FOR_TARGET=$(CROSS_COMPILE)-gcc
|
|
|
|
GO_BUILD_OPTIONS += -ldflags="-extld=$(CC)"
|
|
|
|
cross_flags = --host=$(arch)
|
|
|
|
endif
|
|
|
|
|
2013-11-20 20:53:43 +00:00
|
|
|
export GOARCH
|
|
|
|
export CGO_ENABLED
|
|
|
|
|
2014-06-27 14:53:49 +00:00
|
|
|
.PHONY: all valgrind parser package replace_version_string build binary_package dependencies clean
|
2013-11-20 20:53:43 +00:00
|
|
|
|
2013-12-04 17:35:41 +00:00
|
|
|
all: | parser valgrind build test integration_test
|
|
|
|
|
|
|
|
parser:
|
2014-06-27 16:57:06 +00:00
|
|
|
$(MAKE) -C parser
|
2013-11-20 20:53:43 +00:00
|
|
|
|
2014-07-22 16:31:35 +00:00
|
|
|
root := $(shell pwd)/../../../..
|
2014-06-27 16:57:06 +00:00
|
|
|
ifeq ($(GOPATH),)
|
2014-07-22 16:31:35 +00:00
|
|
|
GOPATH := $(root)
|
2013-11-20 20:53:43 +00:00
|
|
|
export GOPATH
|
2014-06-27 16:57:06 +00:00
|
|
|
endif
|
2013-11-20 20:53:43 +00:00
|
|
|
uname_S = $(shell sh -c "uname -s 2>/dev/null || echo not")
|
|
|
|
|
2013-12-18 20:28:53 +00:00
|
|
|
valgrind:
|
|
|
|
ifeq ($(uname_S),Linux)
|
2014-06-27 16:57:06 +00:00
|
|
|
$(MAKE) -C parser valgrind
|
2013-12-18 20:28:53 +00:00
|
|
|
endif
|
|
|
|
|
2013-11-20 20:53:43 +00:00
|
|
|
# packages
|
2014-06-27 16:57:06 +00:00
|
|
|
packages_base = admin api/http api/graphite cluster common configuration \
|
2014-04-07 20:37:29 +00:00
|
|
|
checkers coordinator datastore engine parser protocol wal
|
2014-06-27 16:57:06 +00:00
|
|
|
build_packages = $(addprefix github.com/influxdb/influxdb/,$(packages_base))
|
|
|
|
test_packages =
|
|
|
|
ifneq ($(packages),)
|
|
|
|
test_packages = $(addprefix github.com/influxdb/influxdb/,$(packages))
|
|
|
|
else
|
|
|
|
test_packages = $(build_packages)
|
|
|
|
endif
|
2013-11-20 20:53:43 +00:00
|
|
|
|
2014-06-18 19:09:48 +00:00
|
|
|
# Storage engines libraries
|
|
|
|
|
2013-11-20 20:53:43 +00:00
|
|
|
# snappy variables
|
|
|
|
snappy_version = 1.1.0
|
2014-06-20 03:28:56 +00:00
|
|
|
snappy_dir = ${TMPDIR}/snappy.influxdb.$(arch)
|
2013-11-20 20:53:43 +00:00
|
|
|
snappy_file = snappy-$(snappy_version).tar.gz
|
|
|
|
snappy_deps = $(snappy_dir)/.libs/libsnappy.a
|
|
|
|
|
|
|
|
# leveldb variables
|
2014-04-01 15:48:07 +00:00
|
|
|
leveldb_version = 1.15.0
|
2014-06-20 03:28:56 +00:00
|
|
|
leveldb_dir = ${TMPDIR}/leveldb.influxdb.$(arch)
|
2013-11-20 20:53:43 +00:00
|
|
|
leveldb_file = leveldb-$(leveldb_version).tar.gz
|
|
|
|
leveldb_deps = $(leveldb_dir)/libleveldb.a
|
|
|
|
|
2014-06-19 14:27:54 +00:00
|
|
|
cpp_47 = $(shell g++ -dumpversion | gawk '{print $$1>=4.7?"1":"0"}')
|
2014-06-19 14:21:40 +00:00
|
|
|
rocksdb = yes
|
|
|
|
ifneq ($(cpp_47),1)
|
2014-06-18 19:09:48 +00:00
|
|
|
rocksdb = no
|
2014-06-19 14:21:40 +00:00
|
|
|
endif
|
|
|
|
|
2014-06-18 19:09:48 +00:00
|
|
|
ifeq ($(rocksdb),yes)
|
2014-06-17 15:26:33 +00:00
|
|
|
# rocksdb variables
|
2014-07-16 00:50:11 +00:00
|
|
|
rocksdb_version = d916593eadfa838001b2d2991ae182cf5f0ac01e
|
2014-06-20 03:28:56 +00:00
|
|
|
rocksdb_dir = ${TMPDIR}/rocksdb.influxdb.$(arch)
|
2014-07-16 00:50:11 +00:00
|
|
|
rocksdb_file = $(rocksdb_version).tar.gz
|
2014-06-17 15:26:33 +00:00
|
|
|
rocksdb_deps = $(rocksdb_dir)/librocksdb.a
|
2014-06-18 19:09:48 +00:00
|
|
|
endif
|
2014-06-17 15:26:33 +00:00
|
|
|
|
2014-06-17 19:00:47 +00:00
|
|
|
# hyperleveldb variables
|
|
|
|
hyperleveldb_version = v1.0.3
|
2014-06-20 03:28:56 +00:00
|
|
|
hyperleveldb_dir = ${TMPDIR}/hyperleveldb.influxdb.$(arch)
|
2014-06-17 19:00:47 +00:00
|
|
|
hyperleveldb_file = $(hyperleveldb_version).tar.gz
|
|
|
|
hyperleveldb_deps = $(hyperleveldb_dir)/.libs/libhyperleveldb.a
|
|
|
|
|
2014-02-04 17:16:23 +00:00
|
|
|
profile=off
|
|
|
|
ifneq ($(profile),off)
|
2014-06-21 21:43:02 +00:00
|
|
|
GO_BUILD_TAGS += profile
|
2014-02-04 17:16:23 +00:00
|
|
|
endif
|
|
|
|
|
2013-11-20 20:53:43 +00:00
|
|
|
# levigo flags
|
2013-11-26 19:08:51 +00:00
|
|
|
ifeq ($(uname_S),Linux)
|
2014-06-27 16:57:06 +00:00
|
|
|
storage_engines += $(hyperleveldb_deps)
|
2014-06-21 21:43:02 +00:00
|
|
|
GO_BUILD_TAGS += hyperleveldb
|
2014-06-18 19:09:48 +00:00
|
|
|
ifeq ($(rocksdb),yes)
|
2014-06-21 21:43:02 +00:00
|
|
|
GO_BUILD_TAGS += rocksdb
|
2014-06-27 16:57:06 +00:00
|
|
|
storage_engines += $(rocksdb_deps)
|
2014-06-18 19:09:48 +00:00
|
|
|
CGO_CFLAGS += -I$(rocksdb_dir)/include
|
2014-07-15 19:46:56 +00:00
|
|
|
CGO_LDFLAGS += -L$(rocksdb_dir) -lrocksdb $(LRT_LDFLAG)
|
2014-06-18 19:09:48 +00:00
|
|
|
endif
|
|
|
|
CGO_CFLAGS += -I$(leveldb_dir)/include -I$(hyperleveldb_dir)/include
|
2014-06-27 14:53:49 +00:00
|
|
|
CGO_LDFLAGS += -L$(leveldb_dir) -L$(hyperleveldb_dir)/.libs -L$(snappy_dir)/.libs -lleveldb -lhyperleveldb -lsnappy
|
2014-07-16 00:50:11 +00:00
|
|
|
CPPLIB = $(shell g++ $(cflags) --print-file-name=libstdc++.a)
|
|
|
|
CGO_LDFLAGS += -lm -lz -lbz2 $(CPPLIB)
|
2013-11-20 20:53:43 +00:00
|
|
|
export CGO_CFLAGS
|
|
|
|
export CGO_LDFLAGS
|
2013-11-26 19:08:51 +00:00
|
|
|
else
|
2014-06-19 14:27:54 +00:00
|
|
|
CGO_LDFLAGS += -lleveldb -lsnappy -lstdc++
|
2013-11-26 19:08:51 +00:00
|
|
|
export CGO_LDFLAGS
|
|
|
|
endif
|
|
|
|
|
2014-06-21 21:43:02 +00:00
|
|
|
ifneq ($(GO_BUILD_TAGS),)
|
|
|
|
GO_BUILD_OPTIONS += -tags '$(GO_BUILD_TAGS)'
|
|
|
|
endif
|
2014-07-10 21:59:45 +00:00
|
|
|
race = off
|
|
|
|
ifneq ($(race),off)
|
|
|
|
GO_BUILD_OPTIONS += -race
|
|
|
|
endif
|
2014-06-21 21:43:02 +00:00
|
|
|
|
2013-11-26 19:08:51 +00:00
|
|
|
ifneq ($(uname_S),Linux)
|
|
|
|
PYTHONPATH ?= /usr/local/lib/python2.7/site-packages/
|
|
|
|
export PYTHONPATH
|
|
|
|
endif
|
2013-11-20 20:53:43 +00:00
|
|
|
|
|
|
|
$(snappy_deps):
|
|
|
|
ifeq ($(uname_S),Linux)
|
|
|
|
rm -rf $(snappy_dir)
|
|
|
|
mkdir -p $(snappy_dir)
|
|
|
|
bash -c "cd $(snappy_dir); \
|
|
|
|
wget https://snappy.googlecode.com/files/$(snappy_file); \
|
|
|
|
tar --strip-components=1 -xvzf $(snappy_file); \
|
2014-06-24 23:21:45 +00:00
|
|
|
CFLAGS='$(cflags)' CXXFLAGS='$(cflags)' ./configure --enable-shared=no $(cross_flags); \
|
2013-11-20 20:53:43 +00:00
|
|
|
$(MAKE)"
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(leveldb_deps): $(snappy_deps)
|
|
|
|
ifeq ($(uname_S),Linux)
|
|
|
|
rm -rf $(leveldb_dir)
|
|
|
|
mkdir -p $(leveldb_dir)
|
|
|
|
bash -c "cd $(leveldb_dir); \
|
|
|
|
wget https://leveldb.googlecode.com/files/$(leveldb_file); \
|
|
|
|
tar --strip-components=1 -xvzf $(leveldb_file); \
|
2014-06-24 23:21:45 +00:00
|
|
|
CFLAGS='-I$(snappy_dir) $(cflags)' CXXFLAGS='-I$(snappy_dir) $(cflags)' LDFLAGS='-L$(snappy_dir)/.libs' $(MAKE) libleveldb.a"
|
2014-06-17 15:26:33 +00:00
|
|
|
endif
|
|
|
|
|
2014-06-23 18:11:32 +00:00
|
|
|
$(rocksdb_deps): $(snappy_deps)
|
2014-06-17 15:26:33 +00:00
|
|
|
ifeq ($(uname_S),Linux)
|
|
|
|
rm -rf $(rocksdb_dir)
|
|
|
|
mkdir -p $(rocksdb_dir)
|
|
|
|
bash -c "cd $(rocksdb_dir); \
|
2014-06-18 19:09:48 +00:00
|
|
|
wget -O $(rocksdb_file) https://github.com/facebook/rocksdb/archive/$(rocksdb_file); \
|
2014-06-17 15:26:33 +00:00
|
|
|
tar --strip-components=1 -xvzf $(rocksdb_file); \
|
2014-07-15 19:46:56 +00:00
|
|
|
CFLAGS='-I$(snappy_dir) $(cflags)' CXXFLAGS='-I$(snappy_dir) $(cflags)' LDFLAGS='-L$(snappy_dir)/.libs $(LRT_LDFLAG)' $(MAKE) librocksdb.a"
|
2013-11-20 20:53:43 +00:00
|
|
|
endif
|
|
|
|
|
2014-06-23 18:11:32 +00:00
|
|
|
$(hyperleveldb_deps): $(snappy_deps)
|
2014-06-17 19:00:47 +00:00
|
|
|
ifeq ($(uname_S),Linux)
|
|
|
|
rm -rf $(hyperleveldb_dir)
|
|
|
|
mkdir -p $(hyperleveldb_dir)
|
|
|
|
bash -c "cd $(hyperleveldb_dir); \
|
2014-07-15 14:15:52 +00:00
|
|
|
wget https://github.com/influxdb/HyperLevelDB/archive/$(hyperleveldb_file) -O $(hyperleveldb_file); \
|
2014-06-17 19:00:47 +00:00
|
|
|
tar --strip-components=1 -xvzf $(hyperleveldb_file); \
|
2014-06-19 14:21:40 +00:00
|
|
|
$(AUTORECONF) -i; \
|
2014-06-24 23:21:45 +00:00
|
|
|
CXXFLAGS='-I$(snappy_dir) $(cflags)' CFLAGS='-I$(snappy_dir) $(cflags)' LDFLAGS='-L$(snappy_dir)/.libs' ./configure --enable-shared=no; \
|
2014-06-24 20:10:52 +00:00
|
|
|
$(MAKE) V=1"
|
2014-06-17 19:00:47 +00:00
|
|
|
endif
|
|
|
|
|
2013-12-02 21:03:56 +00:00
|
|
|
proto_dependency = code.google.com/p/goprotobuf/protoc-gen-go
|
|
|
|
|
2013-11-26 20:32:09 +00:00
|
|
|
dependencies = code.google.com/p/go.crypto/bcrypt \
|
|
|
|
code.google.com/p/goprotobuf/proto \
|
|
|
|
code.google.com/p/log4go \
|
|
|
|
github.com/bmizerany/pat \
|
|
|
|
github.com/fitstar/falcore \
|
|
|
|
github.com/fitstar/falcore/filter \
|
|
|
|
github.com/gorilla/mux \
|
2014-06-27 16:57:06 +00:00
|
|
|
github.com/influxdb/influxdb/_vendor/raft \
|
2013-12-03 22:34:04 +00:00
|
|
|
github.com/influxdb/go-cache \
|
2014-01-08 19:38:27 +00:00
|
|
|
github.com/BurntSushi/toml \
|
2014-01-30 21:15:51 +00:00
|
|
|
code.google.com/p/gogoprotobuf/proto \
|
2014-06-21 21:13:21 +00:00
|
|
|
github.com/influxdb/gomdb \
|
2014-06-24 20:10:52 +00:00
|
|
|
code.google.com/p/go.tools/cmd/vet \
|
2014-06-27 16:57:06 +00:00
|
|
|
github.com/jmhodges/levigo \
|
|
|
|
github.com/influxdb/rocksdb \
|
2014-07-15 14:31:24 +00:00
|
|
|
github.com/influxdb/hyperleveldb-go
|
2013-11-26 20:32:09 +00:00
|
|
|
|
2014-07-22 16:31:35 +00:00
|
|
|
dependencies_paths := $(addprefix $(root)/src/,$(dependencies))
|
2014-06-17 19:00:47 +00:00
|
|
|
|
2013-11-26 20:32:09 +00:00
|
|
|
$(dependencies_paths):
|
2013-12-02 21:03:56 +00:00
|
|
|
for i in $(dependencies); do $(GO) get -d $$i; done
|
2013-11-26 20:32:09 +00:00
|
|
|
|
2014-06-27 16:57:06 +00:00
|
|
|
storage_engines += $(leveldb_deps)
|
2014-06-18 19:09:48 +00:00
|
|
|
|
|
|
|
dependencies: $(storage_engines) $(dependencies_paths)
|
2013-11-20 20:53:43 +00:00
|
|
|
|
|
|
|
test_dependencies: dependencies
|
|
|
|
$(GO) get launchpad.net/gocheck
|
|
|
|
|
2014-07-22 16:31:35 +00:00
|
|
|
$(root)/bin/protoc-gen-go:
|
2014-07-15 14:31:24 +00:00
|
|
|
$(GO) get $(proto_dependency)
|
|
|
|
|
2014-07-22 16:31:35 +00:00
|
|
|
protobuf: $(root)/bin/protoc-gen-go
|
2014-06-27 16:57:06 +00:00
|
|
|
rm -f protocol/*.pb.go
|
2014-07-22 16:31:35 +00:00
|
|
|
PATH=$(root)/bin:$$PATH $(PROTOC) --go_out=. protocol/*.proto
|
2013-11-20 20:53:43 +00:00
|
|
|
|
2014-02-27 17:24:12 +00:00
|
|
|
build: | dependencies protobuf parser build_version_string
|
2013-11-20 20:53:43 +00:00
|
|
|
# TODO: build all packages, otherwise we won't know
|
|
|
|
# if there's an error
|
2014-06-27 16:57:06 +00:00
|
|
|
$(GO) build -o influxdb $(GO_BUILD_OPTIONS) github.com/influxdb/influxdb/daemon
|
|
|
|
$(GO) build -o benchmark-storage $(GO_BUILD_OPTIONS) github.com/influxdb/influxdb/tools/benchmark-storage
|
2014-07-15 16:27:44 +00:00
|
|
|
$(GO) build -o benchmark-tool github.com/influxdb/influxdb/tools/benchmark
|
2013-11-20 20:53:43 +00:00
|
|
|
|
|
|
|
clean:
|
2014-06-27 14:57:40 +00:00
|
|
|
git status --ignored | grep src\/ | grep -v Makefile | xargs rm -rf
|
2014-06-20 03:28:56 +00:00
|
|
|
rm -rf ${TMPDIR}/influxdb
|
|
|
|
rm -rf ${TMPDIR}/admin.influxdb
|
2014-06-25 01:52:37 +00:00
|
|
|
rm -rf $(snappy_dir)
|
|
|
|
rm -rf $(leveldb_dir)
|
|
|
|
rm -rf $(hyperleveldb_dir)
|
|
|
|
rm -rf $(rocksdb_dir)
|
2014-06-27 16:57:06 +00:00
|
|
|
$(MAKE) -C parser clean
|
2013-11-20 20:53:43 +00:00
|
|
|
|
|
|
|
only =
|
|
|
|
verbose = off
|
|
|
|
ifneq ($(only),)
|
2014-02-28 15:30:14 +00:00
|
|
|
GOTEST_OPTS = -gocheck.f '$(only)'
|
2013-11-20 20:53:43 +00:00
|
|
|
endif
|
|
|
|
ifneq ($(verbose),off)
|
2013-12-23 22:30:21 +00:00
|
|
|
GOTEST_OPTS += -v -gocheck.v -gocheck.vv
|
2013-11-20 20:53:43 +00:00
|
|
|
endif
|
|
|
|
|
2014-02-27 17:24:12 +00:00
|
|
|
version=
|
|
|
|
ifeq ($(version),)
|
|
|
|
version = "dev"
|
|
|
|
endif
|
|
|
|
|
2014-09-24 20:26:11 +00:00
|
|
|
timeout = 20m
|
2014-01-23 20:09:43 +00:00
|
|
|
GOTEST_OPTS += -test.timeout=$(timeout)
|
|
|
|
|
2014-06-09 21:12:23 +00:00
|
|
|
bench:
|
2014-06-27 16:57:06 +00:00
|
|
|
$(GO) test github.com/influxdb/influxdb/coordinator -test.bench=. -test.benchmem
|
2014-06-09 21:12:23 +00:00
|
|
|
|
2014-02-10 19:04:14 +00:00
|
|
|
test: test_dependencies parser protobuf
|
2014-06-27 16:57:06 +00:00
|
|
|
$(GO) test $(test_packages) $(GOTEST_OPTS)
|
2013-11-20 20:53:43 +00:00
|
|
|
|
|
|
|
coverage: test_dependencies
|
2014-06-27 16:57:06 +00:00
|
|
|
for i in $(build_packages); do $(GO) test -coverprofile ${TMPDIR}/influxdb.$${i/\//}.coverage $$i $(GOTEST_OPTS); \
|
2014-06-20 03:28:56 +00:00
|
|
|
$(GO) tool cover -html=${TMPDIR}/influxdb.$${i/\//}.coverage; done
|
2013-11-20 20:53:43 +00:00
|
|
|
|
|
|
|
|
2013-12-02 04:42:04 +00:00
|
|
|
integration_test: test_dependencies build
|
2014-06-27 16:57:06 +00:00
|
|
|
$(GO) test github.com/influxdb/influxdb/integration $(GOTEST_OPTS)
|
2013-11-20 20:53:43 +00:00
|
|
|
|
2014-02-25 22:55:16 +00:00
|
|
|
package_version=$(subst -,_,$(version))
|
2014-06-20 03:28:56 +00:00
|
|
|
admin_dir = ${TMPDIR}/admin.influxdb
|
2013-11-26 22:23:47 +00:00
|
|
|
|
2014-02-25 22:57:54 +00:00
|
|
|
source_package = packages/influxdb-$(version).src.tar.gz
|
|
|
|
binary_package = packages/influxdb-$(version).$(arch).tar.gz
|
2013-11-26 22:23:47 +00:00
|
|
|
ifeq ($(arch),386)
|
2014-02-25 22:55:16 +00:00
|
|
|
rpm_package = packages/influxdb-$(package_version)-1.i686.rpm
|
2014-04-24 09:32:33 +00:00
|
|
|
debian_package = packages/influxdb_$(version)_i686.deb
|
2014-09-04 18:01:54 +00:00
|
|
|
deb_args = -a i686
|
|
|
|
rpm_args = setarch i686
|
2014-04-24 09:32:33 +00:00
|
|
|
else ifeq ($(arch),arm)
|
2014-05-28 23:33:45 +00:00
|
|
|
rpm_package = packages/influxdb-$(package_version)-1.armel.rpm
|
|
|
|
debian_package = packages/influxdb_$(version)_armel.deb
|
2013-11-26 22:23:47 +00:00
|
|
|
else
|
2014-02-25 22:55:16 +00:00
|
|
|
rpm_package = packages/influxdb-$(package_version)-1.x86_64.rpm
|
2014-02-25 22:57:54 +00:00
|
|
|
debian_package = packages/influxdb_$(version)_amd64.deb
|
2013-11-26 22:23:47 +00:00
|
|
|
endif
|
|
|
|
|
2013-11-27 02:44:09 +00:00
|
|
|
files = $(binary_package) $(debian_package) $(rpm_package) $(source_package)
|
2014-05-13 20:59:21 +00:00
|
|
|
sha1 = $(shell sh -c "git rev-list --max-count=1 --abbrev-commit HEAD")
|
2013-11-26 22:23:47 +00:00
|
|
|
|
2014-02-27 17:24:12 +00:00
|
|
|
build_version_string:
|
2014-06-27 16:57:06 +00:00
|
|
|
@echo "package main" > daemon/version.go
|
|
|
|
@echo "const version = \"$(version)\"" >> daemon/version.go
|
|
|
|
@echo "const gitSha = \"$(sha1)\"" >> daemon/version.go
|
2014-02-27 17:24:12 +00:00
|
|
|
|
2014-03-12 19:53:07 +00:00
|
|
|
package_version_string: build_version_string
|
2013-11-26 22:23:47 +00:00
|
|
|
sed -i.bak -e "s/REPLACE_VERSION/$(version)/" scripts/post_install.sh
|
|
|
|
|
|
|
|
$(admin_dir)/build:
|
|
|
|
rm -rf $(admin_dir)
|
|
|
|
rvm 1.9.3 do rvm gemset create influxdb
|
|
|
|
git clone https://github.com/influxdb/influxdb-admin.git $(admin_dir)
|
2014-01-06 19:55:35 +00:00
|
|
|
rvm 1.9.3@influxdb do bash -c "pushd $(admin_dir); bundle install; middleman build; popd"
|
2013-11-26 22:23:47 +00:00
|
|
|
|
|
|
|
$(rpm_package): $(admin_dir)/build build
|
|
|
|
rm -rf out_rpm
|
|
|
|
mkdir -p out_rpm/opt/influxdb/versions/$(version)
|
|
|
|
cp -r build/* out_rpm/opt/influxdb/versions/$(version)
|
2014-09-04 18:01:54 +00:00
|
|
|
rvm 1.9.3@influxdb do bash -c "pushd out_rpm; $(rpm_args) fpm -s dir -t rpm --after-install ../scripts/post_install.sh -n influxdb -v $(version) .; popd"
|
2013-11-26 22:23:47 +00:00
|
|
|
mv out_rpm/$(shell basename $(rpm_package)) packages/
|
|
|
|
|
|
|
|
$(debian_package): $(admin_dir)/build build
|
|
|
|
rm -rf out_rpm
|
|
|
|
mkdir -p out_rpm/opt/influxdb/versions/$(version)
|
|
|
|
cp -r build/* out_rpm/opt/influxdb/versions/$(version)
|
2014-09-04 18:01:54 +00:00
|
|
|
rvm 1.9.3@influxdb do bash -c "pushd out_rpm; fpm -s dir -t deb $(deb_args) --after-install ../scripts/post_install.sh -n influxdb -v $(version) .; popd"
|
2013-11-26 22:23:47 +00:00
|
|
|
mv out_rpm/$(shell basename $(debian_package)) packages/
|
|
|
|
|
|
|
|
$(source_package): dependencies
|
2014-06-27 16:57:06 +00:00
|
|
|
rm -rf $(levigo_dependency)
|
2013-11-26 22:23:47 +00:00
|
|
|
$(GO) get -d $(levigo_dependency)
|
2014-07-15 14:52:07 +00:00
|
|
|
rm -f influxdb
|
|
|
|
rm -f benchmark-tool
|
2014-06-20 03:28:56 +00:00
|
|
|
git ls-files --others | egrep -v 'github|launchpad|code.google|version.go' > ${TMPDIR}/influxdb.ignored
|
|
|
|
echo "pkg/*" >> ${TMPDIR}/influxdb.ignored
|
|
|
|
echo "packages/*" >> ${TMPDIR}/influxdb.ignored
|
|
|
|
echo "build/*" >> ${TMPDIR}/influxdb.ignored
|
|
|
|
echo "out_rpm/*" >> ${TMPDIR}/influxdb.ignored
|
2014-07-15 14:59:40 +00:00
|
|
|
rm -rf admin-ui
|
|
|
|
cp -R $(admin_dir)/build admin-ui
|
2014-06-20 03:28:56 +00:00
|
|
|
tar -czf $(source_package) --exclude-vcs -X ${TMPDIR}/influxdb.ignored *
|
|
|
|
rm -rf ${TMPDIR}/influxdb
|
|
|
|
mkdir ${TMPDIR}/influxdb
|
|
|
|
tar -xzf $(source_package) -C ${TMPDIR}/influxdb
|
2013-11-26 22:23:47 +00:00
|
|
|
rm $(source_package)
|
2014-06-20 03:28:56 +00:00
|
|
|
bash -c "pushd ${TMPDIR}/; tar -czf `basename $(source_package)` influxdb; popd"
|
|
|
|
mv ${TMPDIR}/$(shell basename $(source_package)) $(source_package)
|
2014-06-27 16:57:06 +00:00
|
|
|
rm -rf $(levigo_dependency)
|
2014-07-15 14:59:40 +00:00
|
|
|
rm -rf admin-ui
|
2013-11-26 22:23:47 +00:00
|
|
|
|
2013-12-11 18:10:37 +00:00
|
|
|
$(binary_package): $(admin_dir)/build build packages
|
2013-11-26 22:23:47 +00:00
|
|
|
rm -rf build
|
|
|
|
mkdir build
|
2014-07-15 14:52:07 +00:00
|
|
|
mv influxdb build/
|
|
|
|
mv benchmark-tool build/influxdb-benchmark
|
2014-07-15 16:27:44 +00:00
|
|
|
cp tools/benchmark/benchmark_config.sample.toml build/benchmark_config.toml
|
2013-11-26 22:23:47 +00:00
|
|
|
mkdir build/admin
|
|
|
|
cp -R $(admin_dir)/build/* build/admin/
|
|
|
|
cp -R scripts/ build/
|
2014-04-14 00:39:09 +00:00
|
|
|
cp config.sample.toml build/config.toml
|
2013-12-12 16:27:00 +00:00
|
|
|
sed -i 's/.\/admin/\/opt\/influxdb\/current\/admin/g' build/config.toml
|
|
|
|
sed -i 's/influxdb.log/\/opt\/influxdb\/shared\/log.txt/g' build/config.toml
|
2014-09-19 14:05:25 +00:00
|
|
|
sed -i 's:${TMPDIR}/influxdb/development/db:/opt/influxdb/shared/data/db:g' build/config.toml
|
|
|
|
sed -i 's:${TMPDIR}/influxdb/development/raft:/opt/influxdb/shared/data/raft:g' build/config.toml
|
|
|
|
sed -i 's:${TMPDIR}/influxdb/development/wal:/opt/influxdb/shared/data/wal:g' build/config.toml
|
2013-11-26 22:23:47 +00:00
|
|
|
rm -f build/scripts/post_install.sh.bak
|
|
|
|
tar -czf $(binary_package) build/*
|
|
|
|
|
2013-12-11 18:10:37 +00:00
|
|
|
binary_package: $(binary_package)
|
|
|
|
|
2013-11-26 22:23:47 +00:00
|
|
|
packages:
|
|
|
|
mkdir $@
|
|
|
|
|
2014-08-15 17:47:01 +00:00
|
|
|
flymake:
|
|
|
|
for i in $(packages); do $(GO) build $$i; done
|
|
|
|
|
|
|
|
flymake_test:
|
|
|
|
for i in $(packages); do $(GO) test -c $$i; done
|
|
|
|
|
2014-02-27 17:24:12 +00:00
|
|
|
package: | packages build package_version_string $(files)
|
2013-11-26 22:23:47 +00:00
|
|
|
mv -f scripts/post_install.sh.bak scripts/post_install.sh
|
2014-06-23 16:52:39 +00:00
|
|
|
|
2014-06-23 16:53:50 +00:00
|
|
|
|
|
|
|
check:
|
|
|
|
./.hooks/pre-commit
|
2014-06-23 16:52:39 +00:00
|
|
|
|
2014-06-23 18:01:53 +00:00
|
|
|
vet:
|
2014-06-23 18:43:49 +00:00
|
|
|
git ls-files | grep '.go$$' | while read i; do $(GO) vet $$i 2>&1; done | grep -v exit\ status | grep -v pb.go | grep -v Error\ call
|
2014-06-23 18:01:53 +00:00
|
|
|
|
2014-06-23 16:52:39 +00:00
|
|
|
format:
|
2014-06-23 18:43:49 +00:00
|
|
|
git ls-files | grep '.go$$' | xargs $(GOFMT) -w -s
|