about summary refs log tree commit diff
path: root/templates/go/Makefile
blob: 34fe6390e354d4a4b7678a3656257b6b2a31f45f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
.PHONY: build run clean

BUILD_DIR=bin
PROGRAM_FILE=fixproject
VERSION=$(shell git describe --tag --always)
BUILD_DATE ?= $(shell TZ=UTC0 git show -s --format=%cd --date=format-local:'%Y-%m-%dT%H:%M:%SZ' HEAD)

build:
	@go build \
		-o ${BUILD_DIR}/${PROGRAM_FILE} \
		-ldflags "-X main.Version=${VERSION} -X main.BuildDate=${BUILD_DATE}" \
		-trimpath main.go

run: build
	@./${BUILD_DIR}/${PROGRAM_FILE}

clean:
	@go clean
	@rm -rf ${BUILD_DIR}/${PROGRAM_FILE}