From 3409364da8fa46eae8ca22a579e219dc74958079 Mon Sep 17 00:00:00 2001 From: "Sridhar K. N. Rao" Date: Fri, 16 Dec 2022 17:24:48 +0530 Subject: 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 Change-Id: I5fd481e3ed3eb51e6b8091cbf6d1ec8e3b00cbf0 --- src/bpfswitch/usrc/Makefile | 60 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/bpfswitch/usrc/Makefile (limited to 'src/bpfswitch/usrc/Makefile') 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) -- cgit 1.2.3-korg