Skip to content

Commit 2031af2

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
libbpf,selftests/bpf: Fix clean targets
Libbpf's clean target should clean out generated files in $(OUTPUT) directory and not make assumption that $(OUTPUT) directory is current working directory. Selftest's Makefile should delegate cleaning of libbpf-generated files to libbpf's Makefile. This ensures more robust clean up. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 492ab02 commit 2031af2

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tools/lib/bpf/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,11 @@ config-clean:
273273
$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null
274274

275275
clean:
276-
$(call QUIET_CLEAN, libbpf) $(RM) -rf $(CMD_TARGETS) \
277-
*.o *~ *.a *.so *.so.$(LIBBPF_MAJOR_VERSION) .*.d .*.cmd \
278-
*.pc LIBBPF-CFLAGS $(BPF_HELPER_DEFS) \
279-
$(SHARED_OBJDIR) $(STATIC_OBJDIR)
276+
$(call QUIET_CLEAN, libbpf) $(RM) -rf $(CMD_TARGETS) \
277+
*~ .*.d .*.cmd LIBBPF-CFLAGS $(BPF_HELPER_DEFS) \
278+
$(SHARED_OBJDIR) $(STATIC_OBJDIR) \
279+
$(addprefix $(OUTPUT), \
280+
*.o *.a *.so *.so.$(LIBBPF_MAJOR_VERSION) *.pc)
280281
$(call QUIET_CLEAN, core-gen) $(RM) $(OUTPUT)FEATURE-DUMP.libbpf
281282

282283

tools/testing/selftests/bpf/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ OVERRIDE_TARGETS := 1
9393
override define CLEAN
9494
$(call msg, CLEAN)
9595
$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
96+
$(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/ clean
9697
endef
9798

9899
include ../lib.mk
@@ -377,5 +378,5 @@ $(OUTPUT)/test_cpp: test_cpp.cpp $(OUTPUT)/test_core_extern.skel.h $(BPFOBJ)
377378

378379
EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) \
379380
prog_tests/tests.h map_tests/tests.h verifier/tests.h \
380-
feature $(OUTPUT)/*.o $(OUTPUT)/no_alu32 $(OUTPUT)/bpf_gcc \
381-
tools *.skel.h
381+
feature \
382+
$(addprefix $(OUTPUT)/,*.o *.skel.h no_alu32 bpf_gcc tools)

0 commit comments

Comments
 (0)