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
|
|
|
|
2017-11-02 16:20:22 +01:00
|
|
|
VERSION=$(shell git --git-dir=${DIR}/.git describe --dirty --always --long --abbrev=7)
|
|
|
|
LDFLAGS = -ldflags "-X main.Version=${VERSION}"
|
2017-09-29 00:09:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
.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
|