Skip to content

Commit

Permalink
build: support eBPF programs in nested directories
Browse files Browse the repository at this point in the history
The current build system sets the name of the generated
skeleton directly to the file's name minus the .skel.h suffix.
Passing names of eBPF targets that contain a directory will
result in wrong program names and syntax errors in the skeleton
source file. The commit pops out the directory part from the name.
This change doesn't affect the current programs in the repository
but adds the feature to have to have eBPF code in special directories.

Signed-off-by: Jalal Mostafa <[email protected]>
  • Loading branch information
jalalmostafa committed Sep 16, 2024
1 parent bad5f36 commit cf5ceb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ all: $(USER_TARGETS) $(XDP_OBJ) $(EXTRA_TARGETS) $(TEST_TARGETS) man

.PHONY: clean
clean::
$(Q)rm -f $(USER_TARGETS) $(XDP_OBJ) $(TEST_TARGETS) $(USER_OBJ) $(TEST_OBJ) $(USER_GEN) $(BPF_SKEL_H) *.ll
$(Q)rm -f $(USER_TARGETS) $(XDP_OBJ) $(TEST_TARGETS) $(USER_OBJ) $(TEST_OBJ) $(USER_GEN) $(BPF_SKEL_H) *.ll **/*.ll

.PHONY: install
install: all install_local
Expand Down Expand Up @@ -121,7 +121,7 @@ $(XDP_OBJ): %.o: %.c $(KERN_USER_H) $(EXTRA_DEPS) $(BPF_HEADERS) $(LIBMK)
$(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}

$(BPF_SKEL_H): %.skel.h: %.bpf.o
$(QUIET_GEN)$(BPFTOOL) gen skeleton $< name ${@:.skel.h=} > $@
$(QUIET_GEN)$(BPFTOOL) gen skeleton $< name $(notdir ${@:.skel.h=}) > $@

.PHONY: man
ifeq ($(EMACS),)
Expand Down

0 comments on commit cf5ceb1

Please sign in to comment.