-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
25 lines (19 loc) · 705 Bytes
/
Copy pathMakefile
File metadata and controls
25 lines (19 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
VERSION ?= dev
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
BUILD_TIME ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo unknown)
GO_VERSION ?= $(shell go version | awk '{print $$3}')
BINARY := godler
LDFLAGS := -ldflags "-X godler/internal/version.Version=$(VERSION) -X godler/internal/version.Commit=$(COMMIT) -X godler/internal/version.BuildTime=$(BUILD_TIME) -X godler/internal/version.GoVersion=$(GO_VERSION)"
.PHONY: build clean run test lint
build:
go build $(LDFLAGS) -o $(BINARY) ./cmd/cli
clean:
rm -f $(BINARY)
run: build
./$(BINARY) -v
test:
go test ./... -count=1 -v
# Usage:
# make build VERSION=v2.0.0
# make run
# make test