-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (32 loc) · 1.01 KB
/
Copy pathMakefile
File metadata and controls
42 lines (32 loc) · 1.01 KB
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
42
.PHONY: build clean run test deps release-local
BINARY_NAME=lark
BUILD_DIR=.
export LARK_CONFIG_DIR=.lark
# Version info for local builds
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/yjwong/lark-cli/internal/cmd.version=$(VERSION) \
-X github.com/yjwong/lark-cli/internal/cmd.commit=$(COMMIT) \
-X github.com/yjwong/lark-cli/internal/cmd.date=$(DATE)
build:
go build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/lark
clean:
rm -f $(BUILD_DIR)/$(BINARY_NAME)
run: build
./$(BINARY_NAME) $(ARGS)
test:
go test -v ./...
deps:
go mod tidy
go mod download
# Install to go bin
install:
go install ./cmd/lark
# Install to vault tools/bin
install-local:
go build -ldflags "$(LDFLAGS)" -o ../bin/lark ./cmd/lark
# Test release locally (requires goreleaser installed)
release-local:
goreleaser release --snapshot --clean