diff options
author | Shuah Khan <skhan@linuxfoundation.org> | 2019-09-27 03:13:44 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-09-30 10:53:34 +0200 |
commit | 55d554f5d14071f7c2c5dbd88d0a2eb695c97d16 (patch) | |
tree | 85687b7767bf1c94f63f8c4d7944068e19dfca84 /tools/bpf/Makefile | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net (diff) | |
download | linux-55d554f5d14071f7c2c5dbd88d0a2eb695c97d16.tar.xz linux-55d554f5d14071f7c2c5dbd88d0a2eb695c97d16.zip |
tools: bpf: Use !building_out_of_srctree to determine srctree
make TARGETS=bpf kselftest fails with:
Makefile:127: tools/build/Makefile.include: No such file or directory
When the bpf tool make is invoked from tools Makefile, srctree is
cleared and the current logic check for srctree equals to empty
string to determine srctree location from CURDIR.
When the build in invoked from selftests/bpf Makefile, the srctree
is set to "." and the same logic used for srctree equals to empty is
needed to determine srctree.
Check building_out_of_srctree undefined as the condition for both
cases to fix "make TARGETS=bpf kselftest" build failure.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20190927011344.4695-1-skhan@linuxfoundation.org
Diffstat (limited to 'tools/bpf/Makefile')
-rw-r--r-- | tools/bpf/Makefile | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile index fbf5e4a0cb9c..5d1995fd369c 100644 --- a/tools/bpf/Makefile +++ b/tools/bpf/Makefile @@ -12,7 +12,11 @@ INSTALL ?= install CFLAGS += -Wall -O2 CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/include/uapi -I$(srctree)/include -ifeq ($(srctree),) +# This will work when bpf is built in tools env. where srctree +# isn't set and when invoked from selftests build, where srctree +# is set to ".". building_out_of_srctree is undefined for in srctree +# builds +ifndef building_out_of_srctree srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) endif |