Commit fbdb620b authored by Quentin Monnet's avatar Quentin Monnet Committed by Daniel Borkmann

tools: bpf: account for generated feature/ and libbpf/ directories

When building "tools/bpf" from the top of the Linux repository, the
build system passes a value for the $(OUTPUT) Makefile variable to
tools/bpf/Makefile and tools/bpf/bpftool/Makefile, which results in
generating "libbpf/" (for bpftool) and "feature/" (bpf and bpftool)
directories inside the tree.

This commit adds such directories to the relevant .gitignore files, and
edits the Makefiles to ensure they are removed on "make clean". The use
of "rm" is also made consistent throughout those Makefiles (relies on
the $(RM) variable, use "--" to prevent interpreting
$(OUTPUT)/$(DESTDIR) as options.

- New patch.
Signed-off-by: default avatarQuentin Monnet <>
Signed-off-by: default avatarDaniel Borkmann <>
parent 45c5589d
bpf_asm bpf_asm
bpf_dbg bpf_dbg
bpf_exp.yacc.* bpf_exp.yacc.*
...@@ -81,10 +81,11 @@ $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c ...@@ -81,10 +81,11 @@ $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
clean: bpftool_clean clean: bpftool_clean
$(call QUIET_CLEAN, bpf-progs) $(call QUIET_CLEAN, bpf-progs)
$(Q)rm -rf $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \ $(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
$(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.* $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
$(call QUIET_CLEAN, core-gen) $(call QUIET_CLEAN, core-gen)
$(Q)$(RM) -r -- $(OUTPUT)feature
install: $(PROGS) bpftool_install install: $(PROGS) bpftool_install
$(call QUIET_INSTALL, bpf_jit_disasm) $(call QUIET_INSTALL, bpf_jit_disasm)
...@@ -3,3 +3,5 @@ ...@@ -3,3 +3,5 @@
bpftool*.8 bpftool*.8
bpf-helpers.* bpf-helpers.*
...@@ -124,9 +124,11 @@ $(OUTPUT)%.o: %.c ...@@ -124,9 +124,11 @@ $(OUTPUT)%.o: %.c
clean: $(LIBBPF)-clean clean: $(LIBBPF)-clean
$(call QUIET_CLEAN, bpftool) $(call QUIET_CLEAN, bpftool)
$(Q)$(RM) $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d $(Q)$(RM) -- $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d
$(Q)$(RM) -r -- $(OUTPUT)libbpf/
$(call QUIET_CLEAN, core-gen) $(call QUIET_CLEAN, core-gen)
$(Q)$(RM) $(OUTPUT)FEATURE-DUMP.bpftool $(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.bpftool
$(Q)$(RM) -r -- $(OUTPUT)feature/
install: $(OUTPUT)bpftool install: $(OUTPUT)bpftool
$(call QUIET_INSTALL, bpftool) $(call QUIET_INSTALL, bpftool)
...@@ -137,8 +139,8 @@ install: $(OUTPUT)bpftool ...@@ -137,8 +139,8 @@ install: $(OUTPUT)bpftool
uninstall: uninstall:
$(call QUIET_UNINST, bpftool) $(call QUIET_UNINST, bpftool)
$(Q)$(RM) $(DESTDIR)$(prefix)/sbin/bpftool $(Q)$(RM) -- $(DESTDIR)$(prefix)/sbin/bpftool
$(Q)$(RM) $(DESTDIR)$(bash_compdir)/bpftool $(Q)$(RM) -- $(DESTDIR)$(bash_compdir)/bpftool
doc: doc:
$(call descend,Documentation) $(call descend,Documentation)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment