Daniel Borkmann <daniel@xxxxxxxxxxxxx> writes:[...]
On 11/28/19 5:07 PM, Toke HÃiland-JÃrgensen wrote:
From: Jiri Olsa <jolsa@xxxxxxxxxx>
ifeq ($(srctree),)
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
@@ -63,6 +72,19 @@ RM ?= rm -f
FEATURE_USER = .bpftool
FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib
FEATURE_DISPLAY = libbfd disassembler-four-args zlib
+ifdef LIBBPF_DYNAMIC
+ FEATURE_TESTS += libbpf
+ FEATURE_DISPLAY += libbpf
+
+ # for linking with debug library run:
+ # make LIBBPF_DYNAMIC=1 LIBBPF_DIR=/opt/libbpf
The Makefile already has BPF_DIR which points right now to
'$(srctree)/tools/lib/bpf/' and LIBBPF_PATH for the final one and
where $(LIBBPF_PATH)libbpf.a is expected to reside. Can't we improve
the Makefile to reuse and work with these instead of adding yet
another LIBBPF_DIR var which makes future changes in this area more
confusing? The libbpf build spills out libbpf.{a,so*} by default
anyway.
I see what you mean; however, LIBBPF_DIR is meant to be specifically an
override for the dynamic library, not just the path to libbpf.
Would it be less confusing to overload the LIBBPF_DYNAMIC variable
instead? I.e.,
make LIBBPF_DYNAMIC=1
would dynamically link against the libbpf installed in the system, but
make LIBBPF_DYNAMIC=/opt/libbpf
would override that and link against whatever is in /opt/libbpf instead?
WDYT?