2019-03-29 02:38:00 +01:00
|
|
|
BINARY=ytsync
|
2018-10-08 22:19:17 +02:00
|
|
|
|
|
|
|
DIR = $(shell cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
2019-02-27 14:38:43 +01:00
|
|
|
BIN_DIR = ${DIR}/bin
|
|
|
|
IMPORT_PATH = github.com/lbryio/ytsync
|
2018-10-08 22:19:17 +02:00
|
|
|
|
2019-02-27 14:38:43 +01:00
|
|
|
VERSION = $(shell git --git-dir=${DIR}/.git describe --dirty --always --long --abbrev=7)
|
|
|
|
LDFLAGS = -ldflags "-X ${IMPORT_PATH}/meta.Version=${VERSION} -X ${IMPORT_PATH}/meta.Time=$(shell date +%s)"
|
2018-10-08 22:19:17 +02:00
|
|
|
|
|
|
|
|
2019-02-27 14:38:43 +01:00
|
|
|
.PHONY: build clean test lint
|
2018-10-08 22:19:17 +02:00
|
|
|
.DEFAULT_GOAL: build
|
|
|
|
|
|
|
|
|
2019-02-27 14:38:43 +01:00
|
|
|
build:
|
|
|
|
mkdir -p ${BIN_DIR} && CGO_ENABLED=0 go build ${LDFLAGS} -asmflags -trimpath=${DIR} -o ${BIN_DIR}/${BINARY} main.go
|
2018-10-08 22:19:17 +02:00
|
|
|
|
2019-02-27 14:38:43 +01:00
|
|
|
clean:
|
|
|
|
if [ -f ${BIN_DIR}/${BINARY} ]; then rm ${BIN_DIR}/${BINARY}; fi
|
2018-10-08 22:19:17 +02:00
|
|
|
|
2019-02-27 14:38:43 +01:00
|
|
|
test:
|
|
|
|
go test ./... -v -cover
|
2018-10-08 22:19:17 +02:00
|
|
|
|
2019-02-27 14:38:43 +01:00
|
|
|
lint:
|
|
|
|
go get github.com/alecthomas/gometalinter && gometalinter --install && gometalinter ./...
|