diff options
author | 2022-12-16 17:24:48 +0530 | |
---|---|---|
committer | 2022-12-19 21:14:08 +0530 | |
commit | 3409364da8fa46eae8ca22a579e219dc74958079 (patch) | |
tree | 83cb1cc72c3c59465d7d3be0f793a896c0ad7a21 /src/bpfswitch/usrc/Makefile | |
parent | 34147ac299351c44d4f7d135892457fba38a132b (diff) |
ebpf: This patch adds ebpf-baremetal test support
Remove object files and binaries
Suggestions in systems/Readme.
Add license headers.
Signed-off-by: Sridhar K. N. Rao <srao@linuxfoundation.org>
Change-Id: I5fd481e3ed3eb51e6b8091cbf6d1ec8e3b00cbf0
Diffstat (limited to 'src/bpfswitch/usrc/Makefile')
-rw-r--r-- | src/bpfswitch/usrc/Makefile | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/bpfswitch/usrc/Makefile b/src/bpfswitch/usrc/Makefile new file mode 100644 index 00000000..fc15a6b0 --- /dev/null +++ b/src/bpfswitch/usrc/Makefile @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: GPL-2.0 + +include ../config.mk + +ifneq (,$(BUILDDIR)) +OBJDIR = $(BUILDDIR)/src/obj/ +else +OBJDIR = obj/ +endif + +ifneq (,$(BUILDDIR)) +BINDIR = $(BUILDDIR)/src/bin/ +else +BINDIR = bin/ +endif + +MODS += $(BINDIR)xdp_l2fwd +MODS += $(BINDIR)xdp_dummy + +VPATH := . + +CC = gcc +CFLAGS += -O2 -g -Wall + +INCLUDES = -I../include -I../include/uapi +INCLUDES += -I../include/tools + +ifneq (,$(LIBBPF_DIR)) +BPF_LINK_FEAT := $(shell egrep 'bpf_link_create' $(LIBBPF_PATH)/usr/include/bpf/libbpf.h) +ifneq (,$(BPF_LINK_FEAT)) +CFLAGS += -DHAVE_BPF_LINK_CREATE +endif +else +LIBBPF=-lbpf +endif + +#COMMON += $(OBJDIR)timestamps.o +COMMON += $(OBJDIR)libbpf_helpers.o +COMMON += $(OBJDIR)str_utils.o +#COMMON += $(OBJDIR)rbtree.o +#COMMON += $(OBJDIR)parse_pkt.o +#COMMON += $(OBJDIR)print_pkt.o +#COMMON += $(OBJDIR)ksyms.o + +all: build $(MODS) + +build: + @mkdir -p $(OBJDIR) $(BINDIR) + +$(BINDIR)%: $(OBJDIR)%.o $(COMMON) + $(QUIET_LINK)$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ -o $@ $(LDLIBS) + +$(BINDIR)xdp_%: $(OBJDIR)xdp_%_user.o $(COMMON) + $(QUIET_LINK)$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ -o $@ $(LDLIBS) + +$(OBJDIR)%.o: %.c + $(QUIET_CC)$(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c $^ -o $@ + +clean: + @rm -rf $(OBJDIR) $(BINDIR) |