-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (24 loc) · 820 Bytes
/
Makefile
File metadata and controls
35 lines (24 loc) · 820 Bytes
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
GO_BUILD := GOOS=$(GOOS) GOARCH=$(GOARCH) go build
GO_BUILD_TARGET := siper
CLANG := clang
CFLAGS := -O2 -target bpf -g -c
BUILD_DIR := build
BPF_SOURCE_DIR := bpf
BPF_BUILD_DIR := $(BUILD_DIR)
BPF_SOURCE := $(wildcard $(BPF_SOURCE_DIR)/*.bpf.c)
BPF_OBJECTS := $(patsubst $(BPF_SOURCE_DIR)/%.bpf.c, $(BPF_BUILD_DIR)/%.o, $(BPF_SOURCE))
FORMATTER := scripts/formatter.sh
all: siper-go siper-bpf
generate-vmlinux:
@test -f /sys/kernel/btf/vmlinux || (echo "BTF not found"; exit 1)
bpftool btf dump file /sys/kernel/btf/vmlinux format c > bpf/include/vmlinux.h
siper-go:
cd cmd && $(GO_BUILD) -o ../$(BUILD_DIR)/$(GO_BUILD_TARGET) .
siper-bpf: $(BPF_OBJECTS)
$(BPF_BUILD_DIR)/%.o: $(BPF_SOURCE_DIR)/%.bpf.c
$(CLANG) $(CFLAGS) $< -o $@
clean:
rm -f $(BPF_OBJECTS)
rm -f $(BUILD_DIR)/*
format:
$(FORMATTER)