Re: [RFC PATCH bpf-next v5 7/8] selftests/bpf: move shared build definitions into Makefile.buildvars
Mykola Lysenko <[email protected]>
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <CAMtxOX27udJdM0JWDrLHn=pWzQpCTxgVTv462vS+XYt3+8t5xg@mail.gmail.com> |
On Wed, Aug 5, 2026 at 4:34 PM Eduard Zingerman <[email protected]> wrote: > > On Tue, 2026-08-04 at 10:01 -0700, Mykola Lysenko wrote: > > ... > > Thank you for taking time to reshuffle the diff, such that the > Makefile.buildvars preserves the original relative order. > Much easier to review. Thank you for taking time to review! > > ... > > > --- a/tools/testing/selftests/bpf/Makefile > > +++ b/tools/testing/selftests/bpf/Makefile > > @@ -3,60 +3,15 @@ include ../../../build/Build.include > > ... > > > -GENHDR := $(GENDIR)/autoconf.h > > PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > It seems this can be removed as well, all uses are after > Makefile.buildvars is included. Or is it needed for one of the other > includes? It is not - none of the earlier includes reference PKG_CONFIG (or srctree), and the remaining uses in the top Makefile are all recipe-time, after the include. > > ... > > > @@ -220,21 +151,8 @@ ifeq ($(feature-llvm),1) > > ... > > > -HOST_BPFOBJ := $(HOST_BUILD_DIR)/libbpf/libbpf.a > > -RESOLVE_BTFIDS := $(HOST_BUILD_DIR)/resolve_btfids/resolve_btfids > > +include Makefile.buildvars > > It appears that this include can be moved up, to the lib.mk include. > In this case the duplicate definitions for `srctree` and `PKG_CONFIG` > can be removed (and both can reside in Makefile.buildvars). > Wdyt? Agreed, will do in v6. > > ... > > > --- /dev/null > > +++ b/tools/testing/selftests/bpf/Makefile.buildvars > > ... > > > +PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config > > ... > > > +ifeq ($(srctree),) > > +srctree := $(patsubst %/,%,$(dir $(CURDIR))) > > +srctree := $(patsubst %/,%,$(dir $(srctree))) > > +srctree := $(patsubst %/,%,$(dir $(srctree))) > > +srctree := $(patsubst %/,%,$(dir $(srctree))) > > +endif > > In case if shuffling includes around does not work, can we export > `srctree` in the main makefile and not copy it here? Not needed with the above. Thanks! > > ...