]> ruderich.org/simon Gitweb - bpf/xdp-example.git/blob - Makefile
Initial commit
[bpf/xdp-example.git] / Makefile
1 CLANG = clang
2 CFLAGS = -g -O2 -Wall -Wextra
3
4 PROGS = example
5
6
7 all: $(PROGS)
8
9 clean:
10         rm -f $(PROGS)
11         rm -f vmlinux.h *.bpf.o *.skel.h
12
13
14 vmlinux.h:
15         bpftool btf dump file /sys/kernel/btf/vmlinux format c > $@
16
17 %.bpf.o: %.bpf.c vmlinux.h
18         $(CLANG) $(CFLAGS) -target bpf -c $<
19
20 %.skel.h: %.bpf.o
21         bpftool gen skeleton $< > $@
22
23 $(PROGS): %: %.c %.skel.h
24         $(CC) $(CFLAGS) -o $@ $< -lbpf
25
26 .PHONY: all clean
27
28 .DELETE_ON_ERROR:
29 .SECONDARY: