tools/Makefile

25 lines
500 B
Makefile
Raw Normal View History

2022-03-22 20:24:52 +00:00
SHELL := /bin/bash
BIN := dist/gitea-tools
HASH := $(shell git rev-parse --short HEAD)
COMMIT_DATE := $(shell git show -s --format=%ci ${HASH})
BUILD_DATE := $(shell date '+%Y-%m-%d %H:%M:%S')
VERSION := ${HASH}
LD_FLAGS := -s -w -X 'main.buildVersion=${VERSION}' -X 'main.buildDate=${BUILD_DATE}'
COMP_BIN := go
.PHONY: build run test clean
build:
mkdir -p dist/
${COMP_BIN} build -o "${BIN}" -ldflags="${LD_FLAGS}" ./cmd/gitea-tools
run:
./${BIN}
test:
go test
clean:
go clean
rm ${BIN}