diff mbox series

[bpf-next,3/4] tools/resolve_btfids: Set srctree variable unconditionally

Message ID 20210204211825.588160-4-jolsa@kernel.org (mailing list archive)
State New
Headers show
Series [bpf-next,1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories | expand

Commit Message

Jiri Olsa Feb. 4, 2021, 9:18 p.m. UTC
We want this clean to be called from tree's root Makefile,
which defines same srctree variable and that will screw
the make setup.

We actually do not use srctree being passed from outside,
so we can solve this by setting current srctree value
directly.

Also root Makefile does not define the implicit RM variable,
so adding RM initialization.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/bpf/resolve_btfids/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Song Liu Feb. 4, 2021, 11:41 p.m. UTC | #1
> On Feb 4, 2021, at 1:18 PM, Jiri Olsa <jolsa@kernel.org> wrote:
> 
> We want this clean to be called from tree's root Makefile,
> which defines same srctree variable and that will screw
> the make setup.
> 
> We actually do not use srctree being passed from outside,
> so we can solve this by setting current srctree value
> directly.
> 
> Also root Makefile does not define the implicit RM variable,
> so adding RM initialization.
> 
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>

Acked-by: Song Liu <songliubraving@fb.com>


> ---
> tools/bpf/resolve_btfids/Makefile | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
> index 3007cfabf5e6..b41fc9a81e83 100644
> --- a/tools/bpf/resolve_btfids/Makefile
> +++ b/tools/bpf/resolve_btfids/Makefile
> @@ -2,11 +2,9 @@
> include ../../scripts/Makefile.include
> include ../../scripts/Makefile.arch
> 
> -ifeq ($(srctree),)
> srctree := $(patsubst %/,%,$(dir $(CURDIR)))
> srctree := $(patsubst %/,%,$(dir $(srctree)))
> srctree := $(patsubst %/,%,$(dir $(srctree)))
> -endif
> 
> ifeq ($(V),1)
>   Q =
> @@ -22,6 +20,7 @@ AR       = $(HOSTAR)
> CC       = $(HOSTCC)
> LD       = $(HOSTLD)
> ARCH     = $(HOSTARCH)
> +RM      ?= rm
> 
> OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
> 
> -- 
> 2.26.2
>
Andrii Nakryiko Feb. 5, 2021, 1:24 a.m. UTC | #2
On Thu, Feb 4, 2021 at 1:21 PM Jiri Olsa <jolsa@kernel.org> wrote:
>
> We want this clean to be called from tree's root Makefile,
> which defines same srctree variable and that will screw
> the make setup.
>
> We actually do not use srctree being passed from outside,
> so we can solve this by setting current srctree value
> directly.
>
> Also root Makefile does not define the implicit RM variable,
> so adding RM initialization.
>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  tools/bpf/resolve_btfids/Makefile | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
> index 3007cfabf5e6..b41fc9a81e83 100644
> --- a/tools/bpf/resolve_btfids/Makefile
> +++ b/tools/bpf/resolve_btfids/Makefile
> @@ -2,11 +2,9 @@
>  include ../../scripts/Makefile.include
>  include ../../scripts/Makefile.arch
>
> -ifeq ($(srctree),)
>  srctree := $(patsubst %/,%,$(dir $(CURDIR)))
>  srctree := $(patsubst %/,%,$(dir $(srctree)))
>  srctree := $(patsubst %/,%,$(dir $(srctree)))

Is this just a weird way of doing $(abspath $(CURDIR)/../../../)? Are
there any advantages compared to a more straightforward way?

> -endif
>
>  ifeq ($(V),1)
>    Q =
> @@ -22,6 +20,7 @@ AR       = $(HOSTAR)
>  CC       = $(HOSTCC)
>  LD       = $(HOSTLD)
>  ARCH     = $(HOSTARCH)
> +RM      ?= rm
>
>  OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
>
> --
> 2.26.2
>
diff mbox series

Patch

diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
index 3007cfabf5e6..b41fc9a81e83 100644
--- a/tools/bpf/resolve_btfids/Makefile
+++ b/tools/bpf/resolve_btfids/Makefile
@@ -2,11 +2,9 @@ 
 include ../../scripts/Makefile.include
 include ../../scripts/Makefile.arch
 
-ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
-endif
 
 ifeq ($(V),1)
   Q =
@@ -22,6 +20,7 @@  AR       = $(HOSTAR)
 CC       = $(HOSTCC)
 LD       = $(HOSTLD)
 ARCH     = $(HOSTARCH)
+RM      ?= rm
 
 OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/