Skip to content

Commit fbdb620

Browse files
qmonnetborkmann
authored andcommitted
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. v2: - New patch. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 45c5589 commit fbdb620

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎tools/bpf/.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FEATURE-DUMP.bpf
2+
feature
23
bpf_asm
34
bpf_dbg
45
bpf_exp.yacc.*

‎tools/bpf/Makefile‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
8181

8282
clean: bpftool_clean
8383
$(call QUIET_CLEAN, bpf-progs)
84-
$(Q)rm -rf $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
84+
$(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
8585
$(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
8686
$(call QUIET_CLEAN, core-gen)
87-
$(Q)rm -f $(OUTPUT)FEATURE-DUMP.bpf
87+
$(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.bpf
88+
$(Q)$(RM) -r -- $(OUTPUT)feature
8889

8990
install: $(PROGS) bpftool_install
9091
$(call QUIET_INSTALL, bpf_jit_disasm)

‎tools/bpf/bpftool/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
bpftool*.8
44
bpf-helpers.*
55
FEATURE-DUMP.bpftool
6+
feature
7+
libbpf

‎tools/bpf/bpftool/Makefile‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ $(OUTPUT)%.o: %.c
124124

125125
clean: $(LIBBPF)-clean
126126
$(call QUIET_CLEAN, bpftool)
127-
$(Q)$(RM) $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d
127+
$(Q)$(RM) -- $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d
128+
$(Q)$(RM) -r -- $(OUTPUT)libbpf/
128129
$(call QUIET_CLEAN, core-gen)
129-
$(Q)$(RM) $(OUTPUT)FEATURE-DUMP.bpftool
130+
$(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.bpftool
131+
$(Q)$(RM) -r -- $(OUTPUT)feature/
130132

131133
install: $(OUTPUT)bpftool
132134
$(call QUIET_INSTALL, bpftool)
@@ -137,8 +139,8 @@ install: $(OUTPUT)bpftool
137139

138140
uninstall:
139141
$(call QUIET_UNINST, bpftool)
140-
$(Q)$(RM) $(DESTDIR)$(prefix)/sbin/bpftool
141-
$(Q)$(RM) $(DESTDIR)$(bash_compdir)/bpftool
142+
$(Q)$(RM) -- $(DESTDIR)$(prefix)/sbin/bpftool
143+
$(Q)$(RM) -- $(DESTDIR)$(bash_compdir)/bpftool
142144

143145
doc:
144146
$(call descend,Documentation)

0 commit comments

Comments
 (0)