-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (72 loc) · 1.87 KB
/
Makefile
File metadata and controls
86 lines (72 loc) · 1.87 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Makefile for Go projects with pre-commit integration
# Default Go commands
GO := go
GOFLAGS := -v
# Default target: run pre-commit
.PHONY: all
all: pre-commit
# Install dependencies
.PHONY: deps
deps:
$(GO) get -u ./...
$(GO) mod tidy
$(GO) mod download
# Format code
.PHONY: fmt
fmt:
$(GO) fmt ./...
gofmt -s -w .
# Lint code (requires golangci-lint to be installed)
.PHONY: lint
lint:
golangci-lint run --fix
# Test the project
.PHONY: test
test:
$(GO) test $(GOFLAGS) ./...
# Generate code
.PHONY: gen
gen:
$(GO) generate ./...
$(GO) fmt ./...
# Build the project
.PHONY: build
build: clean gen
$(GO) build $(GOFLAGS) ./...
# Run llama inference
.PHONY: run
run:
$(GO) run cmd/llama/main.go ./cmd/llama/stories15M.bin
# Run quantized llama inference
.PHONY: runq
runq:
$(GO) run cmd/llamaq8/main.go ./cmd/llamaq8/stories15M_q8.bin
# Clean build cache and temporary files
.PHONY: clean
clean:
$(GO) clean -cache
# Benchmark the project
.PHONY: bench
bench:
$(GO) test -run=NO_TEST -bench . -benchmem -benchtime 3s ./...
# Pre-commit: run all checks before commit
.PHONY: pre-commit
pre-commit: deps fmt lint test
pre-commit run --all-files
# Help message
.PHONY: help
help:
@echo "Available targets:"
@echo " make - Run pre-commit (default)"
@echo " make deps - Install and tidy dependencies"
@echo " make fmt - Format Go code"
@echo " make lint - Run linter (requires golangci-lint)"
@echo " make test - Run all tests"
@echo " make gen - Generate code"
@echo " make build - Build the project"
@echo " make clean - Clean build cache and temporary files"
@echo " make bench - Run benchmarks"
@echo " make run - Run llama inference"
@echo " make runq - Run quantized llama inference"
@echo " make pre-commit - Run all pre-commit checks (deps, fmt, lint, test)"
@echo " make help - Show this help message"