-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (55 loc) · 1.75 KB
/
Makefile
File metadata and controls
75 lines (55 loc) · 1.75 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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOCLEAN=$(GOCMD) clean
GOMOD=$(GOCMD) mod
BINARY_NAME=seg-layout
# Build flags
LDFLAGS=-ldflags "-w -s"
DEBUG_FLAGS=-gcflags "all=-N -l"
# Build targets
.PHONY: all build clean test deps debug
all: deps build
build:
$(GOBUILD) $(LDFLAGS) -o $(BINARY_NAME) ./cmd/main/main.go
debug:
$(GOBUILD) $(DEBUG_FLAGS) -o $(BINARY_NAME) ./cmd/main/main.go
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f *.out
rm -f *.prof
test:
$(GOTEST) -v ./...
test-coverage:
$(GOTEST) -v -coverprofile=coverage.out ./...
$(GOCMD) tool cover -html=coverage.out -o coverage.html
deps:
$(GOMOD) tidy
# Development tools
.PHONY: fmt lint
fmt:
$(GOCMD) fmt ./...
lint:
$(GOCMD) vet ./...
# Run the program
.PHONY: run test-run debug-run profile-run endurance-test-10t endurance-test-100t
run: build
./$(BINARY_NAME)
debug-run: debug
./$(BINARY_NAME) --debug --delete-ratio=0.3 --max-size=4194304 --min-size=512 --operations=1000
# Run performance test with default parameters
test-run: build
./$(BINARY_NAME) --delete-ratio=0.3 --max-size=4194304 --min-size=512 --operations=1000
# Run endurance tests
endurance-test-10t: debug
./$(BINARY_NAME) --debug --mode=endurance --target-write=10995116277760 --max-size=4194304 --min-size=512 --cpuprofile=cpu_10t.prof --memprofile=mem_10t.prof
endurance-test-100t: debug
./$(BINARY_NAME) --debug --mode=endurance --target-write=109951162777600 --max-size=4194304 --min-size=512 --cpuprofile=cpu_100t.prof --memprofile=mem_100t.prof
# Run with profiling
profile-run: debug
./$(BINARY_NAME) --debug --delete-ratio=0.3 --max-size=4194304 --min-size=512 --operations=1000 -cpuprofile=cpu.prof -memprofile=mem.prof
# Default target
.DEFAULT_GOAL := build