-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (25 loc) · 863 Bytes
/
Copy pathMakefile
File metadata and controls
34 lines (25 loc) · 863 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
31
32
33
34
BINARY := looprelay
MODULE := github.com/loop-eng/looprelay
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 := -s -w \
-X '$(MODULE)/internal/cli.version=$(VERSION)' \
-X '$(MODULE)/internal/cli.commit=$(COMMIT)' \
-X '$(MODULE)/internal/cli.date=$(DATE)'
.PHONY: build test lint run clean install fuzz
build:
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/looprelay
run: build
./bin/$(BINARY)
test:
go test -race -count=1 ./...
lint:
golangci-lint run ./...
fuzz:
go test -fuzz=Fuzz -fuzztime=30s ./internal/parser/
clean:
rm -rf bin/ dist/
install: build
cp bin/$(BINARY) $(GOPATH)/bin/$(BINARY) 2>/dev/null || cp bin/$(BINARY) ~/go/bin/$(BINARY)
.DEFAULT_GOAL := build