Skip to content

Commit

Permalink
ebpf: Add a separate target for skeleton
Browse files Browse the repository at this point in the history
This generalizes the rule to generate the skeleton and allows to add
another.

Signed-off-by: Akihiko Odaki <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
  • Loading branch information
akihikodaki authored and jasowang committed Jun 4, 2024
1 parent f5c69e7 commit 6832aa8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tools/ebpf/Makefile.ebpf
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
OBJS = rss.bpf.o
SKELETONS = rss.bpf.skeleton.h

LLVM_STRIP ?= llvm-strip
CLANG ?= clang
INC_FLAGS = `$(CLANG) -print-file-name=include`
EXTRA_CFLAGS ?= -O2 -g -target bpf

all: $(OBJS)
all: $(SKELETONS)

.PHONY: clean

clean:
rm -f $(OBJS)
rm -f rss.bpf.skeleton.h
rm -f $(SKELETONS) $(SKELETONS:%.skeleton.h=%.o)

$(OBJS): %.o:%.c
%.o: %.c
$(CLANG) $(INC_FLAGS) \
-D__KERNEL__ -D__ASM_SYSREG_H \
-I../include $(LINUXINCLUDE) \
$(EXTRA_CFLAGS) -c $< -o $@
$(LLVM_STRIP) -g $@
bpftool gen skeleton rss.bpf.o > rss.bpf.skeleton.h
cp rss.bpf.skeleton.h ../../ebpf/

%.skeleton.h: %.o
bpftool gen skeleton $< > $@
cp $@ ../../ebpf/

0 comments on commit 6832aa8

Please sign in to comment.