Skip to content
This repository has been archived by the owner on Nov 18, 2017. It is now read-only.

Commit

Permalink
add package versions to makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Deare committed Sep 12, 2016
1 parent 92f9d20 commit 594a50d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,29 @@ PKG := github.com/compose/governor
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/)
VERSION := $(shell git describe --tags)
RELEASES := windows|amd64 linux|amd64 linux|arm

release: vet lint test build
release: vet lint test build package-releases

build:
package-releases:
$(foreach release,$(RELEASES), \
$(call release-version,$(firstword $(subst |, ,$(release))),\
$(lastword $(subst |, ,$(release))))\
)

define release-version
@echo "Building release for $(strip $(1)):$(strip $(2))"
mkdir -p ./build
GOOS=$(strip $(1)) GOARCH=$(strip $(2)) go build -v -o ./build/${OUT} -ldflags "-X main.version=${VERSION}" ${PKG}
tar -C ./build -cvzf ./build/governor-${VERSION}-$(strip $(1))-$(strip $(2)).tar.gz ${OUT}
rm ./build/${OUT}

endef


build: build-native

build-native:
go build -v -o ${OUT} -ldflags "-X main.version=${VERSION}" ${PKG}

vet:
Expand Down

0 comments on commit 594a50d

Please sign in to comment.