2024-11-11 15:02 UTC+0100 ~ Daan De Meyer <daan.j.demeyer@xxxxxxxxx> > This allows building bpftool directly via "make -C tools/bpf/bpftool". > > Without this change, building bpftool via "make -C tools/bpf/bpftool" > fails with the following error: > > """ > + make ARCH=x86 -C tools/bpf/bpftool bootstrap > Makefile:127: tools/build/Makefile.feature: No such file or directory > make[3]: *** No rule to make target 'tools/build/Makefile.feature'. Stop. > error: Bad exit status from /var/tmp/rpm-tmp.3p0IcJ (%build) > """ > > This is the same workaround that is also applied in tools/bpf/Makefile. My understanding of the check on building_out_of_srctree in tools/bpf/Makefile (from commit 55d554f5d140's description) is that it fixes the build from "make TARGETS=bpf kselftest", not from "make -C tools/bpf". Trying again "make ARCH=x86 -C tools/bpf/bpftool bootstrap" at the root of the Linux repo, not building out-of-tree, this works fine for me, without the need for your patch. I'm trying to understand what your setup is and what creates the failure that you observe (and that I can't reproduce), so I'd like more context if possible. Are you just running that command from the root of the tree? If that's the case, what values do you observe for $(srctree) and $(building_out_of_srctree) when entering bpftool's Makefile? Your v2 also still misses your sign-off, and please remember as well to add all relevant maintainers in copy of your email. > --- > tools/bpf/bpftool/Makefile | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > index ba927379eb20..7c7d731077c9 100644 > --- a/tools/bpf/bpftool/Makefile > +++ b/tools/bpf/bpftool/Makefile > @@ -2,6 +2,12 @@ > include ../../scripts/Makefile.include > > 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))) > srctree := $(patsubst %/,%,$(dir $(srctree)))