2017-02-12 06:20:23 +08:00
|
|
|
LIBDIR := ../../../lib
|
2017-03-20 14:03:14 +08:00
|
|
|
BPFDIR := $(LIBDIR)/bpf
|
2017-03-31 08:24:04 +08:00
|
|
|
APIDIR := ../../../include/uapi
|
|
|
|
GENDIR := ../../../../include/generated
|
|
|
|
GENHDR := $(GENDIR)/autoconf.h
|
2017-02-12 06:20:23 +08:00
|
|
|
|
2017-03-31 08:24:04 +08:00
|
|
|
ifneq ($(wildcard $(GENHDR)),)
|
|
|
|
GENFLAGS := -DHAVE_GENHDR
|
|
|
|
endif
|
|
|
|
|
2017-04-06 22:25:07 +08:00
|
|
|
CFLAGS += -Wall -O2 -I$(APIDIR) -I$(LIBDIR) -I$(GENDIR) $(GENFLAGS) -I../../../include
|
2017-03-31 12:45:41 +08:00
|
|
|
LDLIBS += -lcap -lelf
|
2016-10-17 20:28:36 +08:00
|
|
|
|
2017-05-11 02:43:51 +08:00
|
|
|
TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
|
|
|
|
test_align
|
2017-03-31 12:45:41 +08:00
|
|
|
|
2017-06-14 06:52:14 +08:00
|
|
|
TEST_GEN_FILES = test_pkt_access.o test_xdp.o test_l4lb.o test_tcp_estats.o test_obj_id.o \
|
2017-08-16 13:34:22 +08:00
|
|
|
test_pkt_md_access.o test_xdp_redirect.o sockmap_parse_prog.o sockmap_verdict_prog.o
|
2016-10-17 20:28:36 +08:00
|
|
|
|
2017-08-08 04:14:42 +08:00
|
|
|
TEST_PROGS := test_kmod.sh test_xdp_redirect.sh
|
2016-10-17 20:28:36 +08:00
|
|
|
|
2017-03-20 14:03:14 +08:00
|
|
|
include ../lib.mk
|
|
|
|
|
2017-03-31 12:45:41 +08:00
|
|
|
BPFOBJ := $(OUTPUT)/libbpf.a
|
2017-03-20 14:03:14 +08:00
|
|
|
|
|
|
|
$(TEST_GEN_PROGS): $(BPFOBJ)
|
2017-03-11 14:05:55 +08:00
|
|
|
|
2017-03-20 14:03:14 +08:00
|
|
|
.PHONY: force
|
2017-02-12 06:20:23 +08:00
|
|
|
|
|
|
|
# force a rebuild of BPFOBJ when its dependencies are updated
|
|
|
|
force:
|
|
|
|
|
|
|
|
$(BPFOBJ): force
|
2017-03-20 14:03:14 +08:00
|
|
|
$(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/
|
2017-03-31 12:45:41 +08:00
|
|
|
|
|
|
|
CLANG ?= clang
|
|
|
|
|
|
|
|
%.o: %.c
|
2017-05-12 03:00:50 +08:00
|
|
|
$(CLANG) -I. -I./include/uapi -I../../../include/uapi \
|
2017-05-03 12:14:43 +08:00
|
|
|
-Wno-compare-distinct-pointer-types \
|
2017-03-31 12:45:41 +08:00
|
|
|
-O2 -target bpf -c $< -o $@
|