tools: bpf: account for generated feature/ and libbpf/ directories
authorQuentin Monnet <quentin.monnet@netronome.com>
Fri, 30 Aug 2019 11:00:39 +0000 (12:00 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 30 Aug 2019 22:38:16 +0000 (00:38 +0200)
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>
tools/bpf/.gitignore
tools/bpf/Makefile
tools/bpf/bpftool/.gitignore
tools/bpf/bpftool/Makefile

index dfe2bd5a4b9538a87572d45a36c6ec8e4dcdfaf0..59024197e71dd185b393544d8a3b0714a41c7b91 100644 (file)
@@ -1,4 +1,5 @@
 FEATURE-DUMP.bpf
+feature
 bpf_asm
 bpf_dbg
 bpf_exp.yacc.*
index 53b60ad452f5d3ebd5d2edad0b80ef12558f2215..fbf5e4a0cb9c9cdb7c3c13c28e2d4cf3b5b90f3b 100644 (file)
@@ -81,10 +81,11 @@ $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
 
 clean: bpftool_clean
        $(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.*
        $(call QUIET_CLEAN, core-gen)
-       $(Q)rm -f $(OUTPUT)FEATURE-DUMP.bpf
+       $(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.bpf
+       $(Q)$(RM) -r -- $(OUTPUT)feature
 
 install: $(PROGS) bpftool_install
        $(call QUIET_INSTALL, bpf_jit_disasm)
index 8248b8dd89d4b9cd4b2d9622623d43f2140a42f2..b13926432b84c6fa7da8afd938bb06be8ffcb981 100644 (file)
@@ -3,3 +3,5 @@
 bpftool*.8
 bpf-helpers.*
 FEATURE-DUMP.bpftool
+feature
+libbpf
index 3fc82ff9b52cff10870a0544f5ab01a2392218dc..b0c5a369f54aa9c969d59396f46276637a2322b0 100644 (file)
@@ -124,9 +124,11 @@ $(OUTPUT)%.o: %.c
 
 clean: $(LIBBPF)-clean
        $(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)
-       $(Q)$(RM) $(OUTPUT)FEATURE-DUMP.bpftool
+       $(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.bpftool
+       $(Q)$(RM) -r -- $(OUTPUT)feature/
 
 install: $(OUTPUT)bpftool
        $(call QUIET_INSTALL, bpftool)
@@ -137,8 +139,8 @@ install: $(OUTPUT)bpftool
 
 uninstall:
        $(call QUIET_UNINST, bpftool)
-       $(Q)$(RM) $(DESTDIR)$(prefix)/sbin/bpftool
-       $(Q)$(RM) $(DESTDIR)$(bash_compdir)/bpftool
+       $(Q)$(RM) -- $(DESTDIR)$(prefix)/sbin/bpftool
+       $(Q)$(RM) -- $(DESTDIR)$(bash_compdir)/bpftool
 
 doc:
        $(call descend,Documentation)