Created
November 7, 2014 18:05
-
-
Save ae6rt/6671f5762e2144d18c8c to your computer and use it in GitHub Desktop.
Go Makefile prototype
This file contains hidden or 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
NAME := stashkins | |
ARCH := amd64 | |
VERSION := 1.0 | |
DATE := $(shell date) | |
COMMIT_ID := $(shell git rev-parse --short HEAD) | |
SDK_INFO := $(shell go version) | |
LD_FLAGS := -X main.version $(VERSION) -X main.commit $(COMMIT_ID) -X main.buildTime '$(DATE)' -X main.sdkInfo '$(SDK_INFO)' | |
all: clean binaries package | |
test: | |
godep go test | |
binaries: tools deps test | |
GOOS=darwin GOARCH=$(ARCH) godep go build -ldflags "$(LD_FLAGS)" -o $(NAME)-darwin-$(ARCH) | |
GOOS=linux GOARCH=$(ARCH) godep go build -ldflags "$(LD_FLAGS)" -o $(NAME)-linux-$(ARCH) | |
deps: | |
go get -v -u github.com/xoom/stash | |
go get -v -u github.com/xoom/jenkins | |
tools: | |
type godep > /dev/null 2>&1 || go get -v github.com/tools/godep | |
clean: | |
go clean | |
rm -f *.deb | |
package: | |
which fpm && fpm -s dir -t deb -v $(VERSION) -n stashkins -a amd64 -m"Mark Petrovic <[email protected]>" --prefix /usr/local/bin --description "https://github.com/xoom/stashkins" stashkins-linux-amd64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here are the variable declarations in the stashkins.go code that ldflags works against:
var (
...
version string
commit string
buildTime string
sdkInfo string
)