2016-09-15 21:01:51 +00:00
|
|
|
VERSION ?= $$(git describe --always --tags)
|
|
|
|
COMMIT ?= $$(git rev-parse --short=8 HEAD)
|
|
|
|
BRANCH ?= $$(git rev-parse --abbrev-ref HEAD | tr / _)
|
|
|
|
BUILD_TIME ?= $$(date +%FT%T%z)
|
|
|
|
|
|
|
|
SOURCES := $(shell find . -name '*.go')
|
|
|
|
|
|
|
|
LDFLAGS=-ldflags "-s -X main.Version=${VERSION} -X main.Commit=${COMMIT} -X main.BuildTime=${BUILD_TIME} -X main.Branch=${BRANCH}"
|
|
|
|
BINARY=mrfusion
|
|
|
|
|
|
|
|
default: prepare ${BINARY}
|
|
|
|
|
|
|
|
${BINARY}: $(SOURCES)
|
|
|
|
go build -o ${BINARY} ${LDFLAGS} ./cmd/mr-fusion-server/main.go
|
|
|
|
|
|
|
|
docker-${BINARY}: $(SOURCES)
|
|
|
|
CGO_ENABLED=0 GOOS=linux go build -installsuffix cgo -o ${BINARY} ${LDFLAGS} \
|
|
|
|
./cmd/mr-fusion-server/main.go
|
|
|
|
|
2016-09-16 17:05:09 +00:00
|
|
|
bindata:
|
|
|
|
go-bindata -o dist/dist_gen.go -ignore 'map|go' -pkg dist -nocompress=true dist/...
|
|
|
|
|
|
|
|
dev:
|
2016-09-15 21:01:51 +00:00
|
|
|
go get github.com/sparrc/gdm
|
|
|
|
gdm restore
|
2016-09-16 17:05:09 +00:00
|
|
|
go get -u github.com/jteeuwen/go-bindata/...
|
|
|
|
|
|
|
|
prepare: dev bindata
|
2016-09-15 21:01:51 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
|
|
|
|
|
|
|
|
test:
|
|
|
|
go test -race ./...
|
|
|
|
|
|
|
|
.PHONY: clean test
|