-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (31 loc) · 715 Bytes
/
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
APP=ebpf-diskalert
.PHONY: build
build: gen $(APP)
.PHONY: run
run: build
sudo ./$(APP)
.PHONY: gen
gen: sum vmlinux src/diskalert_bpfel.go
.PHONY: vmlinux
vmlinux: src/bpf/vmlinux.h
.PHONY: sum
sum: go.sum
.PHONY: fmt
fmt: sum
go fmt src/*.go
.PHONY: clean
clean:
-rm $(APP)
-rm src/gen*
-rm src/bpf/vmlinux.h
-rm go.sum
sed 's/v.*/latest/g' -i go.mod
$(APP): src/main.go src/diskalert_bpfel.go
CGO_ENABLED=0 go build -o $(APP) src/*.go
src/bpf/vmlinux.h:
bpftool btf dump file /sys/kernel/btf/vmlinux format c > src/bpf/vmlinux.h
src/diskalert_bpfel.go: src/bpf/diskalert.bpf.c
go generate src/*.go
go.sum:
go mod download github.com/cilium/ebpf
go get github.com/cilium/ebpf/internal/unix