-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
64 lines (50 loc) · 1.63 KB
/
Makefile
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
# Public variables
DESTDIR ?=
PREFIX ?= /usr/local
OUTPUT_DIR ?= out
DST ?=
# Private variables
obj = r3map-benchmark-direct-mount r3map-benchmark-managed-mount r3map-benchmark-migration
all: $(addprefix build/,$(obj))
# Build
build: $(addprefix build/,$(obj))
$(addprefix build/,$(obj)):
ifdef DST
go build -o $(DST) ./cmd/$(subst build/,,$@)
else
go build -o $(OUTPUT_DIR)/$(subst build/,,$@) ./cmd/$(subst build/,,$@)
endif
# Install
install: $(addprefix install/,$(obj))
$(addprefix install/,$(obj)):
install -D -m 0755 $(OUTPUT_DIR)/$(subst install/,,$@) $(DESTDIR)$(PREFIX)/bin/$(subst install/,,$@)
# Uninstall
uninstall: $(addprefix uninstall/,$(obj))
$(addprefix uninstall/,$(obj)):
rm $(DESTDIR)$(PREFIX)/bin/$(subst uninstall/,,$@)
# Run
$(addprefix run/,$(obj)):
$(subst run/,,$@) $(ARGS)
# Test
test:
go test -timeout 3600s -parallel $(shell nproc) ./...
# Integration
integration: integration/direct-mount-file integration/direct-mount-directory integration/managed-mount-file
integration/direct-mount-file:
$(OUTPUT_DIR)/r3map-benchmark-direct-mount --remote-backend=file
integration/direct-mount-directory:
$(OUTPUT_DIR)/r3map-benchmark-direct-mount --remote-backend=directory --remote-backend-chunking
integration/managed-mount-file:
$(OUTPUT_DIR)/r3map-benchmark-managed-mount --remote-backend=file
# Benchmark
benchmark:
go test -timeout 3600s -bench=./... ./...
# Clean
clean:
rm -rf out
# Dependencies
depend:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install github.com/loopholelabs/frpc-go/protoc-gen-go-frpc@latest
go generate ./...