-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b13050
commit 4d00b02
Showing
1 changed file
with
32 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,44 @@ | ||
GO_EXECUTABLE := go | ||
VERSION := $(shell git describe --abbrev=10 --dirty --always --tags) | ||
DIST_DIRS := find * -type d -exec | ||
VERSION_PACKAGE := "github.com/fredericlemoine/goalign/cmd.Version" | ||
NAME := "goalign" | ||
PACKAGE:="github.com/fredericlemoine/goalign" | ||
|
||
all: build install | ||
all: build test install | ||
|
||
build: | ||
${GO_EXECUTABLE} build -o goalign -ldflags "-X github.com/fredericlemoine/goalign/cmd.Version=${VERSION}" github.com/fredericlemoine/goalign | ||
${GO_EXECUTABLE} build -o ${NAME} -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE} | ||
|
||
install: | ||
${GO_EXECUTABLE} install -ldflags "-X github.com/fredericlemoine/goalign/cmd.Version=${VERSION}" github.com/fredericlemoine/goalign | ||
rm -f ${GOPATH}/bin/${NAME} | ||
${GO_EXECUTABLE} install -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE} | ||
|
||
test: | ||
${GO_EXECUTABLE} test github.com/fredericlemoine/goalign/... | ||
${GO_EXECUTABLE} test ${PACKAGE}/... | ||
|
||
deploy: | ||
mkdir -p deploy/${VERSION} | ||
env GOOS=windows GOARCH=amd64 ${GO_EXECUTABLE} build -o deploy/${VERSION}/goalign_amd64.exe -ldflags "-X github.com/fredericlemoine/goalign/cmd.Version=${VERSION}" github.com/fredericlemoine/goalign | ||
env GOOS=windows GOARCH=386 ${GO_EXECUTABLE} build -o deploy/${VERSION}/goalign_386.exe -ldflags "-X github.com/fredericlemoine/goalign/cmd.Version=${VERSION}" github.com/fredericlemoine/goalign | ||
env GOOS=darwin GOARCH=amd64 ${GO_EXECUTABLE} build -o deploy/${VERSION}/goalign_amd64_darwin -ldflags "-X github.com/fredericlemoine/goalign/cmd.Version=${VERSION}" github.com/fredericlemoine/goalign | ||
env GOOS=darwin GOARCH=386 ${GO_EXECUTABLE} build -o deploy/${VERSION}/goalign_386_darwin -ldflags "-X github.com/fredericlemoine/goalign/cmd.Version=${VERSION}" github.com/fredericlemoine/goalign | ||
env GOOS=linux GOARCH=amd64 ${GO_EXECUTABLE} build -o deploy/${VERSION}/goalign_amd64_linux -ldflags "-X github.com/fredericlemoine/goalign/cmd.Version=${VERSION}" github.com/fredericlemoine/goalign | ||
env GOOS=linux GOARCH=386 ${GO_EXECUTABLE} build -o deploy/${VERSION}/goalign_386_linux -ldflags "-X github.com/fredericlemoine/goalign/cmd.Version=${VERSION}" github.com/fredericlemoine/goalign | ||
.PHONY: deploy deploydir deploywinamd deploywin386 deploylinuxamd deploylinux386 deploydarwinamd deploydarwin386 | ||
|
||
deploy: deploywinamd deploywin386 deploylinuxamd deploylinux386 deploydarwinamd deploydarwin386 | ||
tar -czvf deploy/${VERSION}.tar.gz --directory="deploy" ${VERSION} | ||
|
||
deploydir: | ||
mkdir -p deploy/${VERSION} | ||
|
||
deploywinamd: deploydir | ||
env GOOS=windows GOARCH=amd64 ${GO_EXECUTABLE} build -o deploy/${VERSION}/${NAME}_amd64.exe -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE} | ||
|
||
deploywin386: deploydir | ||
env GOOS=windows GOARCH=386 ${GO_EXECUTABLE} build -o deploy/${VERSION}/${NAME}_386.exe -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE} | ||
|
||
deploylinuxamd: deploydir | ||
env GOOS=linux GOARCH=amd64 ${GO_EXECUTABLE} build -o deploy/${VERSION}/${NAME}_amd64_linux -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE} | ||
|
||
deploylinux386: deploydir | ||
env GOOS=linux GOARCH=386 ${GO_EXECUTABLE} build -o deploy/${VERSION}/${NAME}_386_linux -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE} | ||
|
||
deploydarwinamd: deploydir | ||
env GOOS=darwin GOARCH=amd64 ${GO_EXECUTABLE} build -o deploy/${VERSION}/${NAME}_amd64_darwin -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE} | ||
|
||
deploydarwin386: deploydir | ||
env GOOS=darwin GOARCH=386 ${GO_EXECUTABLE} build -o deploy/${VERSION}/${NAME}_386_darwin -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE} |