blob: ad32efd34a0b9429524a9d8e08346e48b4faa91b (
plain)
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
|
EXTRA_DIST= include bypass_filter.c filter.c lb.c vlan_filter.c xdp_filter.c \
xdp_lb.c bpf_helpers.h hash_func01.h
if BUILD_EBPF
# Maintaining a local copy of UAPI linux/bpf.h
BPF_CFLAGS = -Iinclude
BPF_TARGETS = lb.bpf
BPF_TARGETS += filter.bpf
BPF_TARGETS += bypass_filter.bpf
BPF_TARGETS += xdp_filter.bpf
BPF_TARGETS += xdp_lb.bpf
BPF_TARGETS += vlan_filter.bpf
all: $(BPF_TARGETS)
$(BPF_TARGETS): %.bpf: %.c
# From C-code to LLVM-IR format suffix .ll (clang -S -emit-llvm)
${CLANG} -Wall $(BPF_CFLAGS) -O2 \
-I/usr/include/$(build_cpu)-$(build_os)/ \
-D__KERNEL__ -D__ASM_SYSREG_H \
-target bpf -S -emit-llvm $< -o ${@:.bpf=.ll}
# From LLVM-IR to BPF-bytecode in ELF-obj file
${LLC} -march=bpf -filetype=obj ${@:.bpf=.ll} -o $@
${RM} ${@:.bpf=.ll}
CLEANFILES = *.bpf *.ll
endif
|