Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/resolve_btfids: Check objects before removing

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

authored by

Jiri Olsa and committed by
Andrii Nakryiko
f2313097 fc6b48f6

+12 -5
+12 -5
tools/bpf/resolve_btfids/Makefile
··· 64 64 $(call msg,LINK,$@) 65 65 $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) 66 66 67 + clean_objects := $(wildcard $(OUTPUT)/*.o \ 68 + $(OUTPUT)/.*.o.cmd \ 69 + $(OUTPUT)/.*.o.d \ 70 + $(OUTPUT)/libbpf \ 71 + $(OUTPUT)/libsubcmd \ 72 + $(OUTPUT)/resolve_btfids) 73 + 74 + ifneq ($(clean_objects),) 67 75 clean: fixdep-clean 68 76 $(call msg,CLEAN,$(BINARY)) 69 - $(Q)$(RM) -f $(BINARY); \ 70 - $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ 71 - $(RM) -rf $(OUTPUT)/libbpf; \ 72 - $(RM) -rf $(OUTPUT)/libsubcmd; \ 73 - find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) 77 + $(Q)$(RM) -rf $(clean_objects) 78 + else 79 + clean: 80 + endif 74 81 75 82 tags: 76 83 $(call msg,GEN,,tags)