tools/Makefile

26 lines
512 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/
2022-03-28 21:22:34 +01:00
${COMP_BIN} build -o "${BIN}" -ldflags="${LD_FLAGS}" ./cmd/melon-tools
2022-03-22 20:24:52 +00:00
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}