-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (29 loc) · 825 Bytes
/
Makefile
File metadata and controls
41 lines (29 loc) · 825 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
36
37
38
39
40
41
GO ?= go
BINARY_NAME ?= lx
CMD_DIR := ./cmd/lx
BIN_DIR := ./bin
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -s -w -X 'github.com/rasros/lx/internal/cli.Version=$(VERSION)'
.PHONY: all build clean demo
all: build
build:
@mkdir -p $(BIN_DIR)
$(GO) build -ldflags="$(LDFLAGS)" -o $(OR_OUT) $(CMD_DIR)
OR_OUT ?= $(BIN_DIR)/$(BINARY_NAME)
install:
$(GO) install $(CMD_DIR)
fmt:
$(GO) fmt ./...
$(GO) mod tidy
$(GO) vet ./...
test:
$(GO) test ./...
test-update:
$(GO) test ./cmd/lx -update
run: build
$(BIN_DIR)/$(BINARY_NAME)
demo: build
@command -v vhs >/dev/null || { echo "vhs not found — install from https://github.com/charmbracelet/vhs"; exit 1; }
PATH="$(CURDIR)/$(BIN_DIR):$$PATH" vhs demo/demo.tape
clean:
rm -rf $(BIN_DIR)