summaryrefslogtreecommitdiffstats
path: root/tools/bpf
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2021-02-05 13:40:18 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-10 13:36:10 +0200
commitf60c918b07b79b73501b12060ccac0ec2a291eb5 (patch)
treee6a5773429be9af91d338d1a207e21f56f41600a /tools/bpf
parent249719092447af04e481ca555ead110a1477059f (diff)
downloadlinux-stable-f60c918b07b79b73501b12060ccac0ec2a291eb5.tar.gz
linux-stable-f60c918b07b79b73501b12060ccac0ec2a291eb5.tar.bz2
linux-stable-f60c918b07b79b73501b12060ccac0ec2a291eb5.zip
tools/resolve_btfids: Check objects before removing
[ Upstream commit f23130979c2f15ea29a431cd9e1ea7916337bbd4 ] We want this clean to be called from tree's root clean and that one is silent if there's nothing to clean. Adding check for all object to clean and display CLEAN messages only if there are objects to remove. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20210205124020.683286-3-jolsa@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/bpf')
-rw-r--r--tools/bpf/resolve_btfids/Makefile17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
index 1d46a247ec95..be09ec4f03ff 100644
--- a/tools/bpf/resolve_btfids/Makefile
+++ b/tools/bpf/resolve_btfids/Makefile
@@ -64,13 +64,20 @@ $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN)
$(call msg,LINK,$@)
$(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS)
+clean_objects := $(wildcard $(OUTPUT)/*.o \
+ $(OUTPUT)/.*.o.cmd \
+ $(OUTPUT)/.*.o.d \
+ $(OUTPUT)/libbpf \
+ $(OUTPUT)/libsubcmd \
+ $(OUTPUT)/resolve_btfids)
+
+ifneq ($(clean_objects),)
clean: fixdep-clean
$(call msg,CLEAN,$(BINARY))
- $(Q)$(RM) -f $(BINARY); \
- $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \
- $(RM) -rf $(OUTPUT)/libbpf; \
- $(RM) -rf $(OUTPUT)/libsubcmd; \
- find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
+ $(Q)$(RM) -rf $(clean_objects)
+else
+clean:
+endif
tags:
$(call msg,GEN,,tags)