]> git.baikalelectronics.ru Git - kernel.git/commit
selftests, bpf: Fix makefile dependencies on libbpf
authorJiri Benc <jbenc@redhat.com>
Mon, 27 Sep 2021 16:01:36 +0000 (18:01 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 28 Sep 2021 07:30:14 +0000 (09:30 +0200)
commit1bdd370016eee247e50106227fa5da0218c96a5f
tree728602519cd64dbb9b5bb4240b92a61f248b971c
parent3f1f0abac9de0f031edafc90198cccc7498dd24c
selftests, bpf: Fix makefile dependencies on libbpf

When building bpf selftest with make -j, I'm randomly getting build failures
such as this one:

  In file included from progs/bpf_flow.c:19:
  [...]/tools/testing/selftests/bpf/tools/include/bpf/bpf_helpers.h:11:10: fatal error: 'bpf_helper_defs.h' file not found
  #include "bpf_helper_defs.h"
           ^~~~~~~~~~~~~~~~~~~

The file that fails the build varies between runs but it's always in the
progs/ subdir.

The reason is a missing make dependency on libbpf for the .o files in
progs/. There was a dependency before commit 42a2ae06de528 but that commit
removed it to prevent unneeded rebuilds. However, that only works if libbpf
has been built already; the 'wildcard' prerequisite does not trigger when
there's no bpf_helper_defs.h generated yet.

Keep the libbpf as an order-only prerequisite to satisfy both goals. It is
always built before the progs/ objects but it does not trigger unnecessary
rebuilds by itself.

Fixes: 42a2ae06de528 ("selftests/bpf: BPF object files should depend only on libbpf headers")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/ee84ab66436fba05a197f952af23c98d90eb6243.1632758415.git.jbenc@redhat.com
tools/testing/selftests/bpf/Makefile