Skip to content

Commit

Permalink
add Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
andrexus committed Oct 18, 2017
1 parent ac0bfc1 commit 44f4c75
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
vendor
config.json
*.bolt
dist
dist
build
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
SHELL = bash
GOTOOLS = \
github.com/mjibson/esc \
github.com/mitchellh/gox \

GOOS=$(shell go env GOOS)
GOARCH=$(shell go env GOARCH)

# Get the git commit
GIT_LATEST_TAG=$(shell git describe --abbrev=0 --tags)
VERSION_IMPORT=github.com/andrexus/cloud-initer/cmd
GOLDFLAGS=-X $(VERSION_IMPORT).Version=$(GIT_LATEST_TAG)

export GOLDFLAGS

# all builds binaries for all targets
all: bin

bin: tools
go generate
@echo "==> Building..."
gox -ldflags "${GOLDFLAGS}" -osarch "darwin/amd64 linux/386 linux/amd64 linux/arm" -output "build/{{.OS}}_{{.Arch}}_{{.Dir}}"

tools:
go get -u -v $(GOTOOLS)

.PHONY: all bin tools
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
)

var Version string = "0.1.1"
var Version string = "unset"

var versionCmd = cobra.Command{
Run: showVersion,
Expand Down

0 comments on commit 44f4c75

Please sign in to comment.