Skip to content

Commit 661b37c

Browse files
netoptimizerborkmann
authored andcommitted
tools, bpf/build: Cleanup feature files on make clean
The system for "Auto-detecting system features" located under tools/build/ are (currently) used by perf, libbpf and bpftool. It can contain stalled feature detection files, which are not cleaned up by libbpf and bpftool on make clean (side-note: perf tool is correct). Fix this by making the users invoke the make clean target. Some details about the changes. The libbpf Makefile already had a clean-config target (which seems to be copy-pasted from perf), but this target was not "connected" (a make dependency) to clean target. Choose not to rename target as someone might be using it. Did change the output from "CLEAN config" to "CLEAN feature-detect", to make it more clear what happens. This is related to the complaint and troubleshooting in the following link: https://lore.kernel.org/lkml/20200818122007.2d1cfe2d@carbon/ Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Jiri Olsa <jolsa@redhat.com> Link: https://lore.kernel.org/lkml/20200818122007.2d1cfe2d@carbon/ Link: https://lore.kernel.org/bpf/159851841661.1072907.13770213104521805592.stgit@firesoul
1 parent 2e80be6 commit 661b37c

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

tools/bpf/bpftool/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,11 @@ $(OUTPUT)bpftool: $(OBJS) $(LIBBPF)
176176
$(OUTPUT)%.o: %.c
177177
$(QUIET_CC)$(CC) $(CFLAGS) -c -MMD -o $@ $<
178178

179-
clean: $(LIBBPF)-clean
179+
feature-detect-clean:
180+
$(call QUIET_CLEAN, feature-detect)
181+
$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null
182+
183+
clean: $(LIBBPF)-clean feature-detect-clean
180184
$(call QUIET_CLEAN, bpftool)
181185
$(Q)$(RM) -- $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d
182186
$(Q)$(RM) -- $(BPFTOOL_BOOTSTRAP) $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h

tools/build/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ clean:
3838
$(call QUIET_CLEAN, fixdep)
3939
$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
4040
$(Q)rm -f $(OUTPUT)fixdep
41+
$(call QUIET_CLEAN, feature-detect)
42+
$(Q)$(MAKE) -C feature/ clean >/dev/null
4143

4244
$(OUTPUT)fixdep-in.o: FORCE
4345
$(Q)$(MAKE) $(build)=fixdep

tools/lib/bpf/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,10 @@ install: install_lib install_pkgconfig install_headers
264264
### Cleaning rules
265265

266266
config-clean:
267-
$(call QUIET_CLEAN, config)
267+
$(call QUIET_CLEAN, feature-detect)
268268
$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ clean >/dev/null
269269

270-
clean:
270+
clean: config-clean
271271
$(call QUIET_CLEAN, libbpf) $(RM) -rf $(CMD_TARGETS) \
272272
*~ .*.d .*.cmd LIBBPF-CFLAGS $(BPF_HELPER_DEFS) \
273273
$(SHARED_OBJDIR) $(STATIC_OBJDIR) \

0 commit comments

Comments
 (0)