-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (25 loc) · 824 Bytes
/
Makefile
File metadata and controls
35 lines (25 loc) · 824 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
PROG_NAME := prefetch_hint
KERN_SRC := $(PROG_NAME).ebpf.c
USER_SRC := user.ebpf.c
ARCH ?= x86
CLANG := clang
PKG_CONFIG ?= pkg-config
KERN_CFLAGS := \
-O2 -g -v \
-target bpf \
-Wall -Werror \
-D__TARGET_ARCH_$(ARCH) \
-I.
USER_CFLAGS := -O2 -g -v -Wall -Wextra
USER_LDFLAGS := $(shell $(PKG_CONFIG) --libs libbpf libelf zlib) -lelf -lz
KERN_OBJ := $(KERN_SRC:.c=.o)
all: $(KERN_OBJ) $(PROG_NAME)
$(KERN_OBJ): $(KERN_SRC)
$(CLANG) $(KERN_CFLAGS) -c $< -o $@
$(PROG_NAME): $(USER_SRC)
$(CLANG) $(USER_CFLAGS) $< -o $@ $(USER_LDFLAGS)
.PHONY: run clean
clean:
rm $(KERN_OBJ) $(PROG_NAME)
headers:
bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h