> On Feb 4, 2021, at 1:18 PM, Jiri Olsa <jo...@kernel.org> wrote:
>
> 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 <jo...@kernel.org>
Acked-by: Song Liu <songliubrav...@fb.com>
> ---
> tools/bpf/resolve_btfids/Makefile | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/tools/bpf/resolve_btfids/Makefile
> b/tools/bpf/resolve_btfids/Makefile
> index b780b3a9fb07..3007cfabf5e6 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)
> +
> +clean:
> +
> +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)
> +endif
>
> tags:
> $(call msg,GEN,,tags)
> --
> 2.26.2
>