travis build/release, makefile

This commit is contained in:
Thomas Skowron
2016-10-05 10:24:05 +02:00
parent 319c6ef85b
commit 5df86f8a29
5 changed files with 49 additions and 148 deletions

View File

@ -1,18 +1,22 @@
# Copyright 2015 The Prometheus Authors
# 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.
BUILD_DIR = build
VERSION := 0.1.0
TARGET := nsq_exporter
GOFLAGS := -ldflags "-X main.Version=$(VERSION)"
GO = go
GOX = gox
GOX_ARGS = -output="$(BUILD_DIR)/{{.Dir}}_{{.OS}}_{{.Arch}}" -osarch="linux/amd64 linux/386 linux/arm linux/arm64 darwin/amd64 freebsd/amd64 freebsd/386 windows/386 windows/amd64"
include Makefile.COMMON
.PHONY: build
build:
$(GO) build -o $(BUILD_DIR)/nsq_exporter .
.PHONY: clean
clean:
rm -R $(BUILD_DIR)/* || true
.PHONY: test
test:
$(GO) test ./...
.PHONY: release-build
release-build:
@go get -u github.com/mitchellh/gox
@$(GOX) $(GOX_ARGS) github.com/lovoo/nsq_exporter