Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1LIBDIR := ../../../lib
2BPFDIR := $(LIBDIR)/bpf
3APIDIR := ../../../include/uapi
4GENDIR := ../../../../include/generated
5GENHDR := $(GENDIR)/autoconf.h
6
7ifneq ($(wildcard $(GENHDR)),)
8 GENFLAGS := -DHAVE_GENHDR
9endif
10
11CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
12LDLIBS += -lcap -lelf
13
14TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
15 test_align
16
17TEST_GEN_FILES = test_pkt_access.o test_xdp.o test_l4lb.o test_tcp_estats.o
18
19TEST_PROGS := test_kmod.sh
20
21include ../lib.mk
22
23BPFOBJ := $(OUTPUT)/libbpf.a
24
25$(TEST_GEN_PROGS): $(BPFOBJ)
26
27.PHONY: force
28
29# force a rebuild of BPFOBJ when its dependencies are updated
30force:
31
32$(BPFOBJ): force
33 $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/
34
35CLANG ?= clang
36
37%.o: %.c
38 $(CLANG) -I. -I./include/uapi -I../../../include/uapi \
39 -I../../../../samples/bpf/ \
40 -Wno-compare-distinct-pointer-types \
41 -O2 -target bpf -c $< -o $@