-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (27 loc) · 945 Bytes
/
Copy pathMakefile
File metadata and controls
35 lines (27 loc) · 945 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
35
# Build into bin/ (gitignored) so the binary never collides with the algorithmvisualizer/
# source package at the repo root.
BINARY := bin/algvis
PKG := ./cmd/algvis
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 github.com/tamnd/algorithmvisualizer-cli/cli.Version=$(VERSION) \
-X github.com/tamnd/algorithmvisualizer-cli/cli.Commit=$(COMMIT) \
-X github.com/tamnd/algorithmvisualizer-cli/cli.Date=$(DATE)
.PHONY: build install test vet fmt clean run
build:
@mkdir -p $(dir $(BINARY))
CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BINARY) $(PKG)
install:
CGO_ENABLED=0 go install -trimpath -ldflags "$(LDFLAGS)" $(PKG)
test:
go test ./...
vet:
go vet ./...
fmt:
gofmt -w -s .
clean:
rm -rf bin dist
run: build
./$(BINARY) $(ARGS)