Makefile 1.0 KB
Newer Older
1
LIBDIR := ../../../lib
2
BPFDIR := $(LIBDIR)/bpf
3 4 5
APIDIR := ../../../include/uapi
GENDIR := ../../../../include/generated
GENHDR := $(GENDIR)/autoconf.h
6

7 8 9 10
ifneq ($(wildcard $(GENHDR)),)
  GENFLAGS := -DHAVE_GENHDR
endif

11
CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
12
LDLIBS += -lcap -lelf
13

14 15
TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
	test_align
16

17
TEST_GEN_FILES = test_pkt_access.o test_xdp.o test_l4lb.o test_tcp_estats.o test_obj_id.o \
18
	test_pkt_md_access.o test_xdp_redirect.o sockmap_parse_prog.o sockmap_verdict_prog.o
19

20
TEST_PROGS := test_kmod.sh test_xdp_redirect.sh
21

22 23
include ../lib.mk

24
BPFOBJ := $(OUTPUT)/libbpf.a
25 26

$(TEST_GEN_PROGS): $(BPFOBJ)
27

28
.PHONY: force
29 30 31 32 33

# force a rebuild of BPFOBJ when its dependencies are updated
force:

$(BPFOBJ): force
34
	$(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/
35 36 37 38

CLANG ?= clang

%.o: %.c
39
	$(CLANG) -I. -I./include/uapi -I../../../include/uapi \
40
		-Wno-compare-distinct-pointer-types \
41
		-O2 -target bpf -c $< -o $@