-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (23 loc) · 895 Bytes
/
Makefile
File metadata and controls
30 lines (23 loc) · 895 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
26
27
28
29
30
BINARY := wave
PKG := ./cmd/wave
PREFIX ?= $(HOME)/.local
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)
.PHONY: build install test lint clean
# NOTE: Running `go build ./cmd/wave` directly will produce a binary that
# reports version as "dev". Always use `make build` or pass ldflags manually:
# go build -ldflags "-X main.version=... -X main.commit=... -X main.date=..." ./cmd/wave
build:
go build -ldflags "$(LDFLAGS)" -o $(BINARY) $(PKG)
install: build
install -d $(PREFIX)/bin
cp -f $(BINARY) $(PREFIX)/bin/$(BINARY)
chmod 755 $(PREFIX)/bin/$(BINARY)
test:
go test -race ./...
lint:
golangci-lint run ./...
clean:
rm -f $(BINARY)