Merge pull request #150 from jfrazelle/makefile-compile-time-vars

Makefile compile time vars
This commit is contained in:
Diogo Mónica 2015-07-28 15:34:25 -07:00
commit 9592a19799
2 changed files with 14 additions and 4 deletions

View File

@ -1,10 +1,19 @@
# Set an output prefix, which is the local directory if not specified # Set an output prefix, which is the local directory if not specified
PREFIX?=$(shell pwd) PREFIX?=$(shell pwd)
# Used to populate version variable in main package. # Populate version variables
GO_LDFLAGS=-ldflags "-w -X `go list ./version`.Version `git describe --match 'v[0-9]*' --dirty='.m' --always`" # Add to compile time flags
GO_LDFLAGS_STATIC=-ldflags "-w -extldflags -static -X `go list ./version`.Version `git describe --match 'v[0-9]*' --dirty='.m' --always`" NOTARY_PKG := github.com/docker/notary
GOOSES = darwin freebsd linux windows VERSION := $(shell cat VERSION)
GITCOMMIT := $(shell git rev-parse --short HEAD)
GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no)
ifneq ($(GITUNTRACKEDCHANGES),)
GITCOMMIT := $(GITCOMMIT)-dirty
endif
CTIMEVAR=-X $(NOTARY_PKG)/version/version.GitCommit '$(GITCOMMIT)' -X $(NOTARY_PKG)/version/version.NotaryVersion '$(VERSION)'
GO_LDFLAGS=-ldflags "-w $(CTIMEVAR)"
GO_LDFLAGS_STATIC=-ldflags "-w $(CTIMEVAR) -extldflags -static"
GOOSES = darwin freebsd linux
GOARCHS = amd64 386 GOARCHS = amd64 386
# go cover test variables # go cover test variables

1
VERSION Normal file
View File

@ -0,0 +1 @@
1.0-rc1