reflector.go/Makefile

33 lines
1.1 KiB
Makefile
Raw Permalink Normal View History

version := $(shell git describe --dirty --always --long --abbrev=7)
commit := $(shell git rev-parse --short HEAD)
commit_long := $(shell git rev-parse HEAD)
branch := $(shell git rev-parse --abbrev-ref HEAD)
curTime := $(shell date +%s)
2018-03-01 22:28:06 +01:00
BINARY=prism-bin
2018-08-15 16:34:50 +02:00
IMPORT_PATH = github.com/lbryio/reflector.go
LDFLAGS="-X ${IMPORT_PATH}/meta.version=$(version) -X ${IMPORT_PATH}/meta.commit=$(commit) -X ${IMPORT_PATH}/meta.commitLong=$(commit_long) -X ${IMPORT_PATH}/meta.branch=$(branch) -X '${IMPORT_PATH}/meta.Time=$(curTime)'"
DIR = $(shell cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
BIN_DIR = $(DIR)/dist
2018-03-01 22:28:06 +01:00
.DEFAULT_GOAL := linux
2018-03-01 22:28:06 +01:00
.PHONY: test
test:
go test -cover -v ./...
2018-03-01 22:28:06 +01:00
.PHONY: lint
lint:
./scripts/lint.sh
2018-03-01 22:28:06 +01:00
.PHONY: linux
linux:
GOARCH=amd64 GOOS=linux go build -ldflags ${LDFLAGS} -asmflags -trimpath=${DIR} -o ${BIN_DIR}/linux_amd64/${BINARY}
2018-02-07 21:21:20 +01:00
.PHONY: macos
macos:
GOARCH=amd64 GOOS=darwin go build -ldflags ${LDFLAGS} -asmflags -trimpath=${DIR} -o ${BIN_DIR}/darwin_amd64/${BINARY}
2018-08-31 01:52:29 +02:00
.PHONY: image
image:
docker buildx build -t lbry/reflector:$(version) -t lbry/reflector:latest --platform linux/amd64 .