Ihor Solodrai <ihor.solodrai@xxxxx> writes: > Auto-dependencies generated for %.test.o files refer to skels using > filenames as opposed to full paths. This requires make to be able to > link this name to an actual path, because not all generated skels are > put in the working directory. > > In the original patch [1], this was mitigated by this target: > > $(notdir %.skel.h): $(TRUNNER_OUTPUT)/%.skel.h > @true > > This turned out to be insufficient. > > First, %.lskel.h and %.subskel.h were missed, because a typical > selftests/bpf build could find these files in the working directory. > This error was detected by an out-of-tree build [2]. > > Second, even with missing rules added, this target causes unnecessary > rebuilds in the out-of-tree case, as X.skel.h is searched for in the > working directory, and not in the $(OUTPUT). > > Using vpath directive [3] is a better solution. Instead of introducing > a separate target (X.skel.h in addition to $(TRUNNER_OUTPUT)/X.skel.h), > make is instructed to search for skels in the output, which allows make > to correctly detect that skel has already been generated. > > [1]: https://lore.kernel.org/bpf/VJihUTnvtwEgv_mOnpfy7EgD9D2MPNoHO-MlANeLIzLJPGhDeyOuGKIYyKgk0O6KPjfM-MuhtvPwZcngN8WFqbTnTRyCSMc2aMZ1ODm1T_g=@pm.me/ > [2]: https://lore.kernel.org/bpf/CIjrhJwoIqMc2IhuppVqh4ZtJGbx8kC8rc9PHhAIU6RccnWT4I04F_EIr4GxQwxZe89McuGJlCnUk9UbkdvWtSJjAsd7mHmnTy9F8K2TLZM=@pm.me/ > [3]: https://www.gnu.org/software/make/manual/html_node/Selective-Search.html > > Reported-by: Björn Töpel <bjorn@xxxxxxxxxx> > Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxx> As you point out, there are rebuilds triggered for the bpf "install" target. Now rebuild are better than failures. Thanks for the fix! Tested-by: Björn Töpel <bjorn@xxxxxxxxxxxx>