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 16TEST_GEN_FILES = test_pkt_access.o test_xdp.o test_l4lb.o test_tcp_estats.o 17 18TEST_PROGS := test_kmod.sh 19 20include ../lib.mk 21 22BPFOBJ := $(OUTPUT)/libbpf.a 23 24$(TEST_GEN_PROGS): $(BPFOBJ) 25 26.PHONY: force 27 28# force a rebuild of BPFOBJ when its dependencies are updated 29force: 30 31$(BPFOBJ): force 32 $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/ 33 34CLANG ?= clang 35 36%.o: %.c 37 $(CLANG) -I. -I../../../include/uapi -I../../../../samples/bpf/ \ 38 -Wno-compare-distinct-pointer-types \ 39 -O2 -target bpf -c $< -o $@ 40