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:
|
2022-03-23 00:39:53 +00:00
|
|
|
make build
|
2022-03-22 20:24:52 +00:00
|
|
|
./${BIN}
|
|
|
|
|
|
|
|
test:
|
|
|
|
go test
|
|
|
|
|
|
|
|
clean:
|
|
|
|
go clean
|
|
|
|
rm ${BIN}
|