2017-09-29 00:09:46 +02:00
|
|
|
BINARY=lbry
|
|
|
|
|
|
|
|
DIR = $(shell cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
2017-10-05 18:02:01 +02:00
|
|
|
VENDOR_DIR = vendor
|
2017-09-29 00:09:46 +02:00
|
|
|
|
|
|
|
VERSION=$(shell git --git-dir=${DIR}/.git describe --dirty --always)
|
|
|
|
COMMIT=$(shell git --git-dir=${DIR}/.git rev-parse --short HEAD)
|
|
|
|
BRANCH=$(shell git --git-dir=${DIR}/.git rev-parse --abbrev-ref HEAD)
|
|
|
|
LDFLAGS = -ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=${COMMIT} -X main.BRANCH=${BRANCH}"
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: build dep clean
|
|
|
|
.DEFAULT_GOAL: build
|
|
|
|
|
|
|
|
|
2017-10-05 18:02:01 +02:00
|
|
|
build: dep
|
|
|
|
CGO_ENABLED=0 go build ${LDFLAGS} -asmflags -trimpath=${DIR} -o ${DIR}/${BINARY} main.go
|
2017-09-29 00:09:46 +02:00
|
|
|
|
2017-10-05 18:02:01 +02:00
|
|
|
dep: | $(VENDOR_DIR)
|
|
|
|
|
|
|
|
$(VENDOR_DIR):
|
|
|
|
go get github.com/golang/dep/cmd/dep && dep ensure
|
2017-09-29 00:09:46 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
if [ -f ${DIR}/${BINARY} ]; then rm ${DIR}/${BINARY}; fi
|