alertmanager/Makefile.INCLUDE

60 lines
2.0 KiB
Makefile

# Copyright 2013 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.
VERSION := 0.1.0
TARGET := alertmanager
OS := $(subst Darwin,darwin,$(subst Linux,linux,$(subst FreeBSD,freebsd,$(shell uname))))
ARCH := $(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m)))
# The release engineers apparently need to key their binary artifacts to the
# Mac OS X release family.
MAC_OS_X_VERSION ?= 10.8
GOOS ?= $(OS)
GOARCH ?= $(ARCH)
ifeq ($(GOOS),darwin)
RELEASE_SUFFIX ?= -osx$(MAC_OS_X_VERSION)
else
RELEASE_SUFFIX ?=
endif
MAKEFILE_DIR ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
GO_VERSION ?= 1.4.1
GOURL ?= https://golang.org/dl
GOPKG ?= go$(GO_VERSION).$(GOOS)-$(GOARCH)$(RELEASE_SUFFIX).tar.gz
GOROOT := $(MAKEFILE_DIR)/.deps/go
GOPATH := $(MAKEFILE_DIR)/.deps/gopath
GOCC := $(GOROOT)/bin/go
GO := GOROOT=$(GOROOT) GOPATH=$(GOPATH) $(GOCC)
GOFMT := $(GOROOT)/bin/gofmt
SUFFIX := $(GOOS)-$(GOARCH)
BINARY := $(TARGET)
ARCHIVE := $(TARGET)-$(VERSION).$(SUFFIX).tar.gz
SELFLINK := $(GOPATH)/src/github.com/prometheus/alertmanager
REV := $(shell git rev-parse --short HEAD)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
HOSTNAME := $(shell hostname -f)
BUILD_DATE := $(shell date +%Y%m%d-%H:%M:%S)
BUILDFLAGS := -ldflags \
"-X main.buildVersion $(REV)\
-X main.buildBranch $(BRANCH)\
-X main.buildUser $(USER)@$(HOSTNAME)\
-X main.buildDate $(BUILD_DATE)\
-X main.goVersion $(GO_VERSION)"