On Monday, September 16th, 2024 at 12:59 PM, Ihor Solodrai <ihor.solodrai@xxxxx> wrote: [...] > --- > tools/testing/selftests/bpf/Makefile | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > index df75f1beb731..365740f24d2e 100644 > --- a/tools/testing/selftests/bpf/Makefile > +++ b/tools/testing/selftests/bpf/Makefile > @@ -622,10 +622,11 @@ $(TRUNNER_BPF_SKELS_LINKED): $(TRUNNER_OUTPUT)/%: $$$$(%-deps) $(BPFTOOL) | $(TR > > # When the compiler generates a %.d file, only skel basenames (not > # full paths) are specified as prerequisites for corresponding %.o > -# file. This target makes %.skel.h basename dependent on full paths, > -# linking generated %.d dependency with actual %.skel.h files. > -$(notdir %.skel.h): $(TRUNNER_OUTPUT)/%.skel.h > - @true > +# file. vpath directives below instruct make to search for skel files > +# in TRUNNER_OUTPUT, if they are not present in the working directory. > +vpath %.skel.h $(TRUNNER_OUTPUT) > +vpath %.lskel.h $(TRUNNER_OUTPUT) > +vpath %.subskel.h $(TRUNNER_OUTPUT) > > endif > > -- > 2.34.1 Hi Björn. It'd be great if you could confirm that this patch works for your use-case. Regarding unnecessary rebuilds, you will still see some skels and bpf.o objects rebuilt on out-of-tree builds. These are related to $(LINKED_SKELS) in selftests/bpf/Makefile. They are entangled with %-deps variables, and I couldn't come up with a similar solution for them quickly. However, there are just a couple of them, and the rebuild is relatively fast, so I decided to submit a patch that fixes most of the problem. Thank you!