0001 .. SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
0002
0003 Building libbpf
0004 ===============
0005
0006 libelf and zlib are internal dependencies of libbpf and thus are required to link
0007 against and must be installed on the system for applications to work.
0008 pkg-config is used by default to find libelf, and the program called
0009 can be overridden with PKG_CONFIG.
0010
0011 If using pkg-config at build time is not desired, it can be disabled by
0012 setting NO_PKG_CONFIG=1 when calling make.
0013
0014 To build both static libbpf.a and shared libbpf.so:
0015
0016 .. code-block:: bash
0017
0018 $ cd src
0019 $ make
0020
0021 To build only static libbpf.a library in directory build/ and install them
0022 together with libbpf headers in a staging directory root/:
0023
0024 .. code-block:: bash
0025
0026 $ cd src
0027 $ mkdir build root
0028 $ BUILD_STATIC_ONLY=y OBJDIR=build DESTDIR=root make install
0029
0030 To build both static libbpf.a and shared libbpf.so against a custom libelf
0031 dependency installed in /build/root/ and install them together with libbpf
0032 headers in a build directory /build/root/:
0033
0034 .. code-block:: bash
0035
0036 $ cd src
0037 $ PKG_CONFIG_PATH=/build/root/lib64/pkgconfig DESTDIR=/build/root make