All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] tools: bpf: fix build for 'make -s tools/bpf O=<dir>'
@ 2019-11-19 10:56 Quentin Monnet
  2019-11-21  8:52 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: Quentin Monnet @ 2019-11-19 10:56 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann
  Cc: bpf, netdev, oss-drivers, Quentin Monnet, Shuah Khan

Building selftests with 'make TARGETS=bpf kselftest' was fixed in commit
55d554f5d140 ("tools: bpf: Use !building_out_of_srctree to determine
srctree"). However, by updating $(srctree) in tools/bpf/Makefile for
in-tree builds only, we leave out the case where we pass an output
directory to build BPF tools, but $(srctree) is not set. This
typically happens for:

    $ make -s tools/bpf O=/tmp/foo
    Makefile:40: /tools/build/Makefile.feature: No such file or directory

Fix it by updating $(srctree) in the Makefile not only for out-of-tree
builds, but also if $(srctree) is empty.

Detected with test_bpftool_build.sh.

Fixes: 55d554f5d140 ("tools: bpf: Use !building_out_of_srctree to determine srctree")
Cc: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 tools/bpf/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
index 5d1995fd369c..5535650800ab 100644
--- a/tools/bpf/Makefile
+++ b/tools/bpf/Makefile
@@ -16,7 +16,13 @@ CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include
 # isn't set and when invoked from selftests build, where srctree
 # is set to ".". building_out_of_srctree is undefined for in srctree
 # builds
+ifeq ($(srctree),)
+update_srctree := 1
+endif
 ifndef building_out_of_srctree
+update_srctree := 1
+endif
+ifeq ($(update_srctree),1)
 srctree := $(patsubst %/,%,$(dir $(CURDIR)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
 endif
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next] tools: bpf: fix build for 'make -s tools/bpf O=<dir>'
  2019-11-19 10:56 [PATCH bpf-next] tools: bpf: fix build for 'make -s tools/bpf O=<dir>' Quentin Monnet
@ 2019-11-21  8:52 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2019-11-21  8:52 UTC (permalink / raw)
  To: Quentin Monnet; +Cc: Alexei Starovoitov, bpf, netdev, oss-drivers, Shuah Khan

On Tue, Nov 19, 2019 at 10:56:26AM +0000, Quentin Monnet wrote:
> Building selftests with 'make TARGETS=bpf kselftest' was fixed in commit
> 55d554f5d140 ("tools: bpf: Use !building_out_of_srctree to determine
> srctree"). However, by updating $(srctree) in tools/bpf/Makefile for
> in-tree builds only, we leave out the case where we pass an output
> directory to build BPF tools, but $(srctree) is not set. This
> typically happens for:
> 
>     $ make -s tools/bpf O=/tmp/foo
>     Makefile:40: /tools/build/Makefile.feature: No such file or directory
> 
> Fix it by updating $(srctree) in the Makefile not only for out-of-tree
> builds, but also if $(srctree) is empty.
> 
> Detected with test_bpftool_build.sh.
> 
> Fixes: 55d554f5d140 ("tools: bpf: Use !building_out_of_srctree to determine srctree")
> Cc: Shuah Khan <skhan@linuxfoundation.org>
> Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-21  8:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 10:56 [PATCH bpf-next] tools: bpf: fix build for 'make -s tools/bpf O=<dir>' Quentin Monnet
2019-11-21  8:52 ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.